diff options
| author | Alexandru RADOVICI <[email protected]> | 2024-04-02 20:05:46 +0300 |
|---|---|---|
| committer | Alexandru RADOVICI <[email protected]> | 2024-04-02 20:05:46 +0300 |
| commit | 7c36e8dbc7867c7fef0e74816b482a577ae2dc2d (patch) | |
| tree | fa6bb9e4e7eea68834808f6844881b892a2ff3e2 /embassy-rp/src | |
| parent | d35572c11f11980bebfda4d8738f46202c3384c3 (diff) | |
rename pins data type and the macro
Diffstat (limited to 'embassy-rp/src')
| -rw-r--r-- | embassy-rp/src/pwm.rs | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs index d0e89f250..5aab3ff4f 100644 --- a/embassy-rp/src/pwm.rs +++ b/embassy-rp/src/pwm.rs | |||
| @@ -129,7 +129,7 @@ impl<'d, T: Slice> Pwm<'d, T> { | |||
| 129 | #[inline] | 129 | #[inline] |
| 130 | pub fn new_output_a( | 130 | pub fn new_output_a( |
| 131 | inner: impl Peripheral<P = T> + 'd, | 131 | inner: impl Peripheral<P = T> + 'd, |
| 132 | a: impl Peripheral<P = impl PwmChannelA<T>> + 'd, | 132 | a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, |
| 133 | config: Config, | 133 | config: Config, |
| 134 | ) -> Self { | 134 | ) -> Self { |
| 135 | into_ref!(a); | 135 | into_ref!(a); |
| @@ -140,7 +140,7 @@ impl<'d, T: Slice> Pwm<'d, T> { | |||
| 140 | #[inline] | 140 | #[inline] |
| 141 | pub fn new_output_b( | 141 | pub fn new_output_b( |
| 142 | inner: impl Peripheral<P = T> + 'd, | 142 | inner: impl Peripheral<P = T> + 'd, |
| 143 | b: impl Peripheral<P = impl PwmChannelB<T>> + 'd, | 143 | b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, |
| 144 | config: Config, | 144 | config: Config, |
| 145 | ) -> Self { | 145 | ) -> Self { |
| 146 | into_ref!(b); | 146 | into_ref!(b); |
| @@ -151,8 +151,8 @@ impl<'d, T: Slice> Pwm<'d, T> { | |||
| 151 | #[inline] | 151 | #[inline] |
| 152 | pub fn new_output_ab( | 152 | pub fn new_output_ab( |
| 153 | inner: impl Peripheral<P = T> + 'd, | 153 | inner: impl Peripheral<P = T> + 'd, |
| 154 | a: impl Peripheral<P = impl PwmChannelA<T>> + 'd, | 154 | a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, |
| 155 | b: impl Peripheral<P = impl PwmChannelB<T>> + 'd, | 155 | b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, |
| 156 | config: Config, | 156 | config: Config, |
| 157 | ) -> Self { | 157 | ) -> Self { |
| 158 | into_ref!(a, b); | 158 | into_ref!(a, b); |
| @@ -163,7 +163,7 @@ impl<'d, T: Slice> Pwm<'d, T> { | |||
| 163 | #[inline] | 163 | #[inline] |
| 164 | pub fn new_input( | 164 | pub fn new_input( |
| 165 | inner: impl Peripheral<P = T> + 'd, | 165 | inner: impl Peripheral<P = T> + 'd, |
| 166 | b: impl Peripheral<P = impl PwmChannelB<T>> + 'd, | 166 | b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, |
| 167 | mode: InputMode, | 167 | mode: InputMode, |
| 168 | config: Config, | 168 | config: Config, |
| 169 | ) -> Self { | 169 | ) -> Self { |
| @@ -175,8 +175,8 @@ impl<'d, T: Slice> Pwm<'d, T> { | |||
| 175 | #[inline] | 175 | #[inline] |
| 176 | pub fn new_output_input( | 176 | pub fn new_output_input( |
| 177 | inner: impl Peripheral<P = T> + 'd, | 177 | inner: impl Peripheral<P = T> + 'd, |
| 178 | a: impl Peripheral<P = impl PwmChannelA<T>> + 'd, | 178 | a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, |
| 179 | b: impl Peripheral<P = impl PwmChannelB<T>> + 'd, | 179 | b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, |
| 180 | mode: InputMode, | 180 | mode: InputMode, |
| 181 | config: Config, | 181 | config: Config, |
| 182 | ) -> Self { | 182 | ) -> Self { |
| @@ -336,43 +336,43 @@ slice!(PWM_SLICE6, 6); | |||
| 336 | slice!(PWM_SLICE7, 7); | 336 | slice!(PWM_SLICE7, 7); |
| 337 | 337 | ||
| 338 | /// PWM Channel A. | 338 | /// PWM Channel A. |
| 339 | pub trait PwmChannelA<T: Slice>: GpioPin {} | 339 | pub trait ChannelAPin<T: Slice>: GpioPin {} |
| 340 | /// PWM Channel B. | 340 | /// PWM Channel B. |
| 341 | pub trait PwmChannelB<T: Slice>: GpioPin {} | 341 | pub trait ChannelBPin<T: Slice>: GpioPin {} |
| 342 | 342 | ||
| 343 | macro_rules! impl_channel { | 343 | macro_rules! impl_pin { |
| 344 | ($pin:ident, $channel:ident, $kind:ident) => { | 344 | ($pin:ident, $channel:ident, $kind:ident) => { |
| 345 | impl $kind<peripherals::$channel> for peripherals::$pin {} | 345 | impl $kind<peripherals::$channel> for peripherals::$pin {} |
| 346 | }; | 346 | }; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | impl_channel!(PIN_0, PWM_SLICE0, PwmChannelA); | 349 | impl_pin!(PIN_0, PWM_SLICE0, ChannelAPin); |
| 350 | impl_channel!(PIN_1, PWM_SLICE0, PwmChannelB); | 350 | impl_pin!(PIN_1, PWM_SLICE0, ChannelBPin); |
| 351 | impl_channel!(PIN_2, PWM_SLICE1, PwmChannelA); | 351 | impl_pin!(PIN_2, PWM_SLICE1, ChannelAPin); |
| 352 | impl_channel!(PIN_3, PWM_SLICE1, PwmChannelB); | 352 | impl_pin!(PIN_3, PWM_SLICE1, ChannelBPin); |
| 353 | impl_channel!(PIN_4, PWM_SLICE2, PwmChannelA); | 353 | impl_pin!(PIN_4, PWM_SLICE2, ChannelAPin); |
| 354 | impl_channel!(PIN_5, PWM_SLICE2, PwmChannelB); | 354 | impl_pin!(PIN_5, PWM_SLICE2, ChannelBPin); |
| 355 | impl_channel!(PIN_6, PWM_SLICE3, PwmChannelA); | 355 | impl_pin!(PIN_6, PWM_SLICE3, ChannelAPin); |
| 356 | impl_channel!(PIN_7, PWM_SLICE3, PwmChannelB); | 356 | impl_pin!(PIN_7, PWM_SLICE3, ChannelBPin); |
| 357 | impl_channel!(PIN_8, PWM_SLICE4, PwmChannelA); | 357 | impl_pin!(PIN_8, PWM_SLICE4, ChannelAPin); |
| 358 | impl_channel!(PIN_9, PWM_SLICE4, PwmChannelB); | 358 | impl_pin!(PIN_9, PWM_SLICE4, ChannelBPin); |
| 359 | impl_channel!(PIN_10, PWM_SLICE5, PwmChannelA); | 359 | impl_pin!(PIN_10, PWM_SLICE5, ChannelAPin); |
| 360 | impl_channel!(PIN_11, PWM_SLICE5, PwmChannelB); | 360 | impl_pin!(PIN_11, PWM_SLICE5, ChannelBPin); |
| 361 | impl_channel!(PIN_12, PWM_SLICE6, PwmChannelA); | 361 | impl_pin!(PIN_12, PWM_SLICE6, ChannelAPin); |
| 362 | impl_channel!(PIN_13, PWM_SLICE6, PwmChannelB); | 362 | impl_pin!(PIN_13, PWM_SLICE6, ChannelBPin); |
| 363 | impl_channel!(PIN_14, PWM_SLICE7, PwmChannelA); | 363 | impl_pin!(PIN_14, PWM_SLICE7, ChannelAPin); |
| 364 | impl_channel!(PIN_15, PWM_SLICE7, PwmChannelB); | 364 | impl_pin!(PIN_15, PWM_SLICE7, ChannelBPin); |
| 365 | impl_channel!(PIN_16, PWM_SLICE0, PwmChannelA); | 365 | impl_pin!(PIN_16, PWM_SLICE0, ChannelAPin); |
| 366 | impl_channel!(PIN_17, PWM_SLICE0, PwmChannelB); | 366 | impl_pin!(PIN_17, PWM_SLICE0, ChannelBPin); |
| 367 | impl_channel!(PIN_18, PWM_SLICE1, PwmChannelA); | 367 | impl_pin!(PIN_18, PWM_SLICE1, ChannelAPin); |
| 368 | impl_channel!(PIN_19, PWM_SLICE1, PwmChannelB); | 368 | impl_pin!(PIN_19, PWM_SLICE1, ChannelBPin); |
| 369 | impl_channel!(PIN_20, PWM_SLICE2, PwmChannelA); | 369 | impl_pin!(PIN_20, PWM_SLICE2, ChannelAPin); |
| 370 | impl_channel!(PIN_21, PWM_SLICE2, PwmChannelB); | 370 | impl_pin!(PIN_21, PWM_SLICE2, ChannelBPin); |
| 371 | impl_channel!(PIN_22, PWM_SLICE3, PwmChannelA); | 371 | impl_pin!(PIN_22, PWM_SLICE3, ChannelAPin); |
| 372 | impl_channel!(PIN_23, PWM_SLICE3, PwmChannelB); | 372 | impl_pin!(PIN_23, PWM_SLICE3, ChannelBPin); |
| 373 | impl_channel!(PIN_24, PWM_SLICE4, PwmChannelA); | 373 | impl_pin!(PIN_24, PWM_SLICE4, ChannelAPin); |
| 374 | impl_channel!(PIN_25, PWM_SLICE4, PwmChannelB); | 374 | impl_pin!(PIN_25, PWM_SLICE4, ChannelBPin); |
| 375 | impl_channel!(PIN_26, PWM_SLICE5, PwmChannelA); | 375 | impl_pin!(PIN_26, PWM_SLICE5, ChannelAPin); |
| 376 | impl_channel!(PIN_27, PWM_SLICE5, PwmChannelB); | 376 | impl_pin!(PIN_27, PWM_SLICE5, ChannelBPin); |
| 377 | impl_channel!(PIN_28, PWM_SLICE6, PwmChannelA); | 377 | impl_pin!(PIN_28, PWM_SLICE6, ChannelAPin); |
| 378 | impl_channel!(PIN_29, PWM_SLICE6, PwmChannelB); | 378 | impl_pin!(PIN_29, PWM_SLICE6, ChannelBPin); |
