aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wirish/HardwareTimer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/wirish/HardwareTimer.cpp b/wirish/HardwareTimer.cpp
index 64fa222..f55e6b0 100644
--- a/wirish/HardwareTimer.cpp
+++ b/wirish/HardwareTimer.cpp
@@ -77,8 +77,8 @@ uint16 HardwareTimer::setPeriod(uint32 microseconds) {
// With a prescale factor of 1, there are 72counts/ms
uint16 ps = ((microseconds*72)/65536) + 1;
setPrescaleFactor(ps);
- // Find this overflow will always be less than 65536
- setOverflow((microseconds*72)/ps);
+ // Finally, this overflow will always be less than 65536
+ setOverflow(((microseconds*72)/ps) - 1);
return this->overflow;
}
void HardwareTimer::setChannel1Mode(uint8 mode) {