Merge pull request #3484 from embassy-rs/rp235x-pio-ie

rp/pio: ensure PADS IE=1 which is not the default in rp235x.
This commit is contained in:
Dario Nieuwenhuis 2024-10-31 20:32:10 +00:00 committed by GitHub
commit f319f1bc1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1054,9 +1054,17 @@ impl<'d, PIO: Instance> Common<'d, PIO> {
pub fn make_pio_pin(&mut self, pin: impl Peripheral<P = impl PioPin + 'd> + 'd) -> Pin<'d, PIO> { pub fn make_pio_pin(&mut self, pin: impl Peripheral<P = impl PioPin + 'd> + 'd) -> Pin<'d, PIO> {
into_ref!(pin); into_ref!(pin);
pin.gpio().ctrl().write(|w| w.set_funcsel(PIO::FUNCSEL as _)); pin.gpio().ctrl().write(|w| w.set_funcsel(PIO::FUNCSEL as _));
pin.pad_ctrl().write(|w| {
#[cfg(feature = "_rp235x")] #[cfg(feature = "_rp235x")]
pin.pad_ctrl().modify(|w| {
w.set_iso(false); w.set_iso(false);
w.set_schmitt(true);
w.set_slewfast(false);
// TODO rp235x errata E9 recommends to not enable IE if we're not
// going to use input. Maybe add an API for the user to enable/disable this?
w.set_ie(true);
w.set_od(false);
w.set_pue(false);
w.set_pde(false);
}); });
// we can be relaxed about this because we're &mut here and nothing is cached // we can be relaxed about this because we're &mut here and nothing is cached
PIO::state().used_pins.fetch_or(1 << pin.pin_bank(), Ordering::Relaxed); PIO::state().used_pins.fetch_or(1 << pin.pin_bank(), Ordering::Relaxed);