From d97724cca3164250118c732759f403f4f94d4629 Mon Sep 17 00:00:00 2001 From: goueslati Date: Mon, 15 May 2023 10:25:02 +0100 Subject: tl_mbox read and write --- embassy-stm32/src/ipcc.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'embassy-stm32/src/ipcc.rs') diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs index 903aeca30..9af5f171f 100644 --- a/embassy-stm32/src/ipcc.rs +++ b/embassy-stm32/src/ipcc.rs @@ -158,6 +158,10 @@ impl<'d> Ipcc<'d> { pub fn is_rx_pending(&self, channel: IpccChannel) -> bool { self.c2_is_active_flag(channel) && self.c1_get_rx_channel(channel) } + + pub fn as_mut_ptr(&self) -> *mut Self { + unsafe { &mut core::ptr::read(self) as *mut _ } + } } impl sealed::Instance for crate::peripherals::IPCC { @@ -176,3 +180,14 @@ unsafe fn _configure_pwr() { // set RF wake-up clock = LSE 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() } + } +} -- cgit From 661b1f33738e56cd1b6092c0e3f014cb8e9726d3 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sat, 20 May 2023 10:10:21 -0500 Subject: stm32/ipcc: remove constrain --- embassy-stm32/src/ipcc.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'embassy-stm32/src/ipcc.rs') 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> { impl<'d> Ipcc<'d> { pub fn new(peri: impl Peripheral

+ 'd, _config: Config) -> Self { + Self::new_inner(peri) + } + + pub(crate) fn new_inner(peri: impl Peripheral

+ 'd) -> Self { into_ref!(peri); Self { _peri: peri } @@ -180,14 +184,3 @@ unsafe fn _configure_pwr() { // set RF wake-up clock = LSE 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() } - } -} -- cgit