|
|
|
@ -55,18 +55,33 @@ void risingEdgeInterruptPinA1()
|
|
|
|
|
|
|
|
|
|
void interruptLEDtoggleOnTIM1counterCompare()
|
|
|
|
|
{
|
|
|
|
|
timerInitCounter(timer_2, 0xFFFF, 0, upCounting);
|
|
|
|
|
//timerInitCounter(timer_2, 0xFFFF, 0, upCounting);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// setclock division to 4
|
|
|
|
|
TIM2->CR1 |= TIM_CR1_CKD;
|
|
|
|
|
|
|
|
|
|
// only allow under-/overflow interrupts
|
|
|
|
|
TIM2->CR1 |= TIM_CR1_URS;
|
|
|
|
|
|
|
|
|
|
// set clock prescaler
|
|
|
|
|
TIM2->PSC = 0xFFFF;
|
|
|
|
|
|
|
|
|
|
// set outo reload value
|
|
|
|
|
TIM2->ARR = 0xFFFF;
|
|
|
|
|
|
|
|
|
|
// Enable Update Interrupt
|
|
|
|
|
TIM2->DIER |= TIM_DIER_UIE;
|
|
|
|
|
|
|
|
|
|
// reset status register
|
|
|
|
|
TIM2->SR = 0;
|
|
|
|
|
|
|
|
|
|
NVIC_SetPriority(TIM2_IRQn,0);
|
|
|
|
|
NVIC_EnableIRQ(TIM2_IRQn);
|
|
|
|
|
|
|
|
|
|
timerSart(timer_2);
|
|
|
|
|
TIM2->CR1 |= TIM_CR1_CEN;
|
|
|
|
|
|
|
|
|
|
//timerSart(timer_2);
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|