@@ -48,7 +48,8 @@ static volatile int8_t currentServoIndex[_Nbr_16timers];
48
48
extern " C" {
49
49
#endif
50
50
51
- inline void Servo_Handler (timer16_Sequence_t timer, NRF_TIMER_Type *nrfTimer, uint32_t ccReg)
51
+ static __inline__ void Servo_Handler (timer16_Sequence_t timer, NRF_TIMER_Type *nrfTimer, uint32_t ccReg) __attribute__((always_inline));
52
+ static __inline__ void Servo_Handler (timer16_Sequence_t timer, NRF_TIMER_Type *nrfTimer, uint32_t ccReg)
52
53
{
53
54
// Clear the interrupt event flag
54
55
nrfTimer->EVENTS_COMPARE [ccReg] = 0 ;
@@ -125,10 +126,10 @@ static void _initISR(NRF_TIMER_Type *nrfTimer, uint32_t ccReg, IRQn_Type timerIR
125
126
__disable_irq ();
126
127
nrfTimer->TASKS_STOP = 1 ;
127
128
128
- nrfTimer->MODE = TIMER_MODE_MODE_Timer;
129
- nrfTimer->BITMODE = TIMER_BITMODE_BITMODE_16Bit;
130
- nrfTimer->PRESCALER = ( TMR_FREQ_REG_PRESCALER << TIMER_PRESCALER_PRESCALER_Pos) ;
131
- nrfTimer->SHORTS = 0 ; // No CC event and CLEAR task shortcuts
129
+ nrfTimer->MODE = TIMER_MODE_MODE_Timer << TIMER_MODE_MODE_Pos ;
130
+ nrfTimer->BITMODE = TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos ;
131
+ nrfTimer->PRESCALER = TMR_FREQ_REG_PRESCALER << TIMER_PRESCALER_PRESCALER_Pos;
132
+ nrfTimer->SHORTS = TIMER_SHORTS_DISABLE_ALL;
132
133
nrfTimer->TASKS_CLEAR = 1 ; // Clear task
133
134
nrfTimer->EVENTS_COMPARE [ccReg] = 0 ; // Clear interrupt event flag
134
135
nrfTimer->CC [ccReg] = (uint32_t )usToTicks (REFRESH_INTERVAL);
@@ -142,6 +143,7 @@ static void _initISR(NRF_TIMER_Type *nrfTimer, uint32_t ccReg, IRQn_Type timerIR
142
143
} else if (ccReg == TMR_CC_REG3) {
143
144
nrfTimer->INTENSET = (TIMER_INTENSET_COMPARE3_Set << TIMER_INTENSET_COMPARE3_Pos);
144
145
}
146
+ NVIC_ClearPendingIRQ (timerIRQn);
145
147
NVIC_SetPriority (timerIRQn, TMR_PRIORITY);
146
148
NVIC_EnableIRQ (timerIRQn);
147
149
0 commit comments