From 9330b56e651a864f35e1e72861245a6d221ee725 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Tue, 25 Nov 2025 12:40:27 +0100 Subject: feat: add ppi events for SPIS peripheral --- embassy-nrf/CHANGELOG.md | 1 + embassy-nrf/src/spis.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'embassy-nrf') diff --git a/embassy-nrf/CHANGELOG.md b/embassy-nrf/CHANGELOG.md index be79bde5d..cfb040ef5 100644 --- a/embassy-nrf/CHANGELOG.md +++ b/embassy-nrf/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - changed: `gpiote::InputChannel::wait()` now ensures events are seen as soon as the function is called, even if the future is not polled - bugfix: use correct flash size for nRF54l - changed: add workaround for anomaly 66 on nrf52 +- added: expose PPI events available on SPIS peripheral ## 0.8.0 - 2025-09-30 diff --git a/embassy-nrf/src/spis.rs b/embassy-nrf/src/spis.rs index 96a9c0ae0..6f837c317 100644 --- a/embassy-nrf/src/spis.rs +++ b/embassy-nrf/src/spis.rs @@ -17,6 +17,7 @@ use crate::gpio::{self, AnyPin, OutputDrive, Pin as GpioPin, SealedPin as _, con use crate::interrupt::typelevel::Interrupt; use crate::pac::gpio::vals as gpiovals; use crate::pac::spis::vals; +use crate::ppi::Event; use crate::util::slice_in_ram_or; use crate::{interrupt, pac}; @@ -334,6 +335,20 @@ impl<'d> Spis<'d> { Ok((n_rx, n_tx)) } + /// Returns the ACQUIRED event, for use with PPI. + /// + /// This event will fire when the semaphore is acquired. + pub fn event_acquired(&self) -> Event<'d> { + Event::from_reg(self.r.events_acquired()) + } + + /// Returns the END event, for use with PPI. + /// + /// This event will fire when the slave transaction is complete. + pub fn event_end(&self) -> Event<'d> { + Event::from_reg(self.r.events_end()) + } + async fn async_inner(&mut self, rx: &mut [u8], tx: &[u8]) -> Result<(usize, usize), Error> { match self.async_inner_from_ram(rx, tx).await { Ok(n) => Ok(n), -- cgit