Interrupt counters added (use -DDEBUG_INTERRUPTS=YES to enable and CLI command "print int" to see them)

This commit is contained in:
Damjan Adamic
2016-04-03 17:51:20 +02:00
parent a0b4053e82
commit 9673df83a7
21 changed files with 188 additions and 52 deletions
+6 -12
View File
@@ -58,8 +58,8 @@ void init2MhzTimer()
TIMER_2MHz_TIMER->CR1 = TIM_CR1_CEN;
}
// Starts TIMER at 200Hz, 5mS period
void init5msTimer()
// Starts TIMER at 1000Hz
void init1msTimer()
{
INTERRUPT_5MS_TIMER->ARR = 999 ; // 1mS
INTERRUPT_5MS_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1 ; // 1uS from 30MHz
@@ -72,15 +72,8 @@ void init5msTimer()
NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, 7);
}
void stop5msTimer( void )
{
TIM14->CR1 = 0 ; // stop timer
NVIC_DisableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
RCC->APB1ENR &= ~RCC_APB1ENR_TIM14EN ; // Disable clock
}
// TODO use the same than board_sky9x.cpp
void interrupt5ms()
void interrupt1ms()
{
static uint32_t pre_scale ; // Used to get 10 Hz counter
@@ -106,7 +99,8 @@ void interrupt5ms()
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
{
TIM14->SR &= ~TIM_SR_UIF ;
interrupt5ms() ;
interrupt1ms() ;
DEBUG_INTERRUPT(INT_1MS);
}
void boardInit()
@@ -155,7 +149,7 @@ void boardInit()
lcdInit();
audioInit();
init2MhzTimer();
init5msTimer();
init1msTimer();
usbInit();
hapticInit();