Potential fix for Teensy crash when PWM idle enabled

This commit is contained in:
Josh Stewart 2018-10-05 20:26:08 +10:00
parent fd10a77ff4
commit 0fcc116d3f
1 changed files with 14 additions and 0 deletions

View File

@ -479,3 +479,17 @@ static inline void idleInterrupt() //Most ARM chips can simply call a function
idle_pwm_state = true; idle_pwm_state = true;
} }
} }
#if defined(CORE_TEENSY)
void ftm2_isr(void)
{
//FTM2 only has 2 compare channels
//Use separate variables for each test to ensure conversion to bool
bool interrupt1 = (FTM2_C0SC & FTM_CSC_CHF);
bool interrupt2 = (FTM2_C1SC & FTM_CSC_CHF); //Not currently used
if(interrupt2) { FTM2_C0SC &= ~FTM_CSC_CHF; idleInterrupt(); }
else if(interrupt2) { FTM1_C1SC &= ~FTM_CSC_CHF; } //Add a callback function here if this is ever used
}
#endif