https://forum.pjrc.com/threads/33072-IntervalTimer-h-bugteensy4-core
} | } | ||||
bool begin(ISR newISR, float newPeriod) { | bool begin(ISR newISR, float newPeriod) { | ||||
if (newPeriod <= 0 || newPeriod > MAX_PERIOD) return false; | if (newPeriod <= 0 || newPeriod > MAX_PERIOD) return false; | ||||
uint32_t newValue = (float)(F_BUS / 1000000) * newPeriod + 0.5; | |||||
uint32_t newValue = (float)(F_BUS / 1000000) * newPeriod - 0.5; | |||||
if (newValue < 40) return false; | if (newValue < 40) return false; | ||||
return beginCycles(newISR, newValue); | return beginCycles(newISR, newValue); | ||||
} | } |