From 0c7a5c990f3d954d8dcad48eb5165b0b336c5d5b Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 14 Jun 2011 16:35:10 -0400 Subject: HardwareTimer.cpp: fix HardwareTimer::setPeriod() --- wirish/HardwareTimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wirish') 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); -- cgit v1.2.3