aboutsummaryrefslogtreecommitdiffstats
path: root/clock.c
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-01-01 17:40:28 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-01-01 17:40:28 -0500
commit058c283919424ef8b4425cdf74739535dd1d8072 (patch)
tree7aa6c40d7c6aa1dad5b0fba24f22c22759fcab59 /clock.c
parentde7c4fb07d1ac0298e7fc62000c35193e221aaae (diff)
heap; multitasking
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));
}