diff options
Diffstat (limited to 'src/lib/timers.c')
-rw-r--r-- | src/lib/timers.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/timers.c b/src/lib/timers.c index 2161d84..1e95f41 100644 --- a/src/lib/timers.c +++ b/src/lib/timers.c @@ -152,3 +152,40 @@ void timers_disable(void) { timer->CR1 = 0; } } + +void timers_disable_channel(uint8 timer_num, uint8 channel) { + Timer *timer; + switch (timer_num) { + case 1: + timer = (Timer*)TIMER1_BASE; + break; + case 2: + timer = (Timer*)TIMER2_BASE; + break; + case 3: + timer = (Timer*)TIMER3_BASE; + break; + case 4: + timer = (Timer*)TIMER4_BASE; + break; + default: + ASSERT(0); + } + + switch (channel) { + case 1: + timer->CCER &= ~(0x1); + break; + case 2: + timer->CCER &= ~(0x10); + break; + case 3: + timer->CCER &= ~(0x100); + break; + case 4: + timer->CCER &= ~(0x1000); + break; + default: + ASSERT(0); + } +} |