aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/timers.c
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 /libmaple/timers.c
parentae64a19745b9f2b14e7b78ae3736f2853f27508e (diff)
downloadlibrambutan-552da8705245a876c2e816bab93edc2cb39f94e3.tar.gz
librambutan-552da8705245a876c2e816bab93edc2cb39f94e3.zip
timer fixes for maple native
Diffstat (limited to 'libmaple/timers.c')
-rw-r--r--libmaple/timers.c19
1 files changed, 17 insertions, 2 deletions
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