Merge pull request #2426 from embassy-rs/update-metapac-3984

stm32: update metapac.
This commit is contained in:
Dario Nieuwenhuis 2024-01-10 17:18:39 +00:00 committed by GitHub
commit 77e60ecff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 50 deletions

View File

@ -57,7 +57,7 @@ futures = { version = "0.3.17", default-features = false, features = ["async-awa
rand_core = "0.6.3"
sdio-host = "0.5.0"
critical-section = "1.1"
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-d5096244fa0b7992454a894a2aeaa369ae674222" }
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-656ecf6714fa34fdfb3b3e2f2cd034bffed3f303" }
vcell = "0.1.3"
bxcan = "0.7.0"
nb = "1.0.0"
@ -75,7 +75,7 @@ critical-section = { version = "1.1", features = ["std"] }
[build-dependencies]
proc-macro2 = "1.0.36"
quote = "1.0.15"
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-d5096244fa0b7992454a894a2aeaa369ae674222", default-features = false, features = ["metadata"]}
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-656ecf6714fa34fdfb3b3e2f2cd034bffed3f303", default-features = false, features = ["metadata"]}
[features]

View File

@ -3,6 +3,7 @@
use embassy_hal_internal::{into_ref, PeripheralRef};
use crate::pac::opamp::vals::*;
use crate::Peripheral;
/// Gain
@ -25,11 +26,11 @@ pub enum OpAmpSpeed {
}
#[cfg(opamp_g4)]
impl From<OpAmpSpeed> for crate::pac::opamp::vals::OpampCsrOpahsm {
impl From<OpAmpSpeed> for crate::pac::opamp::vals::Opahsm {
fn from(v: OpAmpSpeed) -> Self {
match v {
OpAmpSpeed::Normal => crate::pac::opamp::vals::OpampCsrOpahsm::NORMAL,
OpAmpSpeed::HighSpeed => crate::pac::opamp::vals::OpampCsrOpahsm::HIGHSPEED,
OpAmpSpeed::Normal => crate::pac::opamp::vals::Opahsm::NORMAL,
OpAmpSpeed::HighSpeed => crate::pac::opamp::vals::Opahsm::HIGHSPEED,
}
}
}
@ -61,7 +62,7 @@ impl<'d, T: Instance> OpAmp<'d, T> {
into_ref!(opamp);
#[cfg(opamp_g4)]
T::regs().opamp_csr().modify(|w| {
T::regs().csr().modify(|w| {
w.set_opahsm(speed.into());
});
@ -97,23 +98,13 @@ impl<'d, T: Instance> OpAmp<'d, T> {
OpAmpGain::Mul16 => (0b10, 0b11),
};
#[cfg(opamp_f3)]
T::regs().opampcsr().modify(|w| {
w.set_vp_sel(in_pin.channel());
w.set_vm_sel(vm_sel);
w.set_pga_gain(pga_gain);
w.set_opampen(true);
});
T::regs().csr().modify(|w| {
w.set_vp_sel(VpSel::from_bits(in_pin.channel()));
w.set_vm_sel(VmSel::from_bits(vm_sel));
w.set_pga_gain(PgaGain::from_bits(pga_gain));
#[cfg(opamp_g4)]
T::regs().opamp_csr().modify(|w| {
use crate::pac::opamp::vals::*;
w.set_vp_sel(OpampCsrVpSel::from_bits(in_pin.channel()));
w.set_vm_sel(OpampCsrVmSel::from_bits(vm_sel));
w.set_pga_gain(OpampCsrPgaGain::from_bits(pga_gain));
w.set_opaintoen(OpampCsrOpaintoen::OUTPUTPIN);
w.set_opaen(true);
w.set_opaintoen(Opaintoen::OUTPUTPIN);
w.set_opampen(true);
});
OpAmpOutput { _inner: self }
@ -144,13 +135,13 @@ impl<'d, T: Instance> OpAmp<'d, T> {
OpAmpGain::Mul16 => (0b10, 0b11),
};
T::regs().opamp_csr().modify(|w| {
T::regs().csr().modify(|w| {
use crate::pac::opamp::vals::*;
w.set_vp_sel(OpampCsrVpSel::from_bits(pin.channel()));
w.set_vm_sel(OpampCsrVmSel::from_bits(vm_sel));
w.set_pga_gain(OpampCsrPgaGain::from_bits(pga_gain));
w.set_opaintoen(OpampCsrOpaintoen::ADCCHANNEL);
w.set_opaen(true);
w.set_vp_sel(VpSel::from_bits(pin.channel()));
w.set_vm_sel(VmSel::from_bits(vm_sel));
w.set_pga_gain(PgaGain::from_bits(pga_gain));
w.set_opaintoen(Opaintoen::ADCCHANNEL);
w.set_opampen(true);
});
OpAmpInternalOutput { _inner: self }
@ -159,29 +150,17 @@ impl<'d, T: Instance> OpAmp<'d, T> {
impl<'d, T: Instance> Drop for OpAmpOutput<'d, T> {
fn drop(&mut self) {
#[cfg(opamp_f3)]
T::regs().opampcsr().modify(|w| {
T::regs().csr().modify(|w| {
w.set_opampen(false);
});
#[cfg(opamp_g4)]
T::regs().opamp_csr().modify(|w| {
w.set_opaen(false);
});
}
}
impl<'d, T: Instance> Drop for OpAmpInternalOutput<'d, T> {
fn drop(&mut self) {
#[cfg(opamp_f3)]
T::regs().opampcsr().modify(|w| {
T::regs().csr().modify(|w| {
w.set_opampen(false);
});
#[cfg(opamp_g4)]
T::regs().opamp_csr().modify(|w| {
w.set_opaen(false);
});
}
}

View File

@ -846,14 +846,7 @@ impl<'d, T: Instance, C: Channel, W: word::Word> Sai<'d, T, C, W> {
pub fn flush(&mut self) {
let ch = T::REGS.ch(self.sub_block as usize);
ch.cr1().modify(|w| w.set_saien(false));
#[cfg(any(sai_v1, sai_v2))]
{
ch.cr2().modify(|w| w.set_fflush(vals::Fflush::FLUSH));
}
#[cfg(any(sai_v3, sai_v4))]
{
ch.cr2().modify(|w| w.set_fflush(true));
}
ch.cr1().modify(|w| w.set_saien(true));
}