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 /examples/stm32g0 | |
| parent | 7559f9e5834799b041d899767ef4305dcfdf0181 (diff) | |
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'examples/stm32g0')
| -rw-r--r-- | examples/stm32g0/src/bin/blinky.rs | 6 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/spi_neopixel.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/stm32g0/src/bin/blinky.rs b/examples/stm32g0/src/bin/blinky.rs index b27bee4ce..4bfc5a50d 100644 --- a/examples/stm32g0/src/bin/blinky.rs +++ b/examples/stm32g0/src/bin/blinky.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 7 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_time::{Duration, Timer}; | 8 | use embassy_time::Timer; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | #[embassy_executor::main] | 11 | #[embassy_executor::main] |
| @@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) { | |||
| 18 | loop { | 18 | loop { |
| 19 | info!("high"); | 19 | info!("high"); |
| 20 | led.set_high(); | 20 | led.set_high(); |
| 21 | Timer::after(Duration::from_millis(300)).await; | 21 | Timer::after_millis(300).await; |
| 22 | 22 | ||
| 23 | info!("low"); | 23 | info!("low"); |
| 24 | led.set_low(); | 24 | led.set_low(); |
| 25 | Timer::after(Duration::from_millis(300)).await; | 25 | Timer::after_millis(300).await; |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
diff --git a/examples/stm32g0/src/bin/spi_neopixel.rs b/examples/stm32g0/src/bin/spi_neopixel.rs index ee7aaf33f..214462d0e 100644 --- a/examples/stm32g0/src/bin/spi_neopixel.rs +++ b/examples/stm32g0/src/bin/spi_neopixel.rs | |||
| @@ -8,7 +8,7 @@ use embassy_stm32::dma::word::U5; | |||
| 8 | use embassy_stm32::dma::NoDma; | 8 | use embassy_stm32::dma::NoDma; |
| 9 | use embassy_stm32::spi::{Config, Spi}; | 9 | use embassy_stm32::spi::{Config, Spi}; |
| 10 | use embassy_stm32::time::Hertz; | 10 | use embassy_stm32::time::Hertz; |
| 11 | use embassy_time::{Duration, Timer}; | 11 | use embassy_time::Timer; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 13 | ||
| 14 | const NR_PIXELS: usize = 15; | 14 | const NR_PIXELS: usize = 15; |
| @@ -96,8 +96,8 @@ async fn main(_spawner: Spawner) { | |||
| 96 | cnt += 1; | 96 | cnt += 1; |
| 97 | // start sending the neopixel bit patters over spi to the neopixel string | 97 | // start sending the neopixel bit patters over spi to the neopixel string |
| 98 | spi.write(&neopixels.bitbuffer).await.ok(); | 98 | spi.write(&neopixels.bitbuffer).await.ok(); |
| 99 | Timer::after(Duration::from_millis(500)).await; | 99 | Timer::after_millis(500).await; |
| 100 | } | 100 | } |
| 101 | Timer::after(Duration::from_millis(1000)).await; | 101 | Timer::after_millis(1000).await; |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
