diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-02-10 02:34:59 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-02-10 02:38:10 +0100 |
| commit | 550da471be7b56927b50b5955a6de0916ebe6b1f (patch) | |
| tree | 27b37e111dce9a3a5327c901c1bf139b1c1486d0 /examples/stm32g4/src | |
| parent | 1d265b73b2f46baf60a481c8b8036e50c2b6583f (diff) | |
stm32: Remove OptionalPin
The idea behind OptionalPin has a few problems:
- you need to impl the signal traits for NoPin which is a bit weird https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L413-L416
- you can pass any combination of set/unset pins, which needs checking at runtime https://github.com/embassy-rs/embassy/blob/master/embassy-stm32/src/dcmi.rs#L130
The replacement is to do multiple `new` constructors for each combination of pins you want to take.
Diffstat (limited to 'examples/stm32g4/src')
| -rw-r--r-- | examples/stm32g4/src/bin/pwm.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/examples/stm32g4/src/bin/pwm.rs b/examples/stm32g4/src/bin/pwm.rs index 3dd45318d..fb71c8b7d 100644 --- a/examples/stm32g4/src/bin/pwm.rs +++ b/examples/stm32g4/src/bin/pwm.rs | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 8 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 9 | use embassy_stm32::gpio::NoPin; | ||
| 10 | use embassy_stm32::pwm::{simple_pwm::SimplePwm, Channel}; | 9 | use embassy_stm32::pwm::{simple_pwm::SimplePwm, Channel}; |
| 11 | use embassy_stm32::time::U32Ext; | 10 | use embassy_stm32::time::U32Ext; |
| 12 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| @@ -16,7 +15,7 @@ use example_common::*; | |||
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | 15 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 17 | info!("Hello World!"); | 16 | info!("Hello World!"); |
| 18 | 17 | ||
| 19 | let mut pwm = SimplePwm::new(p.TIM2, p.PA5, NoPin, NoPin, NoPin, 10000.hz()); | 18 | let mut pwm = SimplePwm::new_1ch(p.TIM2, p.PA5, 10000.hz()); |
| 20 | let max = pwm.get_max_duty(); | 19 | let max = pwm.get_max_duty(); |
| 21 | pwm.enable(Channel::Ch1); | 20 | pwm.enable(Channel::Ch1); |
| 22 | 21 | ||
