aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-09-05 23:22:19 -0400
committerbnewbold <bnewbold@robocracy.org>2010-09-05 23:22:19 -0400
commit552da8705245a876c2e816bab93edc2cb39f94e3 (patch)
tree737dd3cf3ad2d090e421d62ca194f0a7dc3c125a
parentae64a19745b9f2b14e7b78ae3736f2853f27508e (diff)
downloadlibrambutan-552da8705245a876c2e816bab93edc2cb39f94e3.tar.gz
librambutan-552da8705245a876c2e816bab93edc2cb39f94e3.zip
timer fixes for maple native
-rw-r--r--libmaple/nvic.h1
-rw-r--r--libmaple/timers.c19
2 files changed, 18 insertions, 2 deletions
diff --git a/libmaple/nvic.h b/libmaple/nvic.h
index 4e425c5..4f4972d 100644
--- a/libmaple/nvic.h
+++ b/libmaple/nvic.h
@@ -64,6 +64,7 @@ enum {
NVIC_TIMER5 = 50, // high density only (Maple Native)
NVIC_TIMER6 = 54, // high density only (Maple Native)
NVIC_TIMER7 = 55, // high density only (Maple Native)
+ NVIC_TIMER8 = 46, // high density only (Maple Native)
NVIC_USART1 = 37,
NVIC_USART2 = 38,
NVIC_USART3 = 39,
diff --git a/libmaple/timers.c b/libmaple/timers.c
index 2941cd6..266ac76 100644
--- a/libmaple/timers.c
+++ b/libmaple/timers.c
@@ -182,18 +182,33 @@ void timer_disable_all(void) {
// TODO: refactor
// Note: this must be very robust because it gets called from, eg, ASSERT
timer_port *timer;
+ #if NR_TIMERS >= 8
+ timer_port *timers[6] = { (timer_port*)TIMER1_BASE,
+ (timer_port*)TIMER2_BASE,
+ (timer_port*)TIMER3_BASE,
+ (timer_port*)TIMER4_BASE,
+ (timer_port*)TIMER5_BASE,
+ (timer_port*)TIMER8_BASE,
+ };
+ uint8 i;
+ for (i = 0; i < 6; i++) {
+ timer = timers[i];
+ timer->CR1 = 0;
+ timer->CCER = 0;
+ }
+ #else
timer_port *timers[4] = { (timer_port*)TIMER1_BASE,
(timer_port*)TIMER2_BASE,
(timer_port*)TIMER3_BASE,
(timer_port*)TIMER4_BASE,
};
- int i;
-
+ uint8 i;
for (i = 0; i < 4; i++) {
timer = timers[i];
timer->CR1 = 0;
timer->CCER = 0;
}
+ #endif
}
// Sets the mode of individual timer channels, including a DISABLE mode