mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-27 12:20:37 +00:00
nrf/gpiote: fix port1 on nrf5340
This commit is contained in:
parent
cab17434d5
commit
292dbcc991
@ -19,9 +19,9 @@ const CHANNEL_COUNT: usize = 4;
|
|||||||
/// Amount of GPIOTE channels in the chip.
|
/// Amount of GPIOTE channels in the chip.
|
||||||
const CHANNEL_COUNT: usize = 8;
|
const CHANNEL_COUNT: usize = 8;
|
||||||
|
|
||||||
#[cfg(any(feature = "nrf52833", feature = "nrf52840"))]
|
#[cfg(any(feature = "nrf52833", feature = "nrf52840", feature = "_nrf5340"))]
|
||||||
const PIN_COUNT: usize = 48;
|
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;
|
const PIN_COUNT: usize = 32;
|
||||||
|
|
||||||
#[allow(clippy::declare_interior_mutable_const)]
|
#[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.
|
// no latched GPIO detect in nrf51.
|
||||||
#[cfg(not(feature = "_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()] };
|
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()] };
|
let ports = unsafe { &[&*pac::P0::ptr()] };
|
||||||
|
|
||||||
for &p in ports {
|
for &p in ports {
|
||||||
@ -130,9 +130,9 @@ unsafe fn handle_gpiote_interrupt() {
|
|||||||
if g.events_port.read().bits() != 0 {
|
if g.events_port.read().bits() != 0 {
|
||||||
g.events_port.write(|w| w);
|
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()];
|
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()];
|
let ports = &[&*pac::P0::ptr()];
|
||||||
#[cfg(feature = "_nrf51")]
|
#[cfg(feature = "_nrf51")]
|
||||||
let ports = unsafe { &[&*pac::GPIO::ptr()] };
|
let ports = unsafe { &[&*pac::GPIO::ptr()] };
|
||||||
@ -214,7 +214,7 @@ impl<'d> InputChannel<'d> {
|
|||||||
InputChannelPolarity::None => w.mode().event().polarity().none(),
|
InputChannelPolarity::None => w.mode().event().polarity().none(),
|
||||||
InputChannelPolarity::Toggle => w.mode().event().polarity().toggle(),
|
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() {
|
w.port().bit(match pin.pin.pin.port() {
|
||||||
crate::gpio::Port::Port0 => false,
|
crate::gpio::Port::Port0 => false,
|
||||||
crate::gpio::Port::Port1 => true,
|
crate::gpio::Port::Port1 => true,
|
||||||
@ -288,7 +288,7 @@ impl<'d> OutputChannel<'d> {
|
|||||||
OutputChannelPolarity::Clear => w.polarity().hi_to_lo(),
|
OutputChannelPolarity::Clear => w.polarity().hi_to_lo(),
|
||||||
OutputChannelPolarity::Toggle => w.polarity().toggle(),
|
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() {
|
w.port().bit(match pin.pin.pin.port() {
|
||||||
crate::gpio::Port::Port0 => false,
|
crate::gpio::Port::Port0 => false,
|
||||||
crate::gpio::Port::Port1 => true,
|
crate::gpio::Port::Port1 => true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user