diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-06-25 22:28:38 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-06-25 22:29:07 +0200 |
| commit | 292dbcc991d83851e9bb50b62e0b3fe5acf241ec (patch) | |
| tree | ebd73b53be1bb906f7f633bca02ce462c0504da7 | |
| parent | cab17434d5411558e7fb9f260665ec8da88118a9 (diff) | |
nrf/gpiote: fix port1 on nrf5340
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 16 |
1 files 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; | |||
| 19 | /// Amount of GPIOTE channels in the chip. | 19 | /// Amount of GPIOTE channels in the chip. |
| 20 | const CHANNEL_COUNT: usize = 8; | 20 | const CHANNEL_COUNT: usize = 8; |
| 21 | 21 | ||
| 22 | #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] | 22 | #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] |
| 23 | const PIN_COUNT: usize = 48; | 23 | const PIN_COUNT: usize = 48; |
| 24 | #[cfg(not(any(feature = "nrf52833", feature = "nrf52840")))] | 24 | #[cfg(not(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] |
| 25 | const PIN_COUNT: usize = 32; | 25 | const PIN_COUNT: usize = 32; |
| 26 | 26 | ||
| 27 | #[allow(clippy::declare_interior_mutable_const)] | 27 | #[allow(clippy::declare_interior_mutable_const)] |
| @@ -67,9 +67,9 @@ pub(crate) fn init(irq_prio: crate::interrupt::Priority) { | |||
| 67 | // no latched GPIO detect in nrf51. | 67 | // no latched GPIO detect in nrf51. |
| 68 | #[cfg(not(feature = "_nrf51"))] | 68 | #[cfg(not(feature = "_nrf51"))] |
| 69 | { | 69 | { |
| 70 | #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] | 70 | #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] |
| 71 | let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] }; | 71 | let ports = unsafe { &[&*pac::P0::ptr(), &*pac::P1::ptr()] }; |
| 72 | #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840")))] | 72 | #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] |
| 73 | let ports = unsafe { &[&*pac::P0::ptr()] }; | 73 | let ports = unsafe { &[&*pac::P0::ptr()] }; |
| 74 | 74 | ||
| 75 | for &p in ports { | 75 | for &p in ports { |
| @@ -130,9 +130,9 @@ unsafe fn handle_gpiote_interrupt() { | |||
| 130 | if g.events_port.read().bits() != 0 { | 130 | if g.events_port.read().bits() != 0 { |
| 131 | g.events_port.write(|w| w); | 131 | g.events_port.write(|w| w); |
| 132 | 132 | ||
| 133 | #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] | 133 | #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] |
| 134 | let ports = &[&*pac::P0::ptr(), &*pac::P1::ptr()]; | 134 | let ports = &[&*pac::P0::ptr(), &*pac::P1::ptr()]; |
| 135 | #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840")))] | 135 | #[cfg(not(any(feature = "_nrf51", feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340")))] |
| 136 | let ports = &[&*pac::P0::ptr()]; | 136 | let ports = &[&*pac::P0::ptr()]; |
| 137 | #[cfg(feature = "_nrf51")] | 137 | #[cfg(feature = "_nrf51")] |
| 138 | let ports = unsafe { &[&*pac::GPIO::ptr()] }; | 138 | let ports = unsafe { &[&*pac::GPIO::ptr()] }; |
| @@ -214,7 +214,7 @@ impl<'d> InputChannel<'d> { | |||
| 214 | InputChannelPolarity::None => w.mode().event().polarity().none(), | 214 | InputChannelPolarity::None => w.mode().event().polarity().none(), |
| 215 | InputChannelPolarity::Toggle => w.mode().event().polarity().toggle(), | 215 | InputChannelPolarity::Toggle => w.mode().event().polarity().toggle(), |
| 216 | }; | 216 | }; |
| 217 | #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] | 217 | #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] |
| 218 | w.port().bit(match pin.pin.pin.port() { | 218 | w.port().bit(match pin.pin.pin.port() { |
| 219 | crate::gpio::Port::Port0 => false, | 219 | crate::gpio::Port::Port0 => false, |
| 220 | crate::gpio::Port::Port1 => true, | 220 | crate::gpio::Port::Port1 => true, |
| @@ -288,7 +288,7 @@ impl<'d> OutputChannel<'d> { | |||
| 288 | OutputChannelPolarity::Clear => w.polarity().hi_to_lo(), | 288 | OutputChannelPolarity::Clear => w.polarity().hi_to_lo(), |
| 289 | OutputChannelPolarity::Toggle => w.polarity().toggle(), | 289 | OutputChannelPolarity::Toggle => w.polarity().toggle(), |
| 290 | }; | 290 | }; |
| 291 | #[cfg(any(feature = "nrf52833", feature = "nrf52840"))] | 291 | #[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))] |
| 292 | w.port().bit(match pin.pin.pin.port() { | 292 | w.port().bit(match pin.pin.pin.port() { |
| 293 | crate::gpio::Port::Port0 => false, | 293 | crate::gpio::Port::Port0 => false, |
| 294 | crate::gpio::Port::Port1 => true, | 294 | crate::gpio::Port::Port1 => true, |
