Skip to content

Commit

Permalink
Provides an HFCLK timer driver
Browse files Browse the repository at this point in the history
The existing (default) timer driver for nRF implements one using the RTC, which uses the LFCLK. An additional feature has been provided where the HFCLK can be used for the timer driver by using TIMER1. An STM example has also been ported so that either driver implementation can be exercised.

To use the HFCLK driver, simply use the `time-driver-timer1` feature in place of the `time-driver-rtc1` one when depending on embassy-nrf.
  • Loading branch information
huntc committed Feb 19, 2022
1 parent 59f909e commit a5f7801
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 156 deletions.
1 change: 1 addition & 0 deletions embassy-nrf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ nrf9160-ns = ["_nrf9160"]

gpiote = []
time-driver-rtc1 = ["_time-driver"]
time-driver-timer1 = ["_time-driver"]

# Features starting with `_` are for internal use only. They're not intended
# to be enabled by other crates, and are not covered by semver guarantees.
Expand Down
2 changes: 1 addition & 1 deletion embassy-nrf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub fn init(config: config::Config) -> Peripherals {

// init RTC time driver
#[cfg(feature = "_time-driver")]
time_driver::init(config.time_interrupt_priority);
time_driver::driver_impl::init(config.time_interrupt_priority);

peripherals
}
Loading

0 comments on commit a5f7801

Please sign in to comment.