aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmaple/systick.c5
-rw-r--r--libmaple/systick.h9
-rw-r--r--wirish/time.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/libmaple/systick.c b/libmaple/systick.c
index 12a3e22..2b09a64 100644
--- a/libmaple/systick.c
+++ b/libmaple/systick.c
@@ -39,7 +39,7 @@
#define SYSTICK_TICKINT BIT(1) // Interrupt on systick countdown
#define SYSTICK_ENABLE BIT(0) // Turn on the counter
-volatile uint32 systick_timer_millis = 0;
+volatile uint32 systick_timer_millis;
void systick_init(uint32 reload_val) {
/* Set the reload counter to tick every 1ms */
@@ -65,8 +65,7 @@ void systick_resume() {
SYSTICK_TICKINT);
}
+/** SysTick interrupt handler. Bumps up the tick counter. */
void SysTickHandler(void) {
systick_timer_millis++;
}
-
-
diff --git a/libmaple/systick.h b/libmaple/systick.h
index 7ec8497..ae1268a 100644
--- a/libmaple/systick.h
+++ b/libmaple/systick.h
@@ -33,14 +33,17 @@
#include "libmaple.h"
+#ifdef __cplusplus
+extern "C"{
+#endif
+
#define SYSTICK_CSR 0xE000E010 // Control and status register
#define SYSTICK_CNT 0xE000E018 // Current value register
#define SYSTICK_CSR_COUNTFLAG BIT(16)
-#ifdef __cplusplus
-extern "C"{
-#endif
+/** System elapsed time in milliseconds */
+volatile uint32 systick_timer_millis;
void systick_init(uint32 reload_val);
void systick_disable();
diff --git a/wirish/time.h b/wirish/time.h
index 742f28d..2a561d3 100644
--- a/wirish/time.h
+++ b/wirish/time.h
@@ -40,8 +40,6 @@ extern "C"{
#define US_PER_MS 1000
-extern volatile uint32 systick_timer_millis;
-
/* time in milliseconds since boot */
static inline uint32 millis(void) {
return systick_timer_millis;