stm32/ipcc: remove constrain
This commit is contained in:
parent
d736c9205c
commit
661b1f3373
2 changed files with 7 additions and 13 deletions
|
@ -35,6 +35,10 @@ pub struct Ipcc<'d> {
|
||||||
|
|
||||||
impl<'d> Ipcc<'d> {
|
impl<'d> Ipcc<'d> {
|
||||||
pub fn new(peri: impl Peripheral<P = IPCC> + 'd, _config: Config) -> Self {
|
pub fn new(peri: impl Peripheral<P = IPCC> + 'd, _config: Config) -> Self {
|
||||||
|
Self::new_inner(peri)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn new_inner(peri: impl Peripheral<P = IPCC> + 'd) -> Self {
|
||||||
into_ref!(peri);
|
into_ref!(peri);
|
||||||
|
|
||||||
Self { _peri: peri }
|
Self { _peri: peri }
|
||||||
|
@ -180,14 +184,3 @@ unsafe fn _configure_pwr() {
|
||||||
// set RF wake-up clock = LSE
|
// set RF wake-up clock = LSE
|
||||||
rcc.csr().modify(|w| w.set_rfwkpsel(0b01));
|
rcc.csr().modify(|w| w.set_rfwkpsel(0b01));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: if anyone has a better idea, please let me know
|
|
||||||
/// extension trait that constrains the [`Ipcc`] peripheral
|
|
||||||
pub trait IpccExt<'d> {
|
|
||||||
fn constrain(self) -> Ipcc<'d>;
|
|
||||||
}
|
|
||||||
impl<'d> IpccExt<'d> for IPCC {
|
|
||||||
fn constrain(self) -> Ipcc<'d> {
|
|
||||||
Ipcc { _peri: self.into_ref() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -131,8 +131,9 @@ impl EvtBox {
|
||||||
|
|
||||||
impl Drop for EvtBox {
|
impl Drop for EvtBox {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
use crate::ipcc::IpccExt;
|
use crate::ipcc::Ipcc;
|
||||||
let mut ipcc = unsafe { crate::Peripherals::steal() }.IPCC.constrain();
|
|
||||||
|
let mut ipcc = Ipcc::new_inner(unsafe { crate::Peripherals::steal() }.IPCC);
|
||||||
mm::MemoryManager::evt_drop(self.ptr, &mut ipcc);
|
mm::MemoryManager::evt_drop(self.ptr, &mut ipcc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue