diff options
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/nvic.h | 1 | ||||
-rw-r--r-- | libmaple/timers.c | 19 |
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 |