Forráskód Böngészése

Improve comments in blinky example

TheZoq2 5 éve
szülő
commit
a5b8737355
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      examples/blinky.rs

+ 4 - 2
examples/blinky.rs

@@ -47,12 +47,14 @@ fn main() -> ! {
     // Acquire the GPIOC peripheral
     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);
     // Configure the syst timer to trigger an update every second
     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 {
-        // Wait until the timer triggers an update
         block!(timer.wait()).unwrap();
         led.set_high();
         block!(timer.wait()).unwrap();