aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Nilsson <[email protected]>2025-11-14 08:42:46 +0100
committerDaniel Nilsson <[email protected]>2025-11-14 08:58:19 +0100
commitd866a7f73775e0694f9c9a280df9d3603cb52541 (patch)
tree70cbf00a6d6be1dee6b9a2d1bc9e07fc11fdb2c7
parent31a6bb84bc27c79640edb490d2a96117a413375e (diff)
walking around stm32wb differences
-rw-r--r--embassy-stm32/src/adc/v3.rs29
1 files changed, 19 insertions, 10 deletions
diff --git a/embassy-stm32/src/adc/v3.rs b/embassy-stm32/src/adc/v3.rs
index 8559d0697..b833247a9 100644
--- a/embassy-stm32/src/adc/v3.rs
+++ b/embassy-stm32/src/adc/v3.rs
@@ -551,7 +551,7 @@ impl<'d, T: Instance> Adc<'d, T> {
551 */ 551 */
552} 552}
553 553
554#[cfg(not(any(adc_g0, adc_u0)))] 554#[cfg(not(any(adc_g0, adc_u0, stm32wb)))]
555impl<'d> Adc<'d, peripherals::ADC2> { 555impl<'d> Adc<'d, peripherals::ADC2> {
556 pub fn enable_vbat(&self) -> Vbat { 556 pub fn enable_vbat(&self) -> Vbat {
557 cfg_if! { 557 cfg_if! {
@@ -599,14 +599,21 @@ impl<'d> Adc<'d, peripherals::ADC2> {
599 599
600impl<'d> Adc<'d, peripherals::ADC1> { 600impl<'d> Adc<'d, peripherals::ADC1> {
601 pub fn enable_vrefint(&self) -> VrefInt { 601 pub fn enable_vrefint(&self) -> VrefInt {
602 #[cfg(not(any(adc_g0, adc_u0)))] 602 cfg_if! {
603 pac::ADC12_COMMON.ccr().modify(|reg| { 603 if #[cfg(not(any(adc_g0, adc_u0, stm32wb)))] {
604 reg.set_vrefen(true); 604 pac::ADC12_COMMON.ccr().modify(|reg| {
605 }); 605 reg.set_vrefen(true);
606 #[cfg(any(adc_g0, adc_u0))] 606 });
607 pac::ADC1.ccr().modify(|reg| { 607 } else if #[cfg(any(adc_g0, adc_u0))] {
608 reg.set_vrefen(true); 608 pac::ADC1.ccr().modify(|reg| {
609 }); 609 reg.set_vrefen(true);
610 });
611 } else {
612 pac::ADC1_COMMON.ccr().modify(|reg| {
613 reg.set_vrefen(true);
614 });
615 }
616 }
610 617
611 // "Table 24. Embedded internal voltage reference" states that it takes a maximum of 12 us 618 // "Table 24. Embedded internal voltage reference" states that it takes a maximum of 12 us
612 // to stabilize the internal voltage reference. 619 // to stabilize the internal voltage reference.
@@ -625,10 +632,12 @@ impl<'d> Adc<'d, peripherals::ADC1> {
625 pac::ADC12_COMMON.ccr().modify(|reg| { 632 pac::ADC12_COMMON.ccr().modify(|reg| {
626 reg.set_tsen(true); 633 reg.set_tsen(true);
627 }); 634 });
635 } else if #[cfg(any(stm32wb))] {
636 todo!();
628 } else { 637 } else {
629 pac::ADC12_COMMON.ccr().modify(|reg| { 638 pac::ADC12_COMMON.ccr().modify(|reg| {
630 reg.set_ch17sel(true); 639 reg.set_ch17sel(true);
631 }); 640 });
632 } 641 }
633 } 642 }
634 643