Skip to content

Commit a51d8b1

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

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

embassy-rp/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- add `wait_for_alarm` and `alarm_scheduled` methods to rtc module ([#4216](https://github.com/embassy-rs/embassy/pull/4216))
1616
- rp235x: use msplim for stack guard instead of MPU
1717
- Add reset_to_usb_boot for rp235x ([#4705](https://github.com/embassy-rs/embassy/pull/4705))
18+
- Add output enable inversion API (gpio, pio)
1819

1920
## 0.8.0 - 2025-08-26
2021

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)