Skip to content

Commit ad52720

Browse files
committed
feat(rp): add output enable inversion API (gpio, pio)
1 parent 9b1add3 commit ad52720

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

embassy-rp/src/gpio.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,18 @@ impl<'d> Flex<'d> {
722722
});
723723
}
724724

725+
/// Configure the output enable inversion of this pin
726+
#[inline]
727+
pub fn set_output_enable_inversion(&mut self, invert: bool) {
728+
self.pin.gpio().ctrl().modify(|w| {
729+
w.set_oeover(if invert {
730+
pac::io::vals::Oeover::INVERT
731+
} else {
732+
pac::io::vals::Oeover::NORMAL
733+
})
734+
})
735+
}
736+
725737
/// Configure the output logic inversion of this pin.
726738
#[inline]
727739
pub fn set_output_inversion(&mut self, invert: bool) {

embassy-rp/src/pio/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,18 @@ impl<'l, PIO: Instance> Pin<'l, PIO> {
293293
});
294294
}
295295

296+
/// Configure the output enable inversion of this pin
297+
#[inline]
298+
pub fn set_output_enable_inversion(&mut self, invert: bool) {
299+
self.pin.gpio().ctrl().modify(|w| {
300+
w.set_oeover(if invert {
301+
pac::io::vals::Oeover::INVERT
302+
} else {
303+
pac::io::vals::Oeover::NORMAL
304+
})
305+
})
306+
}
307+
296308
/// Set the pin's input sync bypass.
297309
pub fn set_input_sync_bypass(&mut self, bypass: bool) {
298310
let mask = 1 << self.pin();

0 commit comments

Comments
 (0)