|
|
|
@ -55,7 +55,7 @@
|
|
|
|
|
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static uint16_t getTimerCount() {
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTimer;
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTc;
|
|
|
|
|
|
|
|
|
|
tc->COUNT16.CTRLBSET.reg = TC_CTRLBCLR_CMD_READSYNC;
|
|
|
|
|
SYNC(tc->COUNT16.SYNCBUSY.bit.CTRLB || tc->COUNT16.SYNCBUSY.bit.COUNT);
|
|
|
|
@ -67,7 +67,7 @@ FORCE_INLINE static uint16_t getTimerCount() {
|
|
|
|
|
// Interrupt handler for the TC
|
|
|
|
|
// ----------------------------
|
|
|
|
|
HAL_SERVO_TIMER_ISR() {
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTimer;
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTc;
|
|
|
|
|
const timer16_Sequence_t timer =
|
|
|
|
|
#ifndef _useTimer1
|
|
|
|
|
_timer2
|
|
|
|
@ -127,7 +127,7 @@ HAL_SERVO_TIMER_ISR() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initISR(timer16_Sequence_t timer) {
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTimer;
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTc;
|
|
|
|
|
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
|
|
|
|
|
|
|
|
|
static bool initialized = false; // Servo TC has been initialized
|
|
|
|
@ -204,7 +204,7 @@ void initISR(timer16_Sequence_t timer) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void finISR(timer16_Sequence_t timer) {
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTimer;
|
|
|
|
|
Tc * const tc = TimerConfig[SERVO_TC].pTc;
|
|
|
|
|
const uint8_t tcChannel = TIMER_TCCHANNEL(timer);
|
|
|
|
|
|
|
|
|
|
// Disable the match channel interrupt request
|
|
|
|
|