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/stm32h7 | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'examples/stm32h7')
| -rw-r--r-- | examples/stm32h7/src/bin/adc_dma.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/dac_dma.rs | 5 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/low_level_timer_api.rs | 14 |
3 files changed, 10 insertions, 11 deletions
diff --git a/examples/stm32h7/src/bin/adc_dma.rs b/examples/stm32h7/src/bin/adc_dma.rs index 0b905d227..dc775f18a 100644 --- a/examples/stm32h7/src/bin/adc_dma.rs +++ b/examples/stm32h7/src/bin/adc_dma.rs | |||
| @@ -57,7 +57,7 @@ async fn main(_spawner: Spawner) { | |||
| 57 | 57 | ||
| 58 | loop { | 58 | loop { |
| 59 | adc.read( | 59 | adc.read( |
| 60 | &mut dma, | 60 | dma.reborrow(), |
| 61 | [ | 61 | [ |
| 62 | (&mut vrefint_channel, SampleTime::CYCLES387_5), | 62 | (&mut vrefint_channel, SampleTime::CYCLES387_5), |
| 63 | (&mut pc0, SampleTime::CYCLES810_5), | 63 | (&mut pc0, SampleTime::CYCLES810_5), |
diff --git a/examples/stm32h7/src/bin/dac_dma.rs b/examples/stm32h7/src/bin/dac_dma.rs index 98c9f1e90..8314754bc 100644 --- a/examples/stm32h7/src/bin/dac_dma.rs +++ b/examples/stm32h7/src/bin/dac_dma.rs | |||
| @@ -10,6 +10,7 @@ use embassy_stm32::peripherals::{DAC1, TIM6, TIM7}; | |||
| 10 | use embassy_stm32::rcc::frequency; | 10 | use embassy_stm32::rcc::frequency; |
| 11 | use embassy_stm32::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::timer::low_level::Timer; | 12 | use embassy_stm32::timer::low_level::Timer; |
| 13 | use embassy_stm32::Peri; | ||
| 13 | use micromath::F32Ext; | 14 | use micromath::F32Ext; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 15 | use {defmt_rtt as _, panic_probe as _}; |
| 15 | 16 | ||
| @@ -57,7 +58,7 @@ async fn main(spawner: Spawner) { | |||
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | #[embassy_executor::task] | 60 | #[embassy_executor::task] |
| 60 | async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, Async>) { | 61 | async fn dac_task1(tim: Peri<'static, TIM6>, mut dac: DacCh1<'static, DAC1, Async>) { |
| 61 | let data: &[u8; 256] = &calculate_array::<256>(); | 62 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 62 | 63 | ||
| 63 | info!("TIM6 frequency is {}", frequency::<TIM6>()); | 64 | info!("TIM6 frequency is {}", frequency::<TIM6>()); |
| @@ -100,7 +101,7 @@ async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, Async>) { | |||
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | #[embassy_executor::task] | 103 | #[embassy_executor::task] |
| 103 | async fn dac_task2(tim: TIM7, mut dac: DacCh2<'static, DAC1, Async>) { | 104 | async fn dac_task2(tim: Peri<'static, TIM7>, mut dac: DacCh2<'static, DAC1, Async>) { |
| 104 | let data: &[u8; 256] = &calculate_array::<256>(); | 105 | let data: &[u8; 256] = &calculate_array::<256>(); |
| 105 | 106 | ||
| 106 | info!("TIM7 frequency is {}", frequency::<TIM6>()); | 107 | info!("TIM7 frequency is {}", frequency::<TIM6>()); |
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs index b796996ea..8de31ea5b 100644 --- a/examples/stm32h7/src/bin/low_level_timer_api.rs +++ b/examples/stm32h7/src/bin/low_level_timer_api.rs | |||
| @@ -7,7 +7,7 @@ use embassy_stm32::gpio::{AfType, Flex, OutputType, Speed}; | |||
| 7 | use embassy_stm32::time::{khz, Hertz}; | 7 | use embassy_stm32::time::{khz, Hertz}; |
| 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; | 8 | use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; |
| 9 | use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; | 9 | use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; |
| 10 | use embassy_stm32::{into_ref, Config, Peripheral}; | 10 | use embassy_stm32::{Config, 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 | ||
| @@ -66,15 +66,13 @@ pub struct SimplePwm32<'d, T: GeneralInstance32bit4Channel> { | |||
| 66 | 66 | ||
| 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { | 67 | impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { |
| 68 | pub fn new( | 68 | pub fn new( |
| 69 | tim: impl Peripheral<P = T> + 'd, | 69 | tim: Peri<'d, T>, |
| 70 | ch1: impl Peripheral<P = impl Channel1Pin<T>> + 'd, | 70 | ch1: Peri<'d, impl Channel1Pin<T>>, |
| 71 | ch2: impl Peripheral<P = impl Channel2Pin<T>> + 'd, | 71 | ch2: Peri<'d, impl Channel2Pin<T>>, |
| 72 | ch3: impl Peripheral<P = impl Channel3Pin<T>> + 'd, | 72 | ch3: Peri<'d, impl Channel3Pin<T>>, |
| 73 | ch4: impl Peripheral<P = impl Channel4Pin<T>> + 'd, | 73 | ch4: Peri<'d, impl Channel4Pin<T>>, |
| 74 | freq: Hertz, | 74 | freq: Hertz, |
| 75 | ) -> Self { | 75 | ) -> Self { |
| 76 | into_ref!(ch1, ch2, ch3, ch4); | ||
| 77 | |||
| 78 | let af1 = ch1.af_num(); | 76 | let af1 = ch1.af_num(); |
| 79 | let af2 = ch2.af_num(); | 77 | let af2 = ch2.af_num(); |
| 80 | let af3 = ch3.af_num(); | 78 | let af3 = ch3.af_num(); |
