aboutsummaryrefslogtreecommitdiffstats
path: root/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'clock.c')
-rw-r--r--clock.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/clock.c b/clock.c
index 8041cb2..ab92386 100644
--- a/clock.c
+++ b/clock.c
@@ -45,15 +45,18 @@ void delay(uint32_t count)
while (ticks < target);
}
-void PendSV_Handler(void) {
-}
-
+__attribute__ ((naked))
void SysTick_Handler(void)
{
+ uint32_t lr;
+ asm("mov %0, lr" : "=r" (lr));
+
// just keep counting
ticks++;
- if (!(ticks % 500))
- SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
+ if (!(ticks % 10))
+ SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
+
+ asm("mov lr, %0; bx lr" :: "r" (lr));
}