|
@@ -47,12 +47,14 @@ fn main() -> ! {
|
|
// Acquire the GPIOC peripheral
|
|
// Acquire the GPIOC peripheral
|
|
let mut gpioc = dp.GPIOC.split(&mut rcc.apb2);
|
|
let mut gpioc = dp.GPIOC.split(&mut rcc.apb2);
|
|
|
|
|
|
- // Configure gpio C pin 13 as a push-pull output
|
|
|
|
|
|
+ // Configure gpio C pin 13 as a push-pull output. The `crh` register is passed to the function
|
|
|
|
+ // in order to configure the port. For pins 0-7, crl should be passed instead.
|
|
let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
|
let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
|
// Configure the syst timer to trigger an update every second
|
|
// Configure the syst timer to trigger an update every second
|
|
let mut timer = Timer::syst(cp.SYST, 1.hz(), clocks);
|
|
let mut timer = Timer::syst(cp.SYST, 1.hz(), clocks);
|
|
|
|
+
|
|
|
|
+ // Wait for the timer to trigger an update and change the state of the LED
|
|
loop {
|
|
loop {
|
|
- // Wait until the timer triggers an update
|
|
|
|
block!(timer.wait()).unwrap();
|
|
block!(timer.wait()).unwrap();
|
|
led.set_high();
|
|
led.set_high();
|
|
block!(timer.wait()).unwrap();
|
|
block!(timer.wait()).unwrap();
|