diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-02-01 20:12:13 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-01 20:12:13 +0000 |
| commit | 8800d29ce2234c63c9f3ec4c86e400f1291cc1b7 (patch) | |
| tree | 0067597d47fff3691c5f5db349c4380da5c4bbca | |
| parent | c4839e4671ade4b69f47e5436b5e44fae9109159 (diff) | |
| parent | 7e0f287431f7e5bdfc562164bf67afb214ac4700 (diff) | |
Merge pull request #2513 from Gekkio/f2-adc-fixes
F2 ADC fixes
| -rw-r--r-- | embassy-stm32/src/adc/v2.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/embassy-stm32/src/adc/v2.rs b/embassy-stm32/src/adc/v2.rs index 4622b40a9..b37ac5a5d 100644 --- a/embassy-stm32/src/adc/v2.rs +++ b/embassy-stm32/src/adc/v2.rs | |||
| @@ -34,7 +34,7 @@ impl AdcPin<ADC1> for Temperature {} | |||
| 34 | impl super::sealed::AdcPin<ADC1> for Temperature { | 34 | impl super::sealed::AdcPin<ADC1> for Temperature { |
| 35 | fn channel(&self) -> u8 { | 35 | fn channel(&self) -> u8 { |
| 36 | cfg_if::cfg_if! { | 36 | cfg_if::cfg_if! { |
| 37 | if #[cfg(any(stm32f40, stm32f41))] { | 37 | if #[cfg(any(stm32f2, stm32f40, stm32f41))] { |
| 38 | 16 | 38 | 16 |
| 39 | } else { | 39 | } else { |
| 40 | 18 | 40 | 18 |
| @@ -67,7 +67,11 @@ enum Prescaler { | |||
| 67 | 67 | ||
| 68 | impl Prescaler { | 68 | impl Prescaler { |
| 69 | fn from_pclk2(freq: Hertz) -> Self { | 69 | fn from_pclk2(freq: Hertz) -> Self { |
| 70 | // Datasheet for F2 specifies min frequency 0.6 MHz, and max 30 MHz (with VDDA 2.4-3.6V). | ||
| 71 | #[cfg(stm32f2)] | ||
| 72 | const MAX_FREQUENCY: Hertz = Hertz(30_000_000); | ||
| 70 | // Datasheet for both F4 and F7 specifies min frequency 0.6 MHz, typ freq. 30 MHz and max 36 MHz. | 73 | // Datasheet for both F4 and F7 specifies min frequency 0.6 MHz, typ freq. 30 MHz and max 36 MHz. |
| 74 | #[cfg(not(stm32f2))] | ||
| 71 | const MAX_FREQUENCY: Hertz = Hertz(36_000_000); | 75 | const MAX_FREQUENCY: Hertz = Hertz(36_000_000); |
| 72 | let raw_div = freq.0 / MAX_FREQUENCY.0; | 76 | let raw_div = freq.0 / MAX_FREQUENCY.0; |
| 73 | match raw_div { | 77 | match raw_div { |
