aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h7
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32h7')
-rw-r--r--examples/stm32h7/src/bin/adc_dma.rs2
-rw-r--r--examples/stm32h7/src/bin/dac_dma.rs5
-rw-r--r--examples/stm32h7/src/bin/low_level_timer_api.rs14
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};
10use embassy_stm32::rcc::frequency; 10use embassy_stm32::rcc::frequency;
11use embassy_stm32::time::Hertz; 11use embassy_stm32::time::Hertz;
12use embassy_stm32::timer::low_level::Timer; 12use embassy_stm32::timer::low_level::Timer;
13use embassy_stm32::Peri;
13use micromath::F32Ext; 14use micromath::F32Ext;
14use {defmt_rtt as _, panic_probe as _}; 15use {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]
60async fn dac_task1(tim: TIM6, mut dac: DacCh1<'static, DAC1, Async>) { 61async 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]
103async fn dac_task2(tim: TIM7, mut dac: DacCh2<'static, DAC1, Async>) { 104async 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};
7use embassy_stm32::time::{khz, Hertz}; 7use embassy_stm32::time::{khz, Hertz};
8use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer}; 8use embassy_stm32::timer::low_level::{OutputCompareMode, Timer as LLTimer};
9use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel}; 9use embassy_stm32::timer::{Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin, GeneralInstance32bit4Channel};
10use embassy_stm32::{into_ref, Config, Peripheral}; 10use embassy_stm32::{Config, Peri};
11use embassy_time::Timer; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
@@ -66,15 +66,13 @@ pub struct SimplePwm32<'d, T: GeneralInstance32bit4Channel> {
66 66
67impl<'d, T: GeneralInstance32bit4Channel> SimplePwm32<'d, T> { 67impl<'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();