Ver código fonte

Implement user mode un time functions

DricomDragon 5 anos atrás
pai
commit
3c713f0735
3 arquivos alterados com 7 adições e 7 exclusões
  1. 3 3
      prog/sources/setup-loop.cpp
  2. 2 2
      prog/sources/time.cpp
  3. 2 2
      prog/sources/time.h

+ 3 - 3
prog/sources/setup-loop.cpp

@@ -10,7 +10,7 @@ void setup (USER_MODE) {
 	GPIOD_PDDR |= (1 << 7) ;
 
 	// Init clock
-	startSystick();
+	startSystick(MODE);
 }
 
 void loop (USER_MODE) {
@@ -18,12 +18,12 @@ void loop (USER_MODE) {
 	GPIOD_PSOR = 1 << 7 ;
 
 	// Wait...
-	busyWaitDuring(500);
+	busyWaitDuring(MODE_ 500);
 
 	// Drive PTD7 low --> led is off
 	GPIOD_PCOR = 1 << 7 ;
 
 	// Wait...
-	busyWaitDuring(500);
+	busyWaitDuring(MODE_ 500);
 }
 

+ 2 - 2
prog/sources/time.cpp

@@ -1,12 +1,12 @@
 #include "all-headers.h"
 
-void startSystick (void) {
+void startSystick (USER_MODE) {
 	SYST_RVR = CPU_MHZ * 1000 - 1 ; // Underflow every ms
 	SYST_CVR = 0 ;
 	SYST_CSR = SYST_CSR_CLKSOURCE | SYST_CSR_ENABLE ;
 }
 
-void busyWaitDuring (const uint32_t inDelayMS) {
+void busyWaitDuring (USER_MODE_ const uint32_t inDelayMS) {
 	const uint32_t COUNTFLAG_MASK = 1 << 16 ;
 	for (uint32_t i = 0; i < inDelayMS; i++) {
 		while ((SYST_CSR & COUNTFLAG_MASK) == 0) {} // Busy wait, polling COUNTFLAG

+ 2 - 2
prog/sources/time.h

@@ -2,6 +2,6 @@
 
 #include <stdint.h>
 
-void startSystick (void);
+void startSystick (USER_MODE);
 
-void busyWaitDuring (const uint32_t inDelayMS);
+void busyWaitDuring (USER_MODE_ const uint32_t inDelayMS);