diff options
| author | melvdl <[email protected]> | 2025-06-27 01:08:45 +0200 |
|---|---|---|
| committer | melvdl <[email protected]> | 2025-06-27 01:08:45 +0200 |
| commit | 41327c1325367177548dabc644636617274de7f4 (patch) | |
| tree | b389d87f80f0843db946635837691982e41740a0 /examples/stm32g0/src | |
| parent | 6f88c2c73caa63a6e534130f4a064cb95d3e9d7d (diff) | |
stm32: adapt examples to timer API changes
Diffstat (limited to 'examples/stm32g0/src')
| -rw-r--r-- | examples/stm32g0/src/bin/hf_timer.rs | 4 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/input_capture.rs | 4 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/pwm_complementary.rs | 8 | ||||
| -rw-r--r-- | examples/stm32g0/src/bin/pwm_input.rs | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/examples/stm32g0/src/bin/hf_timer.rs b/examples/stm32g0/src/bin/hf_timer.rs index dfb6e0edc..705905f01 100644 --- a/examples/stm32g0/src/bin/hf_timer.rs +++ b/examples/stm32g0/src/bin/hf_timer.rs | |||
| @@ -37,8 +37,8 @@ async fn main(_spawner: Spawner) { | |||
| 37 | } | 37 | } |
| 38 | let p = embassy_stm32::init(config); | 38 | let p = embassy_stm32::init(config); |
| 39 | 39 | ||
| 40 | let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 40 | let ch1 = PwmPin::new(p.PA8, OutputType::PushPull); |
| 41 | let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull); | 41 | let ch1n = ComplementaryPwmPin::new(p.PA7, OutputType::PushPull); |
| 42 | 42 | ||
| 43 | let mut pwm = ComplementaryPwm::new( | 43 | let mut pwm = ComplementaryPwm::new( |
| 44 | p.TIM1, | 44 | p.TIM1, |
diff --git a/examples/stm32g0/src/bin/input_capture.rs b/examples/stm32g0/src/bin/input_capture.rs index 08df4e043..df339d541 100644 --- a/examples/stm32g0/src/bin/input_capture.rs +++ b/examples/stm32g0/src/bin/input_capture.rs | |||
| @@ -47,12 +47,12 @@ async fn main(spawner: Spawner) { | |||
| 47 | unwrap!(spawner.spawn(blinky(p.PB1))); | 47 | unwrap!(spawner.spawn(blinky(p.PB1))); |
| 48 | 48 | ||
| 49 | // Connect PB1 and PA8 with a 1k Ohm resistor | 49 | // Connect PB1 and PA8 with a 1k Ohm resistor |
| 50 | let ch1_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 50 | let ch1_pin = PwmPin::new(p.PA8, OutputType::PushPull); |
| 51 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); | 51 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); |
| 52 | pwm.ch1().enable(); | 52 | pwm.ch1().enable(); |
| 53 | pwm.ch1().set_duty_cycle(50); | 53 | pwm.ch1().set_duty_cycle(50); |
| 54 | 54 | ||
| 55 | let ch1 = CapturePin::new_ch1(p.PA0, Pull::None); | 55 | let ch1 = CapturePin::new(p.PA0, Pull::None); |
| 56 | let mut ic = InputCapture::new(p.TIM2, Some(ch1), None, None, None, Irqs, khz(1000), Default::default()); | 56 | let mut ic = InputCapture::new(p.TIM2, Some(ch1), None, None, None, Irqs, khz(1000), Default::default()); |
| 57 | 57 | ||
| 58 | let mut old_capture = 0; | 58 | let mut old_capture = 0; |
diff --git a/examples/stm32g0/src/bin/pwm_complementary.rs b/examples/stm32g0/src/bin/pwm_complementary.rs index 97b163c40..dbd9194c9 100644 --- a/examples/stm32g0/src/bin/pwm_complementary.rs +++ b/examples/stm32g0/src/bin/pwm_complementary.rs | |||
| @@ -26,10 +26,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 26 | async fn main(_spawner: Spawner) { | 26 | async fn main(_spawner: Spawner) { |
| 27 | let p = embassy_stm32::init(Default::default()); | 27 | let p = embassy_stm32::init(Default::default()); |
| 28 | 28 | ||
| 29 | let ch1 = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 29 | let ch1 = PwmPin::new(p.PA8, OutputType::PushPull); |
| 30 | let ch1n = ComplementaryPwmPin::new_ch1(p.PA7, OutputType::PushPull); | 30 | let ch1n = ComplementaryPwmPin::new(p.PA7, OutputType::PushPull); |
| 31 | let ch2 = PwmPin::new_ch2(p.PB3, OutputType::PushPull); | 31 | let ch2 = PwmPin::new(p.PB3, OutputType::PushPull); |
| 32 | let ch2n = ComplementaryPwmPin::new_ch2(p.PB0, OutputType::PushPull); | 32 | let ch2n = ComplementaryPwmPin::new(p.PB0, OutputType::PushPull); |
| 33 | 33 | ||
| 34 | let mut pwm = ComplementaryPwm::new( | 34 | let mut pwm = ComplementaryPwm::new( |
| 35 | p.TIM1, | 35 | p.TIM1, |
diff --git a/examples/stm32g0/src/bin/pwm_input.rs b/examples/stm32g0/src/bin/pwm_input.rs index 9d6b5fe97..dc2428607 100644 --- a/examples/stm32g0/src/bin/pwm_input.rs +++ b/examples/stm32g0/src/bin/pwm_input.rs | |||
| @@ -42,7 +42,7 @@ async fn main(spawner: Spawner) { | |||
| 42 | 42 | ||
| 43 | unwrap!(spawner.spawn(blinky(p.PB1))); | 43 | unwrap!(spawner.spawn(blinky(p.PB1))); |
| 44 | // Connect PA8 and PA6 with a 1k Ohm resistor | 44 | // Connect PA8 and PA6 with a 1k Ohm resistor |
| 45 | let ch1_pin = PwmPin::new_ch1(p.PA8, OutputType::PushPull); | 45 | let ch1_pin = PwmPin::new(p.PA8, OutputType::PushPull); |
| 46 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); | 46 | let mut pwm = SimplePwm::new(p.TIM1, Some(ch1_pin), None, None, None, khz(1), Default::default()); |
| 47 | pwm.ch1().set_duty_cycle_fraction(1, 4); | 47 | pwm.ch1().set_duty_cycle_fraction(1, 4); |
| 48 | pwm.ch1().enable(); | 48 | pwm.ch1().enable(); |
