diff options
| author | klownfish <[email protected]> | 2024-09-11 11:55:16 +0200 |
|---|---|---|
| committer | klownfish <[email protected]> | 2024-09-11 11:55:16 +0200 |
| commit | 0ba91ca555efc75dca603adbb51355c92b2fdb80 (patch) | |
| tree | 5900ed4e048e4a3a515bf7d1201e3758049c0ff3 /embassy-stm32/src/adc/mod.rs | |
| parent | e2f9a48457c5d54546a3861fb067071ce93f9742 (diff) | |
WIP: u5 adc
Diffstat (limited to 'embassy-stm32/src/adc/mod.rs')
| -rw-r--r-- | embassy-stm32/src/adc/mod.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/embassy-stm32/src/adc/mod.rs b/embassy-stm32/src/adc/mod.rs index 7a7d7cd8e..8ba586f5c 100644 --- a/embassy-stm32/src/adc/mod.rs +++ b/embassy-stm32/src/adc/mod.rs | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #[cfg_attr(any(adc_v3, adc_g0, adc_h5, adc_u0), path = "v3.rs")] | 13 | #[cfg_attr(any(adc_v3, adc_g0, adc_h5, adc_u0), path = "v3.rs")] |
| 14 | #[cfg_attr(adc_v4, path = "v4.rs")] | 14 | #[cfg_attr(adc_v4, path = "v4.rs")] |
| 15 | #[cfg_attr(adc_g4, path = "g4.rs")] | 15 | #[cfg_attr(adc_g4, path = "g4.rs")] |
| 16 | #[cfg_attr(adc_u5, path = "u5.rs")] | ||
| 16 | mod _version; | 17 | mod _version; |
| 17 | 18 | ||
| 18 | use core::marker::PhantomData; | 19 | use core::marker::PhantomData; |
| @@ -63,7 +64,7 @@ trait SealedInstance { | |||
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | pub(crate) trait SealedAdcChannel<T> { | 66 | pub(crate) trait SealedAdcChannel<T> { |
| 66 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4))] | 67 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4, adc_u5))] |
| 67 | fn setup(&mut self) {} | 68 | fn setup(&mut self) {} |
| 68 | 69 | ||
| 69 | #[allow(unused)] | 70 | #[allow(unused)] |
| @@ -97,7 +98,8 @@ pub(crate) fn blocking_delay_us(us: u32) { | |||
| 97 | adc_f3_v1_1, | 98 | adc_f3_v1_1, |
| 98 | adc_g0, | 99 | adc_g0, |
| 99 | adc_u0, | 100 | adc_u0, |
| 100 | adc_h5 | 101 | adc_h5, |
| 102 | adc_u5 | ||
| 101 | )))] | 103 | )))] |
| 102 | #[allow(private_bounds)] | 104 | #[allow(private_bounds)] |
| 103 | pub trait Instance: SealedInstance + crate::Peripheral<P = Self> { | 105 | pub trait Instance: SealedInstance + crate::Peripheral<P = Self> { |
| @@ -116,7 +118,8 @@ pub trait Instance: SealedInstance + crate::Peripheral<P = Self> { | |||
| 116 | adc_f3_v1_1, | 118 | adc_f3_v1_1, |
| 117 | adc_g0, | 119 | adc_g0, |
| 118 | adc_u0, | 120 | adc_u0, |
| 119 | adc_h5 | 121 | adc_h5, |
| 122 | adc_u5 | ||
| 120 | ))] | 123 | ))] |
| 121 | #[allow(private_bounds)] | 124 | #[allow(private_bounds)] |
| 122 | pub trait Instance: SealedInstance + crate::Peripheral<P = Self> + crate::rcc::RccPeripheral { | 125 | pub trait Instance: SealedInstance + crate::Peripheral<P = Self> + crate::rcc::RccPeripheral { |
| @@ -128,7 +131,7 @@ pub trait Instance: SealedInstance + crate::Peripheral<P = Self> + crate::rcc::R | |||
| 128 | pub trait AdcChannel<T>: SealedAdcChannel<T> + Sized { | 131 | pub trait AdcChannel<T>: SealedAdcChannel<T> + Sized { |
| 129 | #[allow(unused_mut)] | 132 | #[allow(unused_mut)] |
| 130 | fn degrade_adc(mut self) -> AnyAdcChannel<T> { | 133 | fn degrade_adc(mut self) -> AnyAdcChannel<T> { |
| 131 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4))] | 134 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4, adc_u5))] |
| 132 | self.setup(); | 135 | self.setup(); |
| 133 | 136 | ||
| 134 | AnyAdcChannel { | 137 | AnyAdcChannel { |
| @@ -183,7 +186,7 @@ macro_rules! impl_adc_pin { | |||
| 183 | ($inst:ident, $pin:ident, $ch:expr) => { | 186 | ($inst:ident, $pin:ident, $ch:expr) => { |
| 184 | impl crate::adc::AdcChannel<peripherals::$inst> for crate::peripherals::$pin {} | 187 | impl crate::adc::AdcChannel<peripherals::$inst> for crate::peripherals::$pin {} |
| 185 | impl crate::adc::SealedAdcChannel<peripherals::$inst> for crate::peripherals::$pin { | 188 | impl crate::adc::SealedAdcChannel<peripherals::$inst> for crate::peripherals::$pin { |
| 186 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4))] | 189 | #[cfg(any(adc_v1, adc_l0, adc_v2, adc_g4, adc_v4, adc_u5))] |
| 187 | fn setup(&mut self) { | 190 | fn setup(&mut self) { |
| 188 | <Self as crate::gpio::SealedPin>::set_as_analog(self); | 191 | <Self as crate::gpio::SealedPin>::set_as_analog(self); |
| 189 | } | 192 | } |
