diff options
| author | Jan Špaček <[email protected]> | 2024-06-01 18:16:40 +0200 |
|---|---|---|
| committer | Jan Špaček <[email protected]> | 2024-06-16 21:11:55 +0200 |
| commit | 94007ce6e0fc59e374902eadcc31616e56068e43 (patch) | |
| tree | 014302ef421d4cfdc6e816737793f3ad147d7bc1 /embassy-stm32/src/timer/pwm_input.rs | |
| parent | 1a2c8cecded9805970dc63f495723c690c01397e (diff) | |
stm32/gpio: refactor AfType
Diffstat (limited to 'embassy-stm32/src/timer/pwm_input.rs')
| -rw-r--r-- | embassy-stm32/src/timer/pwm_input.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/embassy-stm32/src/timer/pwm_input.rs b/embassy-stm32/src/timer/pwm_input.rs index dcf098a78..e3eb6042a 100644 --- a/embassy-stm32/src/timer/pwm_input.rs +++ b/embassy-stm32/src/timer/pwm_input.rs | |||
| @@ -4,7 +4,7 @@ use embassy_hal_internal::into_ref; | |||
| 4 | 4 | ||
| 5 | use super::low_level::{CountingMode, InputCaptureMode, InputTISelection, SlaveMode, Timer, TriggerSource}; | 5 | use super::low_level::{CountingMode, InputCaptureMode, InputTISelection, SlaveMode, Timer, TriggerSource}; |
| 6 | use super::{Channel, Channel1Pin, Channel2Pin, GeneralInstance4Channel}; | 6 | use super::{Channel, Channel1Pin, Channel2Pin, GeneralInstance4Channel}; |
| 7 | use crate::gpio::{AFType, Pull}; | 7 | use crate::gpio::{AfType, Pull}; |
| 8 | use crate::time::Hertz; | 8 | use crate::time::Hertz; |
| 9 | use crate::Peripheral; | 9 | use crate::Peripheral; |
| 10 | 10 | ||
| @@ -19,12 +19,12 @@ impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> { | |||
| 19 | pub fn new( | 19 | pub fn new( |
| 20 | tim: impl Peripheral<P = T> + 'd, | 20 | tim: impl Peripheral<P = T> + 'd, |
| 21 | pin: impl Peripheral<P = impl Channel1Pin<T>> + 'd, | 21 | pin: impl Peripheral<P = impl Channel1Pin<T>> + 'd, |
| 22 | pull_type: Pull, | 22 | pull: Pull, |
| 23 | freq: Hertz, | 23 | freq: Hertz, |
| 24 | ) -> Self { | 24 | ) -> Self { |
| 25 | into_ref!(pin); | 25 | into_ref!(pin); |
| 26 | 26 | ||
| 27 | pin.set_as_af_pull(pin.af_num(), AFType::Input, pull_type); | 27 | pin.set_as_af(pin.af_num(), AfType::input(pull)); |
| 28 | 28 | ||
| 29 | Self::new_inner(tim, freq, Channel::Ch1, Channel::Ch2) | 29 | Self::new_inner(tim, freq, Channel::Ch1, Channel::Ch2) |
| 30 | } | 30 | } |
| @@ -33,12 +33,12 @@ impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> { | |||
| 33 | pub fn new_alt( | 33 | pub fn new_alt( |
| 34 | tim: impl Peripheral<P = T> + 'd, | 34 | tim: impl Peripheral<P = T> + 'd, |
| 35 | pin: impl Peripheral<P = impl Channel2Pin<T>> + 'd, | 35 | pin: impl Peripheral<P = impl Channel2Pin<T>> + 'd, |
| 36 | pull_type: Pull, | 36 | pull: Pull, |
| 37 | freq: Hertz, | 37 | freq: Hertz, |
| 38 | ) -> Self { | 38 | ) -> Self { |
| 39 | into_ref!(pin); | 39 | into_ref!(pin); |
| 40 | 40 | ||
| 41 | pin.set_as_af_pull(pin.af_num(), AFType::Input, pull_type); | 41 | pin.set_as_af(pin.af_num(), AfType::input(pull)); |
| 42 | 42 | ||
| 43 | Self::new_inner(tim, freq, Channel::Ch2, Channel::Ch1) | 43 | Self::new_inner(tim, freq, Channel::Ch2, Channel::Ch1) |
| 44 | } | 44 | } |
