mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Handle pad isolation everywhere and in the same way.
This commit is contained in:
parent
168a9f9d8a
commit
9a863f07fe
@ -35,6 +35,8 @@ impl<'p> Channel<'p> {
|
||||
pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self {
|
||||
into_ref!(pin);
|
||||
pin.pad_ctrl().modify(|w| {
|
||||
#[cfg(feature = "rp235x")]
|
||||
w.set_iso(false);
|
||||
// manual says:
|
||||
//
|
||||
// > When using an ADC input shared with a GPIO pin, the pin’s
|
||||
|
@ -581,6 +581,8 @@ impl<'d> Flex<'d> {
|
||||
into_ref!(pin);
|
||||
|
||||
pin.pad_ctrl().write(|w| {
|
||||
#[cfg(feature = "rp235x")]
|
||||
w.set_iso(false);
|
||||
w.set_ie(true);
|
||||
});
|
||||
|
||||
@ -591,11 +593,6 @@ impl<'d> Flex<'d> {
|
||||
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() }
|
||||
}
|
||||
|
||||
|
@ -363,6 +363,8 @@ where
|
||||
{
|
||||
pin.gpio().ctrl().write(|w| w.set_funcsel(3));
|
||||
pin.pad_ctrl().write(|w| {
|
||||
#[cfg(feature = "rp235x")]
|
||||
w.set_iso(false);
|
||||
w.set_schmitt(true);
|
||||
w.set_slewfast(false);
|
||||
w.set_ie(true);
|
||||
|
@ -110,6 +110,8 @@ impl<'d> Pwm<'d> {
|
||||
if let Some(pin) = &b {
|
||||
pin.gpio().ctrl().write(|w| w.set_funcsel(4));
|
||||
pin.pad_ctrl().modify(|w| {
|
||||
#[cfg(feature = "rp235x")]
|
||||
w.set_iso(false);
|
||||
w.set_pue(b_pull == Pull::Up);
|
||||
w.set_pde(b_pull == Pull::Down);
|
||||
});
|
||||
|
@ -851,7 +851,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
|
||||
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 {
|
||||
let funcsel = {
|
||||
@ -870,7 +874,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
|
||||
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 {
|
||||
pin.gpio().ctrl().write(|w| {
|
||||
@ -881,7 +889,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
|
||||
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 {
|
||||
pin.gpio().ctrl().write(|w| {
|
||||
@ -892,7 +904,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user