aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/timers.c
diff options
context:
space:
mode:
authorPerry Hung <iperry@alum.mit.edu>2010-08-04 08:52:30 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-08-04 08:52:30 -0400
commitd2494611156c4ba477a1bbd1b07ba0cfc14b29e4 (patch)
tree48782014152efa392ac0689c4098e089da52c82c /libmaple/timers.c
parent2b7a1b40c96525cd4c6324f6e9d53845fb07a55f (diff)
downloadlibrambutan-d2494611156c4ba477a1bbd1b07ba0cfc14b29e4.tar.gz
librambutan-d2494611156c4ba477a1bbd1b07ba0cfc14b29e4.zip
Cleaned up wirish/time, some interrupt handling refactoring:
Fixed millis(), it was just wrong, before. Added micros(), not extensively tested. New implementation of delayMicroseconds(). Should be more consistent now. Added a handful of nvic routines to enable/disable interrupts. Cleaned up systick
Diffstat (limited to 'libmaple/timers.c')
-rw-r--r--libmaple/timers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libmaple/timers.c b/libmaple/timers.c
index a3890d4..6e6653c 100644
--- a/libmaple/timers.c
+++ b/libmaple/timers.c
@@ -30,6 +30,7 @@
#include "libmaple.h"
#include "rcc.h"
+#include "nvic.h"
#include "timers.h"
typedef struct {
@@ -476,25 +477,25 @@ void timer_attach_interrupt(uint8 timer_num, uint8 compare_num, voidFuncPtr hand
case 1:
timer = (Timer*)TIMER1_BASE;
timer1_handlers[compare_num-1] = handler;
- nvic_enable_interrupt(27);
+ nvic_irq_enable(NVIC_TIMER1);
timer->DIER |= (1 << compare_num); // 1-indexed compare nums
break;
case 2:
timer = (Timer*)TIMER2_BASE;
timer2_handlers[compare_num-1] = handler;
- nvic_enable_interrupt(28);
+ nvic_irq_enable(NVIC_TIMER2);
timer->DIER |= (1 << compare_num); // 1-indexed compare nums
break;
case 3:
timer = (Timer*)TIMER3_BASE;
timer3_handlers[compare_num-1] = handler;
- nvic_enable_interrupt(29);
+ nvic_irq_enable(NVIC_TIMER3);
timer->DIER |= (1 << compare_num); // 1-indexed compare nums
break;
case 4:
timer = (Timer*)TIMER4_BASE;
timer4_handlers[compare_num-1] = handler;
- nvic_enable_interrupt(30);
+ nvic_irq_enable(NVIC_TIMER4);
timer->DIER |= (1 << compare_num); // 1-indexed compare nums
break;
}