From 292dbcc991d83851e9bb50b62e0b3fe5acf241ec Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 25 Jun 2024 22:28:38 +0200 Subject: [PATCH] nrf/gpiote: fix port1 on nrf5340 --- embassy-nrf/src/gpiote.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index d7f075722..a74b3157b 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -19,9 +19,9 @@ const CHANNEL_COUNT: usize = 4; /// Amount of GPIOTE channels in the chip. const CHANNEL_COUNT: usize = 8; -#[cfg(any(feature = "nrf52833", feature = "nrf52840"))] +#[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] const PIN_COUNT: usize = 48; -#[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))] +#[cfg(not(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] const PIN_COUNT: usize = 32; #[allow(clippy::declare_interior_mutable_const)] @@ -67,9 +67,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) { // no latched GPIO detect in nrf51. #[cfg(not(feature = "_nrf51"))] { - #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] + #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] }; - #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840")))] + #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] let ports = unsafe { &[&*pac::P0::ptr()] }; for &p in ports { @@ -130,9 +130,9 @@ unsafe fn handle_gpiote_interrupt() { if g.events_port.read().bits() != 0 { g.events_port.write(|w| w); - #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] + #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] let ports = &[&*pac::P0::ptr(), &*pac::P1::ptr()]; - #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840")))] + #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] let ports = &[&*pac::P0::ptr()]; #[cfg(feature = "_nrf51")] let ports = unsafe { &[&*pac::GPIO::ptr()] }; @@ -214,7 +214,7 @@ impl<'d> InputChannel<'d> { InputChannelPolarity::None => w.mode().event().polarity().none(), InputChannelPolarity::Toggle => w.mode().event().polarity().toggle(), }; - #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] + #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] w.port().bit(match pin.pin.pin.port() { crate::gpio::Port::Port0 => false, crate::gpio::Port::Port1 => true, @@ -288,7 +288,7 @@ impl<'d> OutputChannel<'d> { OutputChannelPolarity::Clear => w.polarity().hi_to_lo(), OutputChannelPolarity::Toggle => w.polarity().toggle(), }; - #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] + #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] w.port().bit(match pin.pin.pin.port() { crate::gpio::Port::Port0 => false, crate::gpio::Port::Port1 => true,