aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-06-14 16:35:10 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-06-14 16:35:10 -0400
commit0c7a5c990f3d954d8dcad48eb5165b0b336c5d5b (patch)
tree9b9908605a2fc5a819ad07b653c4722f8a55d8da
parent3bf6e0327aa3cd93939f6596a5ff84af580c9cc5 (diff)
downloadlibrambutan-0c7a5c990f3d954d8dcad48eb5165b0b336c5d5b.tar.gz
librambutan-0c7a5c990f3d954d8dcad48eb5165b0b336c5d5b.zip
HardwareTimer.cpp: fix HardwareTimer::setPeriod()
-rw-r--r--wirish/HardwareTimer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/wirish/HardwareTimer.cpp b/wirish/HardwareTimer.cpp
index e5d3dc8..bd61a89 100644
--- a/wirish/HardwareTimer.cpp
+++ b/wirish/HardwareTimer.cpp
@@ -101,7 +101,7 @@ uint16 HardwareTimer::setPeriod(uint32 microseconds) {
}
uint32 period_cyc = microseconds * CYCLES_PER_MICROSECOND;
- uint16 prescaler = (uint16)(period_cyc / MAX_RELOAD);
+ uint16 prescaler = (uint16)(period_cyc / MAX_RELOAD + 1);
uint16 overflow = (uint16)round(period_cyc / prescaler);
this->setPrescaleFactor(prescaler);
this->setOverflow(overflow);