diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /examples/stm32f4/src/bin | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'examples/stm32f4/src/bin')
| -rw-r--r-- | examples/stm32f4/src/bin/can.rs | 2 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/flash_async.rs | 8 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/input_capture.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/pwm_input.rs | 4 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/ws2812_pwm.rs | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs index 8e3beee24..fd90e0d6d 100644 --- a/examples/stm32f4/src/bin/can.rs +++ b/examples/stm32f4/src/bin/can.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | // To synchronise to the bus the RX input needs to see a high level. | 30 | // To synchronise to the bus the RX input needs to see a high level. |
| 31 | // Use `mem::forget()` to release the borrow on the pin but keep the | 31 | // Use `mem::forget()` to release the borrow on the pin but keep the |
| 32 | // pull-up resistor enabled. | 32 | // pull-up resistor enabled. |
| 33 | let rx_pin = Input::new(&mut p.PA11, Pull::Up); | 33 | let rx_pin = Input::new(p.PA11.reborrow(), Pull::Up); |
| 34 | core::mem::forget(rx_pin); | 34 | core::mem::forget(rx_pin); |
| 35 | 35 | ||
| 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); | 36 | let mut can = Can::new(p.CAN1, p.PA11, p.PA12, Irqs); |
diff --git a/examples/stm32f4/src/bin/flash_async.rs b/examples/stm32f4/src/bin/flash_async.rs index 493a536f3..755713542 100644 --- a/examples/stm32f4/src/bin/flash_async.rs +++ b/examples/stm32f4/src/bin/flash_async.rs | |||
| @@ -3,9 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::{info, unwrap}; | 4 | use defmt::{info, unwrap}; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::bind_interrupts; | ||
| 7 | use embassy_stm32::flash::{Flash, InterruptHandler}; | 6 | use embassy_stm32::flash::{Flash, InterruptHandler}; |
| 8 | use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Speed}; | 7 | use embassy_stm32::gpio::{AnyPin, Level, Output, Speed}; |
| 8 | use embassy_stm32::{bind_interrupts, Peri}; | ||
| 9 | use embassy_time::Timer; | 9 | use embassy_time::Timer; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| @@ -21,14 +21,14 @@ async fn main(spawner: Spawner) { | |||
| 21 | let mut f = Flash::new(p.FLASH, Irqs); | 21 | let mut f = Flash::new(p.FLASH, Irqs); |
| 22 | 22 | ||
| 23 | // Led should blink uninterrupted during ~2sec erase operation | 23 | // Led should blink uninterrupted during ~2sec erase operation |
| 24 | spawner.spawn(blinky(p.PB7.degrade())).unwrap(); | 24 | spawner.spawn(blinky(p.PB7.into())).unwrap(); |
| 25 | 25 | ||
| 26 | // Test on bank 2 in order not to stall CPU. | 26 | // Test on bank 2 in order not to stall CPU. |
| 27 | test_flash(&mut f, 1024 * 1024, 128 * 1024).await; | 27 | test_flash(&mut f, 1024 * 1024, 128 * 1024).await; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | #[embassy_executor::task] | 30 | #[embassy_executor::task] |
| 31 | async fn blinky(p: AnyPin) { | 31 | async fn blinky(p: Peri<'static, AnyPin>) { |
| 32 | let mut led = Output::new(p, Level::High, Speed::Low); | 32 | let mut led = Output::new(p, Level::High, Speed::Low); |
| 33 | 33 | ||
| 34 | loop { | 34 | loop { |
diff --git a/examples/stm32f4/src/bin/input_capture.rs b/examples/stm32f4/src/bin/input_capture.rs index 49de33d2b..fe5e2bdfc 100644 --- a/examples/stm32f4/src/bin/input_capture.rs +++ b/examples/stm32f4/src/bin/input_capture.rs | |||
| @@ -7,14 +7,14 @@ use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | |||
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; | 8 | use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; |
| 9 | use embassy_stm32::timer::{self, Channel}; | 9 | use embassy_stm32::timer::{self, Channel}; |
| 10 | use embassy_stm32::{bind_interrupts, peripherals}; | 10 | use embassy_stm32::{bind_interrupts, peripherals, Peri}; |
| 11 | use embassy_time::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 | /// Connect PB2 and PB10 with a 1k Ohm resistor | 14 | /// Connect PB2 and PB10 with a 1k Ohm resistor |
| 15 | 15 | ||
| 16 | #[embassy_executor::task] | 16 | #[embassy_executor::task] |
| 17 | async fn blinky(led: peripherals::PB2) { | 17 | async fn blinky(led: Peri<'static, peripherals::PB2>) { |
| 18 | let mut led = Output::new(led, Level::High, Speed::Low); | 18 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 19 | 19 | ||
| 20 | loop { | 20 | loop { |
diff --git a/examples/stm32f4/src/bin/pwm_input.rs b/examples/stm32f4/src/bin/pwm_input.rs index ce200549d..465cbe4f5 100644 --- a/examples/stm32f4/src/bin/pwm_input.rs +++ b/examples/stm32f4/src/bin/pwm_input.rs | |||
| @@ -6,14 +6,14 @@ use embassy_executor::Spawner; | |||
| 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 7 | use embassy_stm32::time::khz; | 7 | use embassy_stm32::time::khz; |
| 8 | use embassy_stm32::timer::pwm_input::PwmInput; | 8 | use embassy_stm32::timer::pwm_input::PwmInput; |
| 9 | use embassy_stm32::{bind_interrupts, peripherals, timer}; | 9 | use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; |
| 10 | use embassy_time::Timer; | 10 | use embassy_time::Timer; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 12 | ||
| 13 | /// Connect PB2 and PA6 with a 1k Ohm resistor | 13 | /// Connect PB2 and PA6 with a 1k Ohm resistor |
| 14 | 14 | ||
| 15 | #[embassy_executor::task] | 15 | #[embassy_executor::task] |
| 16 | async fn blinky(led: peripherals::PB2) { | 16 | async fn blinky(led: Peri<'static, peripherals::PB2>) { |
| 17 | let mut led = Output::new(led, Level::High, Speed::Low); | 17 | let mut led = Output::new(led, Level::High, Speed::Low); |
| 18 | 18 | ||
| 19 | loop { | 19 | loop { |
diff --git a/examples/stm32f4/src/bin/ws2812_pwm.rs b/examples/stm32f4/src/bin/ws2812_pwm.rs index 3ab93d6e0..ca924e181 100644 --- a/examples/stm32f4/src/bin/ws2812_pwm.rs +++ b/examples/stm32f4/src/bin/ws2812_pwm.rs | |||
| @@ -92,7 +92,7 @@ async fn main(_spawner: Spawner) { | |||
| 92 | loop { | 92 | loop { |
| 93 | for &color in color_list { | 93 | for &color in color_list { |
| 94 | // with &mut, we can easily reuse same DMA channel multiple times | 94 | // with &mut, we can easily reuse same DMA channel multiple times |
| 95 | ws2812_pwm.waveform_up(&mut dp.DMA1_CH2, pwm_channel, color).await; | 95 | ws2812_pwm.waveform_up(dp.DMA1_CH2.reborrow(), pwm_channel, color).await; |
| 96 | // ws2812 need at least 50 us low level input to confirm the input data and change it's state | 96 | // ws2812 need at least 50 us low level input to confirm the input data and change it's state |
| 97 | Timer::after_micros(50).await; | 97 | Timer::after_micros(50).await; |
| 98 | // wait until ticker tick | 98 | // wait until ticker tick |
