diff options
| author | Adam Greig <[email protected]> | 2023-10-15 00:57:25 +0100 |
|---|---|---|
| committer | Adam Greig <[email protected]> | 2023-10-15 01:30:12 +0100 |
| commit | 0621e957a0ddc7010d46b3ea3ddc8b9852bc8333 (patch) | |
| tree | f6caefe939109e55a73e9141c736d2f6c20f51e8 /tests/stm32/src/bin/dac.rs | |
| parent | 7559f9e5834799b041d899767ef4305dcfdf0181 (diff) | |
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'tests/stm32/src/bin/dac.rs')
| -rw-r--r-- | tests/stm32/src/bin/dac.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/stm32/src/bin/dac.rs b/tests/stm32/src/bin/dac.rs index fb7a84b1b..10e3c3e81 100644 --- a/tests/stm32/src/bin/dac.rs +++ b/tests/stm32/src/bin/dac.rs | |||
| @@ -12,7 +12,7 @@ use embassy_executor::Spawner; | |||
| 12 | use embassy_stm32::adc::Adc; | 12 | use embassy_stm32::adc::Adc; |
| 13 | use embassy_stm32::dac::{DacCh1, DacChannel, Value}; | 13 | use embassy_stm32::dac::{DacCh1, DacChannel, Value}; |
| 14 | use embassy_stm32::dma::NoDma; | 14 | use embassy_stm32::dma::NoDma; |
| 15 | use embassy_time::{Delay, Duration, Timer}; | 15 | use embassy_time::{Delay, Timer}; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
| @@ -38,7 +38,7 @@ async fn main(_spawner: Spawner) { | |||
| 38 | 38 | ||
| 39 | unwrap!(dac.set(Value::Bit8(0))); | 39 | unwrap!(dac.set(Value::Bit8(0))); |
| 40 | // Now wait a little to obtain a stable value | 40 | // Now wait a little to obtain a stable value |
| 41 | Timer::after(Duration::from_millis(30)).await; | 41 | Timer::after_millis(30).await; |
| 42 | let offset = adc.read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4); | 42 | let offset = adc.read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4); |
| 43 | 43 | ||
| 44 | for v in 0..=255 { | 44 | for v in 0..=255 { |
| @@ -47,7 +47,7 @@ async fn main(_spawner: Spawner) { | |||
| 47 | unwrap!(dac.set(Value::Bit8(dac_output_val))); | 47 | unwrap!(dac.set(Value::Bit8(dac_output_val))); |
| 48 | 48 | ||
| 49 | // Now wait a little to obtain a stable value | 49 | // Now wait a little to obtain a stable value |
| 50 | Timer::after(Duration::from_millis(30)).await; | 50 | Timer::after_millis(30).await; |
| 51 | 51 | ||
| 52 | // Need to steal the peripherals here because PA4 is obviously in use already | 52 | // Need to steal the peripherals here because PA4 is obviously in use already |
| 53 | let measured = adc.read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4); | 53 | let measured = adc.read(&mut unsafe { embassy_stm32::Peripherals::steal() }.PA4); |
