diff options
| author | James Munns <[email protected]> | 2025-11-14 18:43:27 +0100 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-11-14 18:43:27 +0100 |
| commit | 8cdccae3c6c4a805cf5003b1a859734c105d76e8 (patch) | |
| tree | 7c605a58aa7e124bbed658dfc5f6822a25a83e98 /src/ostimer.rs | |
| parent | e799d6c8956ed3ea5ced65d58c3065a22927ad10 (diff) | |
Continue working on examples
Diffstat (limited to 'src/ostimer.rs')
| -rw-r--r-- | src/ostimer.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ostimer.rs b/src/ostimer.rs index efa534194..ebdf7d45d 100644 --- a/src/ostimer.rs +++ b/src/ostimer.rs | |||
| @@ -534,7 +534,7 @@ pub mod time_driver { | |||
| 534 | bin_to_gray, now_ticks_read, Regs, ALARM_ACTIVE, ALARM_CALLBACK, ALARM_FLAG, ALARM_TARGET_TIME, | 534 | bin_to_gray, now_ticks_read, Regs, ALARM_ACTIVE, ALARM_CALLBACK, ALARM_FLAG, ALARM_TARGET_TIME, |
| 535 | EVTIMER_HI_MASK, EVTIMER_HI_SHIFT, LOW_32_BIT_MASK, | 535 | EVTIMER_HI_MASK, EVTIMER_HI_SHIFT, LOW_32_BIT_MASK, |
| 536 | }; | 536 | }; |
| 537 | use crate::pac; | 537 | use crate::{clocks::{enable_and_reset, periph_helpers::{OsTimerConfig, OstimerClockSel}, PoweredClock}, pac, peripherals::OSTIMER0}; |
| 538 | pub struct Driver; | 538 | pub struct Driver; |
| 539 | static TIMER_WAKER: AtomicWaker = AtomicWaker::new(); | 539 | static TIMER_WAKER: AtomicWaker = AtomicWaker::new(); |
| 540 | 540 | ||
| @@ -621,6 +621,14 @@ pub mod time_driver { | |||
| 621 | /// Note: The frequency parameter is currently accepted for API compatibility. | 621 | /// Note: The frequency parameter is currently accepted for API compatibility. |
| 622 | /// The embassy_time_driver macro handles driver registration automatically. | 622 | /// The embassy_time_driver macro handles driver registration automatically. |
| 623 | pub fn init(priority: crate::interrupt::Priority, frequency_hz: u64) { | 623 | pub fn init(priority: crate::interrupt::Priority, frequency_hz: u64) { |
| 624 | let _clock_freq = unsafe { | ||
| 625 | enable_and_reset::<OSTIMER0>(&OsTimerConfig { | ||
| 626 | power: PoweredClock::AlwaysEnabled, | ||
| 627 | source: OstimerClockSel::Clk1M, | ||
| 628 | }) | ||
| 629 | .expect("Enabling OsTimer clock should not fail") | ||
| 630 | }; | ||
| 631 | |||
| 624 | // Mask/clear at peripheral and set default MATCH | 632 | // Mask/clear at peripheral and set default MATCH |
| 625 | let r: &Regs = unsafe { &*pac::Ostimer0::ptr() }; | 633 | let r: &Regs = unsafe { &*pac::Ostimer0::ptr() }; |
| 626 | super::prime_match_registers(r); | 634 | super::prime_match_registers(r); |
