diff options
| author | Dominik Boehi <[email protected]> | 2023-01-09 22:57:40 +0100 |
|---|---|---|
| committer | Dominik Boehi <[email protected]> | 2023-01-09 22:57:40 +0100 |
| commit | 2baebabf4dd2abecfd08ca078ecf59060d5ad585 (patch) | |
| tree | 0ad516d336522f531514ac300e9c0adac1371250 /examples/nrf5340/src/bin/awaitable_timer.rs | |
| parent | 0a27b6cedb52453123190671f294bbd34918e09a (diff) | |
Reduce amount of samples for nrf5340
Diffstat (limited to 'examples/nrf5340/src/bin/awaitable_timer.rs')
| -rw-r--r-- | examples/nrf5340/src/bin/awaitable_timer.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/examples/nrf5340/src/bin/awaitable_timer.rs b/examples/nrf5340/src/bin/awaitable_timer.rs deleted file mode 100644 index b32af236c..000000000 --- a/examples/nrf5340/src/bin/awaitable_timer.rs +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::info; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_nrf::interrupt; | ||
| 8 | use embassy_nrf::timer::Timer; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) { | ||
| 13 | let p = embassy_nrf::init(Default::default()); | ||
| 14 | let mut t = Timer::new_awaitable(p.TIMER0, interrupt::take!(TIMER0)); | ||
| 15 | // default frequency is 1MHz, so this triggers every second | ||
| 16 | t.cc(0).write(1_000_000); | ||
| 17 | // clear the timer value on cc[0] compare match | ||
| 18 | t.cc(0).short_compare_clear(); | ||
| 19 | t.start(); | ||
| 20 | |||
| 21 | loop { | ||
| 22 | // wait for compare match | ||
| 23 | t.cc(0).wait().await; | ||
| 24 | info!("hardware timer tick"); | ||
| 25 | } | ||
| 26 | } | ||
