Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
//! A LED roulette!
extern crate panic_semihosting;
use cortex_m_rt::entry;
use f3::{
hal::{delay::Delay, prelude::*, stm32f30x},
fn main() -> ! {
let cp = cortex_m::Peripherals::take().unwrap();
let dp = stm32f30x::Peripherals::take().unwrap();
let mut flash = dp.FLASH.constrain();
let mut rcc = dp.RCC.constrain();
let gpioe = dp.GPIOE.split(&mut rcc.ahb);
// clock configuration using the default settings (all clocks run at 8 MHz)
let clocks = rcc.cfgr.freeze(&mut flash.acr);
// TRY this alternate clock configuration (all clocks run at 16 MHz)
// let clocks = rcc.cfgr.sysclk(16.mhz()).freeze(&mut flash.acr);
let mut leds = Leds::new(gpioe);
let mut delay = Delay::new(cp.SYST, clocks);
let n = leds.len();
loop {
for curr in 0..n {
let next = (curr + 1) % n;