Parcourir la source

Change duration of LED blinking

DricomDragon il y a 5 ans
Parent
commit
3151d18449
1 fichiers modifiés avec 8 ajouts et 12 suppressions
  1. 8 12
      steps/01-blink-led/sources/setup-loop.cpp

+ 8 - 12
steps/01-blink-led/sources/setup-loop.cpp

@@ -1,26 +1,22 @@
 #include "all-headers.h"
 
-//——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
 // Led L2 is connected to PORTD:7 (active high)
 
 void setup (void) {
-//--- Configure PTD7 as digital port (input or output)
+// Configure PTD7 as digital port (input or output)
   PORTD_PCR (7) = PORT_PCR_MUX (1) ;
-//--- Configure PTD7 as digital output port (output level is low --> led is off)
+// Configure PTD7 as digital output port (output level is low --> led is off)
   GPIOD_PDDR |= (1 << 7) ;
 }
 
-//——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
-
 void loop (void) {
-//--- Drive PTD7 high --> led is on
+// Drive PTD7 high --> led is on
   GPIOD_PSOR = 1 << 7 ;
-//--- Wait...
-  for (volatile uint32_t i=0 ; i< 10 * 1000 * 1000 ; i++) {}
-//--- Drive PTD7 low --> led is off
+// Wait...
+  for (volatile uint32_t i=0 ; i< 10 * 2000 * 1000 ; i++) {}
+// Drive PTD7 low --> led is off
   GPIOD_PCOR = 1 << 7 ;
-//--- Wait...
-  for (volatile uint32_t i=0 ; i< 10 * 1000 * 1000 ; i++) {}
+// Wait...
+  for (volatile uint32_t i=0 ; i< 10 * 500 * 1000 ; i++) {}
 }
 
-//——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————