Skip to content

Commit 10367f1

Browse files
Merge pull request #248 from kalkyl/gpiote-port
Add port for gpiote task output pins (52833/52840)
2 parents d713410 + dbc28d0 commit 10367f1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nrf-hal-common/src/gpiote.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,15 @@ fn config_channel_task_pin<P: GpioteOutputPin>(
361361
TaskOutPolarity::Clear => w.polarity().hi_to_lo(),
362362
TaskOutPolarity::Toggle => w.polarity().toggle(),
363363
};
364+
365+
#[cfg(any(feature = "52833", feature = "52840"))]
366+
{
367+
match pin.port() {
368+
Port::Port0 => w.port().clear_bit(),
369+
Port::Port1 => w.port().set_bit(),
370+
};
371+
}
372+
364373
unsafe { w.psel().bits(pin.pin()) }
365374
});
366375
}
@@ -421,16 +430,23 @@ impl GpioteInputPin for Pin<Input<Floating>> {
421430
/// Trait to represent task output pin.
422431
pub trait GpioteOutputPin {
423432
fn pin(&self) -> u8;
433+
fn port(&self) -> Port;
424434
}
425435

426436
impl GpioteOutputPin for Pin<Output<OpenDrain>> {
427437
fn pin(&self) -> u8 {
428438
self.pin()
429439
}
440+
fn port(&self) -> Port {
441+
self.port()
442+
}
430443
}
431444

432445
impl GpioteOutputPin for Pin<Output<PushPull>> {
433446
fn pin(&self) -> u8 {
434447
self.pin()
435448
}
449+
fn port(&self) -> Port {
450+
self.port()
451+
}
436452
}

0 commit comments

Comments
 (0)