diff options
| author | Timo Kröger <[email protected]> | 2024-03-13 17:45:15 +0100 |
|---|---|---|
| committer | Timo Kröger <[email protected]> | 2024-03-14 21:55:05 +0100 |
| commit | 62b0410e865044080781765d9ccee06202a82dff (patch) | |
| tree | b90bdb6628cd358b085886dbdd63cffca5f13d5b | |
| parent | 88d1d38be787ff7e742dfde53cf8b527a6a07dad (diff) | |
[UCPD] Set CC pins to analog mode
Example: On STM32G431 CC2 has a pull-up (default JTAG signal) which needs to be disabled.
| -rw-r--r-- | embassy-stm32/src/ucpd.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/embassy-stm32/src/ucpd.rs b/embassy-stm32/src/ucpd.rs index d251b1c72..dcc4454d3 100644 --- a/embassy-stm32/src/ucpd.rs +++ b/embassy-stm32/src/ucpd.rs | |||
| @@ -95,9 +95,13 @@ impl<'d, T: Instance> Ucpd<'d, T> { | |||
| 95 | pub fn new( | 95 | pub fn new( |
| 96 | _peri: impl Peripheral<P = T> + 'd, | 96 | _peri: impl Peripheral<P = T> + 'd, |
| 97 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, | 97 | _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, |
| 98 | _cc1: impl Peripheral<P = impl Cc1Pin<T>> + 'd, | 98 | cc1: impl Peripheral<P = impl Cc1Pin<T>> + 'd, |
| 99 | _cc2: impl Peripheral<P = impl Cc2Pin<T>> + 'd, | 99 | cc2: impl Peripheral<P = impl Cc2Pin<T>> + 'd, |
| 100 | ) -> Self { | 100 | ) -> Self { |
| 101 | into_ref!(cc1, cc2); | ||
| 102 | cc1.set_as_analog(); | ||
| 103 | cc2.set_as_analog(); | ||
| 104 | |||
| 101 | T::enable_and_reset(); | 105 | T::enable_and_reset(); |
| 102 | T::Interrupt::unpend(); | 106 | T::Interrupt::unpend(); |
| 103 | unsafe { T::Interrupt::enable() }; | 107 | unsafe { T::Interrupt::enable() }; |
