From eccf60aa74f9fc309b407ff3a209f8156a8ad561 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 19 Dec 2025 20:11:10 +0000 Subject: [PATCH] embassy-rp: fix set_input_sync_bypass pin offset currently this function causes a crash in debug mode when used with pins greater than 32 (available on the rp235xb variant) because it overflows when doing the shift. this commit applies the GPIOBASE offset to pin value before doing the shift. --- embassy-rp/src/pio/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/embassy-rp/src/pio/mod.rs b/embassy-rp/src/pio/mod.rs index 1c370fdfc6..d65d246d00 100644 --- a/embassy-rp/src/pio/mod.rs +++ b/embassy-rp/src/pio/mod.rs @@ -294,7 +294,14 @@ impl<'l, PIO: Instance> Pin<'l, PIO> { /// Set the pin's input sync bypass. pub fn set_input_sync_bypass(&mut self, bypass: bool) { - let mask = 1 << self.pin(); + #[cfg(feature = "rp2040")] + let offset = 0; + + #[cfg(feature = "_rp235x")] + let offset = if PIO::PIO.gpiobase().read().gpiobase() { 16 } else { 0 }; + + let mask = 1 << self.pin() - offset; + if bypass { PIO::PIO.input_sync_bypass().write_set(|w| *w = mask); } else {