working timer blinki example

interrupts
polymurph 4 years ago
parent 0d645c30bb
commit ee7d7e31ed

@ -16,7 +16,8 @@ void timerActivateBus(timerNo_t timer)
void timerEnableTimer(timerNo_t timer) void timerEnableTimer(timerNo_t timer)
{ {
BASE->CR1 &= ~0x01; //all the timers have the same CEN bit in CR1 register pos 0 //BASE->CR1 &= ~0x01; //all the timers have the same CEN bit in CR1 register pos 0
BASE->CR1 |= 0x01; //all the timers have the same CEN bit in CR1 register pos 0
} }
void timerSetClkSource(timerNo_t timer, clkSources_t clk) void timerSetClkSource(timerNo_t timer, clkSources_t clk)

@ -16,8 +16,8 @@ int main(int argc, char *argv[])
delayInitMs(8000000, 1000); delayInitMs(8000000, 1000);
timerActivateBus(timer_2); timerActivateBus(timer_2);
timerSetPrescaler(timer_2, 1599); timerSetPrescaler(timer_2, 159);
timerSetAutoReload(timer_2, 9999); timerSetAutoReload(timer_2, 999);
timerClearCounter(timer_2); timerClearCounter(timer_2);
timerEnableTimer(timer_2); timerEnableTimer(timer_2);

Loading…
Cancel
Save