aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-09-02 22:29:36 -0400
committerbnewbold <bnewbold@robocracy.org>2010-09-02 22:29:36 -0400
commit1c6f9a9b5e9f1896a6c3d1faa895af74b6c7e3e1 (patch)
tree1bad7914f39357e7654db991cbedd86dae09b065 /wirish
parent3b2cca3d375ad1d5301b1223119fba834a84e3fb (diff)
downloadlibrambutan-1c6f9a9b5e9f1896a6c3d1faa895af74b6c7e3e1.tar.gz
librambutan-1c6f9a9b5e9f1896a6c3d1faa895af74b6c7e3e1.zip
Off-by-one in timer setPeriod() function
Thanks CarlO!
Diffstat (limited to 'wirish')
-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) {