stm32: adc v3: fix for newest pac

This commit is contained in:
Andres Vahter 2024-07-02 17:15:22 +03:00
parent c120efad5b
commit a4e62314af
2 changed files with 5 additions and 7 deletions

View File

@ -1,11 +1,12 @@
use cfg_if::cfg_if;
use embassy_hal_internal::into_ref;
use pac::adc::vals::Dmacfg;
use super::{
blocking_delay_us, Adc, AdcChannel, AnyAdcChannel, Instance, Resolution, RxDma, SampleTime, SealedAdcChannel,
};
use crate::dma::Transfer;
use crate::{rcc, Peripheral};
use crate::{pac, rcc, Peripheral};
/// Default VREF voltage used for sample conversion to millivolts.
pub const VREF_DEFAULT_MV: u32 = 3300;
@ -341,16 +342,14 @@ impl<'d, T: Instance> Adc<'d, T> {
T::regs().cfgr().modify(|reg| {
reg.set_discen(false);
reg.set_cont(true);
// Oneshot mode
reg.set_dmacfg(false);
reg.set_dmacfg(Dmacfg::ONESHOT);
reg.set_dmaen(true);
});
#[cfg(any(adc_g0, adc_u0))]
T::regs().cfgr1().modify(|reg| {
reg.set_discen(false);
reg.set_cont(true);
// Oneshot mode
reg.set_dmacfg(false);
reg.set_dmacfg(Dmacfg::ONESHOT);
reg.set_dmaen(true);
});

View File

@ -1,6 +1,5 @@
#[allow(unused)]
use pac::adc::vals::{Adcaldif, Boost, Difsel, Exten, Pcsel};
use pac::adc::vals::{Adstp, Dmngt};
use pac::adc::vals::{Adcaldif, Adstp, Boost, Difsel, Dmngt, Exten, Pcsel};
use pac::adccommon::vals::Presc;
use super::{