diff options
| author | liebman <[email protected]> | 2025-12-13 10:01:57 -0800 |
|---|---|---|
| committer | liebman <[email protected]> | 2025-12-13 10:01:57 -0800 |
| commit | 67a67c7d3cd9a5e2b917b108bfdebc858a2f79a3 (patch) | |
| tree | fe24d4fdd9804cecf1e0a99e88d66b629f029a5b /examples/stm32wle5/src/bin/blinky.rs | |
| parent | 803b809e5dbe7651b7171917e02289b067e90dad (diff) | |
stm32: update stm32wle5 low powe examples
Diffstat (limited to 'examples/stm32wle5/src/bin/blinky.rs')
| -rw-r--r-- | examples/stm32wle5/src/bin/blinky.rs | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/examples/stm32wle5/src/bin/blinky.rs b/examples/stm32wle5/src/bin/blinky.rs index 9f0c04672..3b7eb7761 100644 --- a/examples/stm32wle5/src/bin/blinky.rs +++ b/examples/stm32wle5/src/bin/blinky.rs | |||
| @@ -32,24 +32,6 @@ async fn async_main(_spawner: Spawner) { | |||
| 32 | // Initialize STM32WL peripherals (use default config like wio-e5-async example) | 32 | // Initialize STM32WL peripherals (use default config like wio-e5-async example) |
| 33 | let p = embassy_stm32::init(config); | 33 | let p = embassy_stm32::init(config); |
| 34 | 34 | ||
| 35 | // start with all GPIOs as analog to reduce power consumption | ||
| 36 | for r in [ | ||
| 37 | embassy_stm32::pac::GPIOA, | ||
| 38 | embassy_stm32::pac::GPIOB, | ||
| 39 | embassy_stm32::pac::GPIOC, | ||
| 40 | embassy_stm32::pac::GPIOH, | ||
| 41 | ] { | ||
| 42 | r.moder().modify(|w| { | ||
| 43 | for i in 0..16 { | ||
| 44 | // don't reset these if probe-rs should stay connected! | ||
| 45 | #[cfg(feature = "defmt-rtt")] | ||
| 46 | if config.enable_debug_during_sleep && r == embassy_stm32::pac::GPIOA && [13, 14].contains(&i) { | ||
| 47 | continue; | ||
| 48 | } | ||
| 49 | w.set_moder(i, embassy_stm32::pac::gpio::vals::Moder::ANALOG); | ||
| 50 | } | ||
| 51 | }); | ||
| 52 | } | ||
| 53 | #[cfg(feature = "defmt-serial")] | 35 | #[cfg(feature = "defmt-serial")] |
| 54 | { | 36 | { |
| 55 | use embassy_stm32::mode::Blocking; | 37 | use embassy_stm32::mode::Blocking; |
| @@ -67,10 +49,10 @@ async fn async_main(_spawner: Spawner) { | |||
| 67 | loop { | 49 | loop { |
| 68 | info!("low"); | 50 | info!("low"); |
| 69 | led.set_low(); | 51 | led.set_low(); |
| 70 | Timer::after_millis(500).await; | 52 | Timer::after_millis(15000).await; |
| 71 | 53 | ||
| 72 | info!("high"); | 54 | info!("high"); |
| 73 | led.set_high(); | 55 | led.set_high(); |
| 74 | Timer::after_millis(500).await; | 56 | Timer::after_millis(15000).await; |
| 75 | } | 57 | } |
| 76 | } | 58 | } |
