Skip to content

Commit

Permalink
timer: add an assert to the ref clock operating frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
ithinuel committed Aug 16, 2023
1 parent 5763a2e commit 4b9722c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rp2040-hal/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
clocks::ReferenceClock,
pac::{self, RESETS, TIMER},
resets::SubsystemReset,
typelevel::Sealed,
typelevel::Sealed, Clock,
};

/// Instant type used by the Timer & Alarm methods.
Expand Down Expand Up @@ -59,7 +59,8 @@ impl Timer {
/// Make sure that clocks and watchdog are configured, so
/// that timer ticks happen at a frequency of 1MHz.
/// Otherwise, `Timer` won't work as expected.
pub fn new(timer: TIMER, resets: &mut RESETS, _clocks: &ReferenceClock) -> Self {
pub fn new(timer: TIMER, resets: &mut RESETS, clocks: &ReferenceClock) -> Self {
assert_eq!(clocks.freq().to_Hz(), 1_000_000);
timer.reset_bring_down(resets);
timer.reset_bring_up(resets);
Self { _private: () }
Expand Down

0 comments on commit 4b9722c

Please sign in to comment.