diff options
| -rw-r--r-- | embassy-stm32/src/ipcc.rs | 15 | ||||
| -rw-r--r-- | embassy-stm32/src/tl_mbox/evt.rs | 5 |
2 files changed, 7 insertions, 13 deletions
diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs index 9af5f171f..2b9caf8e5 100644 --- a/embassy-stm32/src/ipcc.rs +++ b/embassy-stm32/src/ipcc.rs | |||
| @@ -35,6 +35,10 @@ pub struct Ipcc<'d> { | |||
| 35 | 35 | ||
| 36 | impl<'d> Ipcc<'d> { | 36 | impl<'d> Ipcc<'d> { |
| 37 | pub fn new(peri: impl Peripheral<P = IPCC> + 'd, _config: Config) -> Self { | 37 | pub fn new(peri: impl Peripheral<P = IPCC> + 'd, _config: Config) -> Self { |
| 38 | Self::new_inner(peri) | ||
| 39 | } | ||
| 40 | |||
| 41 | pub(crate) fn new_inner(peri: impl Peripheral<P = IPCC> + 'd) -> Self { | ||
| 38 | into_ref!(peri); | 42 | into_ref!(peri); |
| 39 | 43 | ||
| 40 | Self { _peri: peri } | 44 | Self { _peri: peri } |
| @@ -180,14 +184,3 @@ unsafe fn _configure_pwr() { | |||
| 180 | // set RF wake-up clock = LSE | 184 | // set RF wake-up clock = LSE |
| 181 | rcc.csr().modify(|w| w.set_rfwkpsel(0b01)); | 185 | rcc.csr().modify(|w| w.set_rfwkpsel(0b01)); |
| 182 | } | 186 | } |
| 183 | |||
| 184 | // TODO: if anyone has a better idea, please let me know | ||
| 185 | /// extension trait that constrains the [`Ipcc`] peripheral | ||
| 186 | pub trait IpccExt<'d> { | ||
| 187 | fn constrain(self) -> Ipcc<'d>; | ||
| 188 | } | ||
| 189 | impl<'d> IpccExt<'d> for IPCC { | ||
| 190 | fn constrain(self) -> Ipcc<'d> { | ||
| 191 | Ipcc { _peri: self.into_ref() } | ||
| 192 | } | ||
| 193 | } | ||
diff --git a/embassy-stm32/src/tl_mbox/evt.rs b/embassy-stm32/src/tl_mbox/evt.rs index 0ecd4dab6..770133f29 100644 --- a/embassy-stm32/src/tl_mbox/evt.rs +++ b/embassy-stm32/src/tl_mbox/evt.rs | |||
| @@ -131,8 +131,9 @@ impl EvtBox { | |||
| 131 | 131 | ||
| 132 | impl Drop for EvtBox { | 132 | impl Drop for EvtBox { |
| 133 | fn drop(&mut self) { | 133 | fn drop(&mut self) { |
| 134 | use crate::ipcc::IpccExt; | 134 | use crate::ipcc::Ipcc; |
| 135 | let mut ipcc = unsafe { crate::Peripherals::steal() }.IPCC.constrain(); | 135 | |
| 136 | let mut ipcc = Ipcc::new_inner(unsafe { crate::Peripherals::steal() }.IPCC); | ||
| 136 | mm::MemoryManager::evt_drop(self.ptr, &mut ipcc); | 137 | mm::MemoryManager::evt_drop(self.ptr, &mut ipcc); |
| 137 | } | 138 | } |
| 138 | } | 139 | } |
