diff options
| author | Caleb Jamison <[email protected]> | 2024-08-10 17:36:28 -0400 |
|---|---|---|
| committer | Caleb Jamison <[email protected]> | 2024-08-10 17:36:28 -0400 |
| commit | 9a863f07fe97f59c3e6a1d5aa125ed3b4094156f (patch) | |
| tree | 714401ff6d725fec92b334091fccaa013d7d73a1 | |
| parent | 168a9f9d8ab451ca724e68de777e4e1601f865dd (diff) | |
Handle pad isolation everywhere and in the same way.
| -rw-r--r-- | embassy-rp/src/adc.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/gpio.rs | 7 | ||||
| -rw-r--r-- | embassy-rp/src/i2c.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/pwm.rs | 2 | ||||
| -rw-r--r-- | embassy-rp/src/uart/mod.rs | 24 |
5 files changed, 28 insertions, 9 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index 12d08d06b..9768f480d 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs | |||
| @@ -35,6 +35,8 @@ impl<'p> Channel<'p> { | |||
| 35 | pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self { | 35 | pub fn new_pin(pin: impl Peripheral<P = impl AdcPin + 'p> + 'p, pull: Pull) -> Self { |
| 36 | into_ref!(pin); | 36 | into_ref!(pin); |
| 37 | pin.pad_ctrl().modify(|w| { | 37 | pin.pad_ctrl().modify(|w| { |
| 38 | #[cfg(feature = "rp235x")] | ||
| 39 | w.set_iso(false); | ||
| 38 | // manual says: | 40 | // manual says: |
| 39 | // | 41 | // |
| 40 | // > When using an ADC input shared with a GPIO pin, the pin’s | 42 | // > When using an ADC input shared with a GPIO pin, the pin’s |
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 8d6a8f2bd..24208b82e 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs | |||
| @@ -581,6 +581,8 @@ impl<'d> Flex<'d> { | |||
| 581 | into_ref!(pin); | 581 | into_ref!(pin); |
| 582 | 582 | ||
| 583 | pin.pad_ctrl().write(|w| { | 583 | pin.pad_ctrl().write(|w| { |
| 584 | #[cfg(feature = "rp235x")] | ||
| 585 | w.set_iso(false); | ||
| 584 | w.set_ie(true); | 586 | w.set_ie(true); |
| 585 | }); | 587 | }); |
| 586 | 588 | ||
| @@ -591,11 +593,6 @@ impl<'d> Flex<'d> { | |||
| 591 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _); | 593 | w.set_funcsel(pac::io::vals::Gpio0ctrlFuncsel::SIOB_PROC_0 as _); |
| 592 | }); | 594 | }); |
| 593 | 595 | ||
| 594 | #[cfg(feature = "rp235x")] | ||
| 595 | pin.pad_ctrl().modify(|w| { | ||
| 596 | w.set_iso(false); | ||
| 597 | }); | ||
| 598 | |||
| 599 | Self { pin: pin.map_into() } | 596 | Self { pin: pin.map_into() } |
| 600 | } | 597 | } |
| 601 | 598 | ||
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index d95b17ff1..82189d29a 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -363,6 +363,8 @@ where | |||
| 363 | { | 363 | { |
| 364 | pin.gpio().ctrl().write(|w| w.set_funcsel(3)); | 364 | pin.gpio().ctrl().write(|w| w.set_funcsel(3)); |
| 365 | pin.pad_ctrl().write(|w| { | 365 | pin.pad_ctrl().write(|w| { |
| 366 | #[cfg(feature = "rp235x")] | ||
| 367 | w.set_iso(false); | ||
| 366 | w.set_schmitt(true); | 368 | w.set_schmitt(true); |
| 367 | w.set_slewfast(false); | 369 | w.set_slewfast(false); |
| 368 | w.set_ie(true); | 370 | w.set_ie(true); |
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs index 3f96a3f05..b50337ad1 100644 --- a/embassy-rp/src/pwm.rs +++ b/embassy-rp/src/pwm.rs | |||
| @@ -110,6 +110,8 @@ impl<'d> Pwm<'d> { | |||
| 110 | if let Some(pin) = &b { | 110 | if let Some(pin) = &b { |
| 111 | pin.gpio().ctrl().write(|w| w.set_funcsel(4)); | 111 | pin.gpio().ctrl().write(|w| w.set_funcsel(4)); |
| 112 | pin.pad_ctrl().modify(|w| { | 112 | pin.pad_ctrl().modify(|w| { |
| 113 | #[cfg(feature = "rp235x")] | ||
| 114 | w.set_iso(false); | ||
| 113 | w.set_pue(b_pull == Pull::Up); | 115 | w.set_pue(b_pull == Pull::Up); |
| 114 | w.set_pde(b_pull == Pull::Down); | 116 | w.set_pde(b_pull == Pull::Down); |
| 115 | }); | 117 | }); |
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index 058cfcbee..9fc2ad89f 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs | |||
| @@ -851,7 +851,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> { | |||
| 851 | Outover::NORMAL | 851 | Outover::NORMAL |
| 852 | }); | 852 | }); |
| 853 | }); | 853 | }); |
| 854 | pin.pad_ctrl().write(|w| w.set_ie(true)); | 854 | pin.pad_ctrl().write(|w| { |
| 855 | #[cfg(feature = "rp235x")] | ||
| 856 | w.set_iso(false); | ||
| 857 | w.set_ie(true); | ||
| 858 | }); | ||
| 855 | } | 859 | } |
| 856 | if let Some(pin) = &rx { | 860 | if let Some(pin) = &rx { |
| 857 | let funcsel = { | 861 | let funcsel = { |
| @@ -870,7 +874,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> { | |||
| 870 | Inover::NORMAL | 874 | Inover::NORMAL |
| 871 | }); | 875 | }); |
| 872 | }); | 876 | }); |
| 873 | pin.pad_ctrl().write(|w| w.set_ie(true)); | 877 | pin.pad_ctrl().write(|w| { |
| 878 | #[cfg(feature = "rp235x")] | ||
| 879 | w.set_iso(false); | ||
| 880 | w.set_ie(true); | ||
| 881 | }); | ||
| 874 | } | 882 | } |
| 875 | if let Some(pin) = &cts { | 883 | if let Some(pin) = &cts { |
| 876 | pin.gpio().ctrl().write(|w| { | 884 | pin.gpio().ctrl().write(|w| { |
| @@ -881,7 +889,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> { | |||
| 881 | Inover::NORMAL | 889 | Inover::NORMAL |
| 882 | }); | 890 | }); |
| 883 | }); | 891 | }); |
| 884 | pin.pad_ctrl().write(|w| w.set_ie(true)); | 892 | pin.pad_ctrl().write(|w| { |
| 893 | #[cfg(feature = "rp235x")] | ||
| 894 | w.set_iso(false); | ||
| 895 | w.set_ie(true); | ||
| 896 | }); | ||
| 885 | } | 897 | } |
| 886 | if let Some(pin) = &rts { | 898 | if let Some(pin) = &rts { |
| 887 | pin.gpio().ctrl().write(|w| { | 899 | pin.gpio().ctrl().write(|w| { |
| @@ -892,7 +904,11 @@ impl<'d, T: Instance + 'd, M: Mode> Uart<'d, T, M> { | |||
| 892 | Outover::NORMAL | 904 | Outover::NORMAL |
| 893 | }); | 905 | }); |
| 894 | }); | 906 | }); |
| 895 | pin.pad_ctrl().write(|w| w.set_ie(true)); | 907 | pin.pad_ctrl().write(|w| { |
| 908 | #[cfg(feature = "rp235x")] | ||
| 909 | w.set_iso(false); | ||
| 910 | w.set_ie(true); | ||
| 911 | }); | ||
| 896 | } | 912 | } |
| 897 | 913 | ||
| 898 | Self::set_baudrate_inner(config.baudrate); | 914 | Self::set_baudrate_inner(config.baudrate); |
