diff options
| -rw-r--r-- | embassy-stm32/src/adc/v3.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/embassy-stm32/src/adc/v3.rs b/embassy-stm32/src/adc/v3.rs index 78b497727..c65357aff 100644 --- a/embassy-stm32/src/adc/v3.rs +++ b/embassy-stm32/src/adc/v3.rs | |||
| @@ -65,7 +65,7 @@ impl<T: Instance> super::SealedSpecialConverter<super::Vbat> for T { | |||
| 65 | } | 65 | } |
| 66 | #[cfg(any(adc_h5, adc_h7rs))] | 66 | #[cfg(any(adc_h5, adc_h7rs))] |
| 67 | impl<T: Instance> super::SealedSpecialConverter<super::Vbat> for T { | 67 | impl<T: Instance> super::SealedSpecialConverter<super::Vbat> for T { |
| 68 | const CHANNEL: u8 = 2; | 68 | const CHANNEL: u8 = 16; |
| 69 | } | 69 | } |
| 70 | #[cfg(adc_u0)] | 70 | #[cfg(adc_u0)] |
| 71 | impl<T: Instance> super::SealedSpecialConverter<super::Vbat> for T { | 71 | impl<T: Instance> super::SealedSpecialConverter<super::Vbat> for T { |
| @@ -82,7 +82,7 @@ cfg_if! { | |||
| 82 | impl<T: Instance> super::AdcChannel<T> for VddCore {} | 82 | impl<T: Instance> super::AdcChannel<T> for VddCore {} |
| 83 | impl<T: Instance> super::SealedAdcChannel<T> for VddCore { | 83 | impl<T: Instance> super::SealedAdcChannel<T> for VddCore { |
| 84 | fn channel(&self) -> u8 { | 84 | fn channel(&self) -> u8 { |
| 85 | 6 | 85 | 17 |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| @@ -582,6 +582,24 @@ impl<'d, T: Instance> Adc<'d, T> { | |||
| 582 | Vbat {} | 582 | Vbat {} |
| 583 | } | 583 | } |
| 584 | 584 | ||
| 585 | pub fn disable_vbat(&self) { | ||
| 586 | cfg_if! { | ||
| 587 | if #[cfg(any(adc_g0, adc_u0))] { | ||
| 588 | T::regs().ccr().modify(|reg| { | ||
| 589 | reg.set_vbaten(false); | ||
| 590 | }); | ||
| 591 | } else if #[cfg(any(adc_h5, adc_h7rs))] { | ||
| 592 | T::common_regs().ccr().modify(|reg| { | ||
| 593 | reg.set_vbaten(false); | ||
| 594 | }); | ||
| 595 | } else { | ||
| 596 | T::common_regs().ccr().modify(|reg| { | ||
| 597 | reg.set_ch18sel(false); | ||
| 598 | }); | ||
| 599 | } | ||
| 600 | } | ||
| 601 | } | ||
| 602 | |||
| 585 | /* | 603 | /* |
| 586 | /// Convert a raw sample from the `Temperature` to deg C | 604 | /// Convert a raw sample from the `Temperature` to deg C |
| 587 | pub fn to_degrees_centigrade(sample: u16) -> f32 { | 605 | pub fn to_degrees_centigrade(sample: u16) -> f32 { |
