diff options
| author | chemicstry <[email protected]> | 2022-02-09 02:10:54 +0200 |
|---|---|---|
| committer | chemicstry <[email protected]> | 2022-02-09 02:10:54 +0200 |
| commit | 10981ee8093492a1b85d69db90269a9f4d8e3cee (patch) | |
| tree | 41083a44422040eef03659d97442cf54a9ccc4ca | |
| parent | a766bf635d20901d17bb9bd54ee508a0e904396a (diff) | |
Cleanup
| -rw-r--r-- | embassy-stm32/src/usb_otg.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/embassy-stm32/src/usb_otg.rs b/embassy-stm32/src/usb_otg.rs index c2c47159d..b3494ee7a 100644 --- a/embassy-stm32/src/usb_otg.rs +++ b/embassy-stm32/src/usb_otg.rs | |||
| @@ -20,6 +20,7 @@ pub struct UsbOtg<'d, T: Instance> { | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | impl<'d, T: Instance> UsbOtg<'d, T> { | 22 | impl<'d, T: Instance> UsbOtg<'d, T> { |
| 23 | /// Initializes USB OTG peripheral with internal Full-Speed PHY | ||
| 23 | pub fn new_fs( | 24 | pub fn new_fs( |
| 24 | _peri: impl Unborrow<Target = T> + 'd, | 25 | _peri: impl Unborrow<Target = T> + 'd, |
| 25 | dp: impl Unborrow<Target = impl DpPin<T>> + 'd, | 26 | dp: impl Unborrow<Target = impl DpPin<T>> + 'd, |
| @@ -34,6 +35,7 @@ impl<'d, T: Instance> UsbOtg<'d, T> { | |||
| 34 | } | 35 | } |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 38 | /// Initializes USB OTG peripheral with external High-Speed PHY | ||
| 37 | pub fn new_hs_ulpi( | 39 | pub fn new_hs_ulpi( |
| 38 | _peri: impl Unborrow<Target = T> + 'd, | 40 | _peri: impl Unborrow<Target = T> + 'd, |
| 39 | ulpi_clk: impl Unborrow<Target = impl UlpiClkPin<T>> + 'd, | 41 | ulpi_clk: impl Unborrow<Target = impl UlpiClkPin<T>> + 'd, |
| @@ -106,10 +108,11 @@ pub(crate) mod sealed { | |||
| 106 | } | 108 | } |
| 107 | }; | 109 | }; |
| 108 | 110 | ||
| 109 | ($name:ident, $($names:ident),+) => { | 111 | ($($name:ident),*) => { |
| 110 | declare_pins!($name); | 112 | $( |
| 111 | declare_pins!($($names),+); | 113 | declare_pins!($name); |
| 112 | } | 114 | )* |
| 115 | }; | ||
| 113 | } | 116 | } |
| 114 | 117 | ||
| 115 | // Internal PHY pins | 118 | // Internal PHY pins |
| @@ -128,10 +131,11 @@ macro_rules! declare_pins { | |||
| 128 | pub trait $name<T: Instance>: sealed::$name<T> {} | 131 | pub trait $name<T: Instance>: sealed::$name<T> {} |
| 129 | }; | 132 | }; |
| 130 | 133 | ||
| 131 | ($name:ident, $($names:ident),+) => { | 134 | ($($name:ident),*) => { |
| 132 | declare_pins!($name); | 135 | $( |
| 133 | declare_pins!($($names),+); | 136 | declare_pins!($name); |
| 134 | } | 137 | )* |
| 138 | }; | ||
| 135 | } | 139 | } |
| 136 | 140 | ||
| 137 | declare_pins!(DpPin, DmPin); | 141 | declare_pins!(DpPin, DmPin); |
| @@ -252,7 +256,7 @@ macro_rules! impl_pin { | |||
| 252 | }; | 256 | }; |
| 253 | } | 257 | } |
| 254 | 258 | ||
| 255 | // ULPI pins have to bet set to VeryHigh speed | 259 | // ULPI pins have to be set to VeryHigh speed |
| 256 | macro_rules! impl_ulpi_pin { | 260 | macro_rules! impl_ulpi_pin { |
| 257 | ($inst:ident, $pin:ident, $signal:ident, $af:expr) => { | 261 | ($inst:ident, $pin:ident, $signal:ident, $af:expr) => { |
| 258 | impl $signal<peripherals::$inst> for peripherals::$pin {} | 262 | impl $signal<peripherals::$inst> for peripherals::$pin {} |
