aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h7/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32h7/src')
-rw-r--r--examples/stm32h7/src/bin/adc.rs4
-rw-r--r--examples/stm32h7/src/bin/blinky.rs6
-rw-r--r--examples/stm32h7/src/bin/camera.rs12
-rw-r--r--examples/stm32h7/src/bin/eth.rs6
-rw-r--r--examples/stm32h7/src/bin/eth_client.rs6
-rw-r--r--examples/stm32h7/src/bin/flash.rs4
-rw-r--r--examples/stm32h7/src/bin/fmc.rs4
-rw-r--r--examples/stm32h7/src/bin/low_level_timer_api.rs10
-rw-r--r--examples/stm32h7/src/bin/mco.rs6
-rw-r--r--examples/stm32h7/src/bin/pwm.rs10
-rw-r--r--examples/stm32h7/src/bin/rtc.rs4
-rw-r--r--examples/stm32h7/src/bin/signal.rs4
-rw-r--r--examples/stm32h7/src/bin/wdg.rs4
13 files changed, 40 insertions, 40 deletions
diff --git a/examples/stm32h7/src/bin/adc.rs b/examples/stm32h7/src/bin/adc.rs
index 7859b86db..4a358a35f 100644
--- a/examples/stm32h7/src/bin/adc.rs
+++ b/examples/stm32h7/src/bin/adc.rs
@@ -6,7 +6,7 @@ use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::adc::{Adc, SampleTime}; 7use embassy_stm32::adc::{Adc, SampleTime};
8use embassy_stm32::Config; 8use embassy_stm32::Config;
9use embassy_time::{Delay, Duration, Timer}; 9use embassy_time::{Delay, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
@@ -55,6 +55,6 @@ async fn main(_spawner: Spawner) {
55 info!("vrefint: {}", vrefint); 55 info!("vrefint: {}", vrefint);
56 let measured = adc.read(&mut p.PC0); 56 let measured = adc.read(&mut p.PC0);
57 info!("measured: {}", measured); 57 info!("measured: {}", measured);
58 Timer::after(Duration::from_millis(500)).await; 58 Timer::after_millis(500).await;
59 } 59 }
60} 60}
diff --git a/examples/stm32h7/src/bin/blinky.rs b/examples/stm32h7/src/bin/blinky.rs
index 12f08c0fd..a9cab1ff4 100644
--- a/examples/stm32h7/src/bin/blinky.rs
+++ b/examples/stm32h7/src/bin/blinky.rs
@@ -5,7 +5,7 @@
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_time::{Duration, Timer}; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {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(500)).await; 21 Timer::after_millis(500).await;
22 22
23 info!("low"); 23 info!("low");
24 led.set_low(); 24 led.set_low();
25 Timer::after(Duration::from_millis(500)).await; 25 Timer::after_millis(500).await;
26 } 26 }
27} 27}
diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs
index 40ef16cfc..8195430b2 100644
--- a/examples/stm32h7/src/bin/camera.rs
+++ b/examples/stm32h7/src/bin/camera.rs
@@ -9,7 +9,7 @@ use embassy_stm32::i2c::I2c;
9use embassy_stm32::rcc::{Mco, Mco1Source, McoPrescaler}; 9use embassy_stm32::rcc::{Mco, Mco1Source, McoPrescaler};
10use embassy_stm32::time::khz; 10use embassy_stm32::time::khz;
11use embassy_stm32::{bind_interrupts, i2c, peripherals, Config}; 11use embassy_stm32::{bind_interrupts, i2c, peripherals, Config};
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use ov7725::*; 13use ov7725::*;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
@@ -86,11 +86,11 @@ async fn main(_spawner: Spawner) {
86 loop { 86 loop {
87 defmt::info!("high"); 87 defmt::info!("high");
88 led.set_high(); 88 led.set_high();
89 Timer::after(Duration::from_millis(500)).await; 89 Timer::after_millis(500).await;
90 90
91 defmt::info!("low"); 91 defmt::info!("low");
92 led.set_low(); 92 led.set_low();
93 Timer::after(Duration::from_millis(500)).await; 93 Timer::after_millis(500).await;
94 } 94 }
95} 95}
96 96
@@ -99,7 +99,7 @@ mod ov7725 {
99 99
100 use defmt::Format; 100 use defmt::Format;
101 use embassy_stm32::rcc::{Mco, McoInstance}; 101 use embassy_stm32::rcc::{Mco, McoInstance};
102 use embassy_time::{Duration, Timer}; 102 use embassy_time::Timer;
103 use embedded_hal_async::i2c::I2c; 103 use embedded_hal_async::i2c::I2c;
104 104
105 #[repr(u8)] 105 #[repr(u8)]
@@ -210,9 +210,9 @@ mod ov7725 {
210 } 210 }
211 211
212 pub async fn init(&mut self) -> Result<(), Error<Bus::Error>> { 212 pub async fn init(&mut self) -> Result<(), Error<Bus::Error>> {
213 Timer::after(Duration::from_millis(500)).await; 213 Timer::after_millis(500).await;
214 self.reset_regs().await?; 214 self.reset_regs().await?;
215 Timer::after(Duration::from_millis(500)).await; 215 Timer::after_millis(500).await;
216 self.set_pixformat().await?; 216 self.set_pixformat().await?;
217 self.set_resolution().await?; 217 self.set_resolution().await?;
218 Ok(()) 218 Ok(())
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs
index 6fbf43442..81d9c7347 100644
--- a/examples/stm32h7/src/bin/eth.rs
+++ b/examples/stm32h7/src/bin/eth.rs
@@ -11,7 +11,7 @@ use embassy_stm32::eth::{Ethernet, PacketQueue};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
14use embassy_time::{Duration, Timer}; 14use embassy_time::Timer;
15use embedded_io_async::Write; 15use embedded_io_async::Write;
16use rand_core::RngCore; 16use rand_core::RngCore;
17use static_cell::make_static; 17use static_cell::make_static;
@@ -118,7 +118,7 @@ async fn main(spawner: Spawner) -> ! {
118 let r = socket.connect(remote_endpoint).await; 118 let r = socket.connect(remote_endpoint).await;
119 if let Err(e) = r { 119 if let Err(e) = r {
120 info!("connect error: {:?}", e); 120 info!("connect error: {:?}", e);
121 Timer::after(Duration::from_secs(1)).await; 121 Timer::after_secs(1).await;
122 continue; 122 continue;
123 } 123 }
124 info!("connected!"); 124 info!("connected!");
@@ -128,7 +128,7 @@ async fn main(spawner: Spawner) -> ! {
128 info!("write error: {:?}", e); 128 info!("write error: {:?}", e);
129 break; 129 break;
130 } 130 }
131 Timer::after(Duration::from_secs(1)).await; 131 Timer::after_secs(1).await;
132 } 132 }
133 } 133 }
134} 134}
diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs
index 09d27cdbd..338137069 100644
--- a/examples/stm32h7/src/bin/eth_client.rs
+++ b/examples/stm32h7/src/bin/eth_client.rs
@@ -11,7 +11,7 @@ use embassy_stm32::eth::{Ethernet, PacketQueue};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; 13use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
14use embassy_time::{Duration, Timer}; 14use embassy_time::Timer;
15use embedded_io_async::Write; 15use embedded_io_async::Write;
16use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect}; 16use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect};
17use rand_core::RngCore; 17use rand_core::RngCore;
@@ -115,7 +115,7 @@ async fn main(spawner: Spawner) -> ! {
115 let r = client.connect(addr).await; 115 let r = client.connect(addr).await;
116 if let Err(e) = r { 116 if let Err(e) = r {
117 info!("connect error: {:?}", e); 117 info!("connect error: {:?}", e);
118 Timer::after(Duration::from_secs(1)).await; 118 Timer::after_secs(1).await;
119 continue; 119 continue;
120 } 120 }
121 let mut connection = r.unwrap(); 121 let mut connection = r.unwrap();
@@ -126,7 +126,7 @@ async fn main(spawner: Spawner) -> ! {
126 info!("write error: {:?}", e); 126 info!("write error: {:?}", e);
127 break; 127 break;
128 } 128 }
129 Timer::after(Duration::from_secs(1)).await; 129 Timer::after_secs(1).await;
130 } 130 }
131 } 131 }
132} 132}
diff --git a/examples/stm32h7/src/bin/flash.rs b/examples/stm32h7/src/bin/flash.rs
index f66df770b..89c0c8a66 100644
--- a/examples/stm32h7/src/bin/flash.rs
+++ b/examples/stm32h7/src/bin/flash.rs
@@ -5,7 +5,7 @@
5use defmt::{info, unwrap}; 5use defmt::{info, unwrap};
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::flash::Flash; 7use embassy_stm32::flash::Flash;
8use embassy_time::{Duration, Timer}; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[embassy_executor::main] 11#[embassy_executor::main]
@@ -16,7 +16,7 @@ async fn main(_spawner: Spawner) {
16 const ADDR: u32 = 0; // This is the offset into bank 2, the absolute address is 0x8_0000 16 const ADDR: u32 = 0; // This is the offset into bank 2, the absolute address is 0x8_0000
17 17
18 // wait a bit before accessing the flash 18 // wait a bit before accessing the flash
19 Timer::after(Duration::from_millis(300)).await; 19 Timer::after_millis(300).await;
20 20
21 let mut f = Flash::new_blocking(p.FLASH).into_blocking_regions().bank2_region; 21 let mut f = Flash::new_blocking(p.FLASH).into_blocking_regions().bank2_region;
22 22
diff --git a/examples/stm32h7/src/bin/fmc.rs b/examples/stm32h7/src/bin/fmc.rs
index 7ae87b02c..cffd47093 100644
--- a/examples/stm32h7/src/bin/fmc.rs
+++ b/examples/stm32h7/src/bin/fmc.rs
@@ -6,7 +6,7 @@ use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::fmc::Fmc; 7use embassy_stm32::fmc::Fmc;
8use embassy_stm32::Config; 8use embassy_stm32::Config;
9use embassy_time::{Delay, Duration, Timer}; 9use embassy_time::{Delay, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
@@ -212,6 +212,6 @@ async fn main(_spawner: Spawner) {
212 info!("Assertions succeeded."); 212 info!("Assertions succeeded.");
213 213
214 loop { 214 loop {
215 Timer::after(Duration::from_millis(1000)).await; 215 Timer::after_millis(1000).await;
216 } 216 }
217} 217}
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs
index 5841efb24..0355ac073 100644
--- a/examples/stm32h7/src/bin/low_level_timer_api.rs
+++ b/examples/stm32h7/src/bin/low_level_timer_api.rs
@@ -9,7 +9,7 @@ use embassy_stm32::gpio::Speed;
9use embassy_stm32::time::{khz, Hertz}; 9use embassy_stm32::time::{khz, Hertz};
10use embassy_stm32::timer::*; 10use embassy_stm32::timer::*;
11use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef}; 11use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef};
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15#[embassy_executor::main] 15#[embassy_executor::main]
@@ -49,13 +49,13 @@ async fn main(_spawner: Spawner) {
49 49
50 loop { 50 loop {
51 pwm.set_duty(Channel::Ch1, 0); 51 pwm.set_duty(Channel::Ch1, 0);
52 Timer::after(Duration::from_millis(300)).await; 52 Timer::after_millis(300).await;
53 pwm.set_duty(Channel::Ch1, max / 4); 53 pwm.set_duty(Channel::Ch1, max / 4);
54 Timer::after(Duration::from_millis(300)).await; 54 Timer::after_millis(300).await;
55 pwm.set_duty(Channel::Ch1, max / 2); 55 pwm.set_duty(Channel::Ch1, max / 2);
56 Timer::after(Duration::from_millis(300)).await; 56 Timer::after_millis(300).await;
57 pwm.set_duty(Channel::Ch1, max - 1); 57 pwm.set_duty(Channel::Ch1, max - 1);
58 Timer::after(Duration::from_millis(300)).await; 58 Timer::after_millis(300).await;
59 } 59 }
60} 60}
61pub struct SimplePwm32<'d, T: CaptureCompare32bitInstance> { 61pub struct SimplePwm32<'d, T: CaptureCompare32bitInstance> {
diff --git a/examples/stm32h7/src/bin/mco.rs b/examples/stm32h7/src/bin/mco.rs
index de89aee2f..c023f4584 100644
--- a/examples/stm32h7/src/bin/mco.rs
+++ b/examples/stm32h7/src/bin/mco.rs
@@ -6,7 +6,7 @@ use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::gpio::{Level, Output, Speed}; 7use embassy_stm32::gpio::{Level, Output, Speed};
8use embassy_stm32::rcc::{Mco, Mco1Source, McoPrescaler}; 8use embassy_stm32::rcc::{Mco, Mco1Source, McoPrescaler};
9use embassy_time::{Duration, Timer}; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
@@ -21,10 +21,10 @@ async fn main(_spawner: Spawner) {
21 loop { 21 loop {
22 info!("high"); 22 info!("high");
23 led.set_high(); 23 led.set_high();
24 Timer::after(Duration::from_millis(500)).await; 24 Timer::after_millis(500).await;
25 25
26 info!("low"); 26 info!("low");
27 led.set_low(); 27 led.set_low();
28 Timer::after(Duration::from_millis(500)).await; 28 Timer::after_millis(500).await;
29 } 29 }
30} 30}
diff --git a/examples/stm32h7/src/bin/pwm.rs b/examples/stm32h7/src/bin/pwm.rs
index 37e4c92cc..3bf373c7e 100644
--- a/examples/stm32h7/src/bin/pwm.rs
+++ b/examples/stm32h7/src/bin/pwm.rs
@@ -9,7 +9,7 @@ use embassy_stm32::time::khz;
9use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm}; 9use embassy_stm32::timer::simple_pwm::{PwmPin, SimplePwm};
10use embassy_stm32::timer::Channel; 10use embassy_stm32::timer::Channel;
11use embassy_stm32::Config; 11use embassy_stm32::Config;
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15#[embassy_executor::main] 15#[embassy_executor::main]
@@ -48,12 +48,12 @@ async fn main(_spawner: Spawner) {
48 48
49 loop { 49 loop {
50 pwm.set_duty(Channel::Ch1, 0); 50 pwm.set_duty(Channel::Ch1, 0);
51 Timer::after(Duration::from_millis(300)).await; 51 Timer::after_millis(300).await;
52 pwm.set_duty(Channel::Ch1, max / 4); 52 pwm.set_duty(Channel::Ch1, max / 4);
53 Timer::after(Duration::from_millis(300)).await; 53 Timer::after_millis(300).await;
54 pwm.set_duty(Channel::Ch1, max / 2); 54 pwm.set_duty(Channel::Ch1, max / 2);
55 Timer::after(Duration::from_millis(300)).await; 55 Timer::after_millis(300).await;
56 pwm.set_duty(Channel::Ch1, max - 1); 56 pwm.set_duty(Channel::Ch1, max - 1);
57 Timer::after(Duration::from_millis(300)).await; 57 Timer::after_millis(300).await;
58 } 58 }
59} 59}
diff --git a/examples/stm32h7/src/bin/rtc.rs b/examples/stm32h7/src/bin/rtc.rs
index f2a19af81..78cea9c89 100644
--- a/examples/stm32h7/src/bin/rtc.rs
+++ b/examples/stm32h7/src/bin/rtc.rs
@@ -8,7 +8,7 @@ use embassy_executor::Spawner;
8use embassy_stm32::rcc::LsConfig; 8use embassy_stm32::rcc::LsConfig;
9use embassy_stm32::rtc::{Rtc, RtcConfig}; 9use embassy_stm32::rtc::{Rtc, RtcConfig};
10use embassy_stm32::Config; 10use embassy_stm32::Config;
11use embassy_time::{Duration, Timer}; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14#[embassy_executor::main] 14#[embassy_executor::main]
@@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) {
30 rtc.set_datetime(now.into()).expect("datetime not set"); 30 rtc.set_datetime(now.into()).expect("datetime not set");
31 31
32 // In reality the delay would be much longer 32 // In reality the delay would be much longer
33 Timer::after(Duration::from_millis(20000)).await; 33 Timer::after_millis(20000).await;
34 34
35 let then: NaiveDateTime = rtc.now().unwrap().into(); 35 let then: NaiveDateTime = rtc.now().unwrap().into();
36 info!("Got RTC! {:?}", then.timestamp()); 36 info!("Got RTC! {:?}", then.timestamp());
diff --git a/examples/stm32h7/src/bin/signal.rs b/examples/stm32h7/src/bin/signal.rs
index 6d7c168d5..b5f583289 100644
--- a/examples/stm32h7/src/bin/signal.rs
+++ b/examples/stm32h7/src/bin/signal.rs
@@ -6,7 +6,7 @@ use defmt::{info, unwrap};
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 7use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
8use embassy_sync::signal::Signal; 8use embassy_sync::signal::Signal;
9use embassy_time::{Duration, Timer}; 9use embassy_time::Timer;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12static SIGNAL: Signal<CriticalSectionRawMutex, u32> = Signal::new(); 12static SIGNAL: Signal<CriticalSectionRawMutex, u32> = Signal::new();
@@ -16,7 +16,7 @@ async fn my_sending_task() {
16 let mut counter: u32 = 0; 16 let mut counter: u32 = 0;
17 17
18 loop { 18 loop {
19 Timer::after(Duration::from_secs(1)).await; 19 Timer::after_secs(1).await;
20 20
21 SIGNAL.signal(counter); 21 SIGNAL.signal(counter);
22 22
diff --git a/examples/stm32h7/src/bin/wdg.rs b/examples/stm32h7/src/bin/wdg.rs
index 9181dfd67..76fd9dfc0 100644
--- a/examples/stm32h7/src/bin/wdg.rs
+++ b/examples/stm32h7/src/bin/wdg.rs
@@ -5,7 +5,7 @@
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::wdg::IndependentWatchdog; 7use embassy_stm32::wdg::IndependentWatchdog;
8use embassy_time::{Duration, Timer}; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[embassy_executor::main] 11#[embassy_executor::main]
@@ -18,7 +18,7 @@ async fn main(_spawner: Spawner) {
18 wdg.unleash(); 18 wdg.unleash();
19 19
20 loop { 20 loop {
21 Timer::after(Duration::from_secs(1)).await; 21 Timer::after_secs(1).await;
22 wdg.pet(); 22 wdg.pet();
23 } 23 }
24} 24}