Browse Source

Fix error in IntervalTimer with float input

https://forum.pjrc.com/threads/33072-IntervalTimer-h-bug
main
PaulStoffregen 8 years ago
parent
commit
aaebae7728
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      teensy3/IntervalTimer.h

+ 1
- 1
teensy3/IntervalTimer.h View File

@@ -74,7 +74,7 @@ class IntervalTimer {
}
bool begin(ISR newISR, float newPeriod) {
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;
return beginCycles(newISR, newValue);
}

Loading…
Cancel
Save