Skip to content

Commit cfc9851

Browse files
committed
Fix RTC wakeup timer being off by one second
1 parent 1df5d43 commit cfc9851

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rtc.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,13 +469,15 @@ impl timer::CountDown for WakeupTimer<'_> {
469469
///
470470
/// # Panics
471471
///
472-
/// The `delay` argument supports 17 bits. Panics, if a value larger than
473-
/// 17 bits is passed.
472+
/// The `delay` argument must be in the range `1 <= delay <= 2^17`.
473+
/// Panics, if `delay` is outside of that range.
474474
fn start<T>(&mut self, delay: T)
475475
where T: Into<Self::Time>
476476
{
477477
let delay = delay.into();
478-
assert!(delay < 2^17);
478+
assert!(1 <= delay && delay <= 2^17);
479+
480+
let delay = delay - 1;
479481

480482
// Can't panic, as the error type is `Void`.
481483
self.cancel().unwrap();

0 commit comments

Comments
 (0)