Handle pad isolation everywhere and in the same way.

This commit is contained in:
Caleb Jamison 2024-08-10 17:36:28 -04:00
parent 168a9f9d8a
commit 9a863f07fe
5 changed files with 28 additions and 9 deletions

View File

@ -35,6 +35,8 @@ impl<'p> Channel<'p> {
pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self { pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self {
into_ref!(pin); into_ref!(pin);
pin.pad_ctrl().modify(|w| { pin.pad_ctrl().modify(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
// manual says: // manual says:
// //
// > When using an ADC input shared with a GPIO pin, the pins // > When using an ADC input shared with a GPIO pin, the pins

View File

@ -581,6 +581,8 @@ impl<'d> Flex<'d> {
into_ref!(pin); into_ref!(pin);
pin.pad_ctrl().write(|w| { pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_ie(true); w.set_ie(true);
}); });
@ -591,11 +593,6 @@ impl<'d> Flex<'d> {
w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _); w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _);
}); });
#[cfg(feature = "rp235x")]
pin.pad_ctrl().modify(|w| {
w.set_iso(false);
});
Self { pin: pin.map_into() } Self { pin: pin.map_into() }
} }

View File

@ -363,6 +363,8 @@ where
{ {
pin.gpio().ctrl().write(|w| w.set_funcsel(3)); pin.gpio().ctrl().write(|w| w.set_funcsel(3));
pin.pad_ctrl().write(|w| { pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_schmitt(true); w.set_schmitt(true);
w.set_slewfast(false); w.set_slewfast(false);
w.set_ie(true); w.set_ie(true);

View File

@ -110,6 +110,8 @@ impl<'d> Pwm<'d> {
if let Some(pin) = &b { if let Some(pin) = &b {
pin.gpio().ctrl().write(|w| w.set_funcsel(4)); pin.gpio().ctrl().write(|w| w.set_funcsel(4));
pin.pad_ctrl().modify(|w| { pin.pad_ctrl().modify(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_pue(b_pull == Pull::Up); w.set_pue(b_pull == Pull::Up);
w.set_pde(b_pull == Pull::Down); w.set_pde(b_pull == Pull::Down);
}); });

View File

@ -851,7 +851,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
Outover::NORMAL Outover::NORMAL
}); });
}); });
pin.pad_ctrl().write(|w| w.set_ie(true)); pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_ie(true);
});
} }
if let Some(pin) = &rx { if let Some(pin) = &rx {
let funcsel = { let funcsel = {
@ -870,7 +874,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
Inover::NORMAL Inover::NORMAL
}); });
}); });
pin.pad_ctrl().write(|w| w.set_ie(true)); pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_ie(true);
});
} }
if let Some(pin) = &cts { if let Some(pin) = &cts {
pin.gpio().ctrl().write(|w| { pin.gpio().ctrl().write(|w| {
@ -881,7 +889,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
Inover::NORMAL Inover::NORMAL
}); });
}); });
pin.pad_ctrl().write(|w| w.set_ie(true)); pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_ie(true);
});
} }
if let Some(pin) = &rts { if let Some(pin) = &rts {
pin.gpio().ctrl().write(|w| { pin.gpio().ctrl().write(|w| {
@ -892,7 +904,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
Outover::NORMAL Outover::NORMAL
}); });
}); });
pin.pad_ctrl().write(|w| w.set_ie(true)); pin.pad_ctrl().write(|w| {
#[cfg(feature = "rp235x")]
w.set_iso(false);
w.set_ie(true);
});
} }
Self::set_baudrate_inner(config.baudrate); Self::set_baudrate_inner(config.baudrate);