aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-11-04 20:55:18 +0000
committerGitHub <[email protected]>2025-11-04 20:55:18 +0000
commitd23c027dd1a1c5f7cdf818750dddf6a250658423 (patch)
tree5b81e8e0ca18d95d9852e986fe67f33db17de559 /examples
parentda4af0a7ae67d8ec592edf5eff9bbaed2d9e439a (diff)
parenta6412c923280082c506c75e6428e7d87870580eb (diff)
Merge pull request #4838 from embassy-rs/lp2
stm32/low-power: cleanup and improve
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32h5/src/bin/stop.rs5
-rw-r--r--examples/stm32l5/src/bin/stop.rs5
-rw-r--r--examples/stm32wle5/src/bin/adc.rs6
-rw-r--r--examples/stm32wle5/src/bin/blinky.rs6
-rw-r--r--examples/stm32wle5/src/bin/button_exti.rs6
-rw-r--r--examples/stm32wle5/src/bin/i2c.rs6
6 files changed, 0 insertions, 34 deletions
diff --git a/examples/stm32h5/src/bin/stop.rs b/examples/stm32h5/src/bin/stop.rs
index 2026d8f99..caebc9daf 100644
--- a/examples/stm32h5/src/bin/stop.rs
+++ b/examples/stm32h5/src/bin/stop.rs
@@ -9,7 +9,6 @@ use embassy_executor::Spawner;
9use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; 9use embassy_stm32::gpio::{AnyPin, Level, Output, Speed};
10use embassy_stm32::low_power::Executor; 10use embassy_stm32::low_power::Executor;
11use embassy_stm32::rcc::{HSIPrescaler, LsConfig}; 11use embassy_stm32::rcc::{HSIPrescaler, LsConfig};
12use embassy_stm32::rtc::{Rtc, RtcConfig};
13use embassy_stm32::{Config, Peri}; 12use embassy_stm32::{Config, Peri};
14use embassy_time::Timer; 13use embassy_time::Timer;
15use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
@@ -36,10 +35,6 @@ async fn async_main(spawner: Spawner) {
36 // config.enable_debug_during_sleep = false; 35 // config.enable_debug_during_sleep = false;
37 let p = embassy_stm32::init(config); 36 let p = embassy_stm32::init(config);
38 37
39 // give the RTC to the executor...
40 let rtc = Rtc::new(p.RTC, RtcConfig::default());
41 embassy_stm32::low_power::stop_with_rtc(rtc);
42
43 spawner.spawn(unwrap!(blinky(p.PB4.into()))); 38 spawner.spawn(unwrap!(blinky(p.PB4.into())));
44 spawner.spawn(unwrap!(timeout())); 39 spawner.spawn(unwrap!(timeout()));
45} 40}
diff --git a/examples/stm32l5/src/bin/stop.rs b/examples/stm32l5/src/bin/stop.rs
index 7662dbfa8..3d119f90f 100644
--- a/examples/stm32l5/src/bin/stop.rs
+++ b/examples/stm32l5/src/bin/stop.rs
@@ -6,7 +6,6 @@ use embassy_executor::Spawner;
6use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; 6use embassy_stm32::gpio::{AnyPin, Level, Output, Speed};
7use embassy_stm32::low_power::Executor; 7use embassy_stm32::low_power::Executor;
8use embassy_stm32::rcc::LsConfig; 8use embassy_stm32::rcc::LsConfig;
9use embassy_stm32::rtc::{Rtc, RtcConfig};
10use embassy_stm32::{Config, Peri}; 9use embassy_stm32::{Config, Peri};
11use embassy_time::Timer; 10use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
@@ -27,10 +26,6 @@ async fn async_main(spawner: Spawner) {
27 // config.enable_debug_during_sleep = false; 26 // config.enable_debug_during_sleep = false;
28 let p = embassy_stm32::init(config); 27 let p = embassy_stm32::init(config);
29 28
30 // give the RTC to the executor...
31 let rtc = Rtc::new(p.RTC, RtcConfig::default());
32 embassy_stm32::low_power::stop_with_rtc(rtc);
33
34 spawner.spawn(unwrap!(blinky(p.PC7.into()))); 29 spawner.spawn(unwrap!(blinky(p.PC7.into())));
35 spawner.spawn(unwrap!(timeout())); 30 spawner.spawn(unwrap!(timeout()));
36} 31}
diff --git a/examples/stm32wle5/src/bin/adc.rs b/examples/stm32wle5/src/bin/adc.rs
index ff1a5fa16..8b830a1e6 100644
--- a/examples/stm32wle5/src/bin/adc.rs
+++ b/examples/stm32wle5/src/bin/adc.rs
@@ -7,7 +7,6 @@ use defmt_rtt as _;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::adc::{Adc, SampleTime}; 8use embassy_stm32::adc::{Adc, SampleTime};
9use embassy_stm32::low_power::Executor; 9use embassy_stm32::low_power::Executor;
10use embassy_stm32::rtc::{Rtc, RtcConfig};
11use embassy_time::Timer; 10use embassy_time::Timer;
12use panic_probe as _; 11use panic_probe as _;
13use static_cell::StaticCell; 12use static_cell::StaticCell;
@@ -71,11 +70,6 @@ async fn async_main(_spawner: Spawner) {
71 defmt_serial::defmt_serial(SERIAL.init(uart)); 70 defmt_serial::defmt_serial(SERIAL.init(uart));
72 } 71 }
73 72
74 // give the RTC to the low_power executor...
75 let rtc_config = RtcConfig::default();
76 let rtc = Rtc::new(p.RTC, rtc_config);
77 embassy_stm32::low_power::stop_with_rtc(rtc);
78
79 info!("Hello World!"); 73 info!("Hello World!");
80 74
81 let mut adc = Adc::new(p.ADC1); 75 let mut adc = Adc::new(p.ADC1);
diff --git a/examples/stm32wle5/src/bin/blinky.rs b/examples/stm32wle5/src/bin/blinky.rs
index 1191a1157..b2745fdaf 100644
--- a/examples/stm32wle5/src/bin/blinky.rs
+++ b/examples/stm32wle5/src/bin/blinky.rs
@@ -7,7 +7,6 @@ use defmt_rtt as _;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::gpio::{Level, Output, Speed}; 8use embassy_stm32::gpio::{Level, Output, Speed};
9use embassy_stm32::low_power::Executor; 9use embassy_stm32::low_power::Executor;
10use embassy_stm32::rtc::{Rtc, RtcConfig};
11use embassy_time::Timer; 10use embassy_time::Timer;
12use panic_probe as _; 11use panic_probe as _;
13use static_cell::StaticCell; 12use static_cell::StaticCell;
@@ -69,11 +68,6 @@ async fn async_main(_spawner: Spawner) {
69 defmt_serial::defmt_serial(SERIAL.init(uart)); 68 defmt_serial::defmt_serial(SERIAL.init(uart));
70 } 69 }
71 70
72 // give the RTC to the low_power executor...
73 let rtc_config = RtcConfig::default();
74 let rtc = Rtc::new(p.RTC, rtc_config);
75 embassy_stm32::low_power::stop_with_rtc(rtc);
76
77 info!("Hello World!"); 71 info!("Hello World!");
78 72
79 let mut led = Output::new(p.PB5, Level::High, Speed::Low); 73 let mut led = Output::new(p.PB5, Level::High, Speed::Low);
diff --git a/examples/stm32wle5/src/bin/button_exti.rs b/examples/stm32wle5/src/bin/button_exti.rs
index f07f9724d..db1bff0be 100644
--- a/examples/stm32wle5/src/bin/button_exti.rs
+++ b/examples/stm32wle5/src/bin/button_exti.rs
@@ -8,7 +8,6 @@ use embassy_executor::Spawner;
8use embassy_stm32::exti::ExtiInput; 8use embassy_stm32::exti::ExtiInput;
9use embassy_stm32::gpio::Pull; 9use embassy_stm32::gpio::Pull;
10use embassy_stm32::low_power::Executor; 10use embassy_stm32::low_power::Executor;
11use embassy_stm32::rtc::{Rtc, RtcConfig};
12use panic_probe as _; 11use panic_probe as _;
13use static_cell::StaticCell; 12use static_cell::StaticCell;
14 13
@@ -71,11 +70,6 @@ async fn async_main(_spawner: Spawner) {
71 defmt_serial::defmt_serial(SERIAL.init(uart)); 70 defmt_serial::defmt_serial(SERIAL.init(uart));
72 } 71 }
73 72
74 // give the RTC to the low_power executor...
75 let rtc_config = RtcConfig::default();
76 let rtc = Rtc::new(p.RTC, rtc_config);
77 embassy_stm32::low_power::stop_with_rtc(rtc);
78
79 info!("Hello World!"); 73 info!("Hello World!");
80 74
81 let mut button = ExtiInput::new(p.PA0, p.EXTI0, Pull::Up); 75 let mut button = ExtiInput::new(p.PA0, p.EXTI0, Pull::Up);
diff --git a/examples/stm32wle5/src/bin/i2c.rs b/examples/stm32wle5/src/bin/i2c.rs
index af07f911e..c31c673c9 100644
--- a/examples/stm32wle5/src/bin/i2c.rs
+++ b/examples/stm32wle5/src/bin/i2c.rs
@@ -7,7 +7,6 @@ use defmt_rtt as _;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_stm32::i2c::I2c; 8use embassy_stm32::i2c::I2c;
9use embassy_stm32::low_power::Executor; 9use embassy_stm32::low_power::Executor;
10use embassy_stm32::rtc::{Rtc, RtcConfig};
11use embassy_stm32::time::Hertz; 10use embassy_stm32::time::Hertz;
12use embassy_stm32::{bind_interrupts, i2c, peripherals}; 11use embassy_stm32::{bind_interrupts, i2c, peripherals};
13use embassy_time::{Duration, Timer}; 12use embassy_time::{Duration, Timer};
@@ -78,11 +77,6 @@ async fn async_main(_spawner: Spawner) {
78 defmt_serial::defmt_serial(SERIAL.init(uart)); 77 defmt_serial::defmt_serial(SERIAL.init(uart));
79 } 78 }
80 79
81 // give the RTC to the low_power executor...
82 let rtc_config = RtcConfig::default();
83 let rtc = Rtc::new(p.RTC, rtc_config);
84 embassy_stm32::low_power::stop_with_rtc(rtc);
85
86 info!("Hello World!"); 80 info!("Hello World!");
87 let en3v3 = embassy_stm32::gpio::Output::new( 81 let en3v3 = embassy_stm32::gpio::Output::new(
88 p.PA9, 82 p.PA9,