summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-06-04 20:23:56 +0200
committerDamien George <damien@micropython.org>2022-10-06 22:36:26 +1100
commit98ae3126402260eab306e846d01d12af317d96a2 (patch)
tree12641aa781aa5eb146cf5d6e9eed66319ff4d42f
parent3d9940bc28e66464e22386916cb71100d6b24f1d (diff)
samd/samd_isr: Extend systick_ms to 64 bit.
By adding a 32 bit overflow counter. This allows it to be used for the time functions.
-rw-r--r--ports/samd/samd_isr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/samd/samd_isr.c b/ports/samd/samd_isr.c
index dcf80d28c..a7956c493 100644
--- a/ports/samd/samd_isr.c
+++ b/ports/samd/samd_isr.c
@@ -32,6 +32,7 @@ extern uint32_t _estack, _sidata, _sdata, _edata, _sbss, _ebss;
const ISR isr_vector[];
uint32_t systick_ms;
+volatile uint32_t systick_ms_upper;
void Reset_Handler(void) __attribute__((naked));
void Reset_Handler(void) {
@@ -81,7 +82,11 @@ void Default_Handler(void) {
}
void SysTick_Handler(void) {
- systick_ms += 1;
+ uint32_t next_tick = systick_ms + 1;
+ systick_ms = next_tick;
+ if (systick_ms == 0) {
+ systick_ms_upper += 1;
+ }
}
const ISR isr_vector[] __attribute__((section(".isr_vector"))) = {