diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-23 10:17:40 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-23 10:17:40 +0000 |
| commit | 4dd48099bee305fc31e47a586f34d09c3ec02673 (patch) | |
| tree | dfb8c94adc8904f1a8da0438bd2a5cde76871e5c | |
| parent | 6f17286c7525050a3acfdbb889915730913518b0 (diff) | |
| parent | 23c51a18741c4c500c46955b5cd028ec0eb7d53a (diff) | |
Merge pull request #1577 from dbdbc/main
disable pull-up and down resistors for rp adc blocking_read
| -rw-r--r-- | embassy-rp/src/adc.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index b96d5a4a8..699a0d61d 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs | |||
| @@ -112,8 +112,14 @@ impl<'d> Adc<'d> { | |||
| 112 | r.result().read().result().into() | 112 | r.result().read().result().into() |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | pub fn blocking_read<PIN: Channel<Adc<'d>, ID = u8>>(&mut self, _pin: &mut PIN) -> u16 { | 115 | pub fn blocking_read<PIN: Channel<Adc<'d>, ID = u8> + Pin>(&mut self, pin: &mut PIN) -> u16 { |
| 116 | let r = Self::regs(); | 116 | let r = Self::regs(); |
| 117 | pin.pad_ctrl().modify(|w| { | ||
| 118 | w.set_ie(true); | ||
| 119 | let (pu, pd) = (false, false); | ||
| 120 | w.set_pue(pu); | ||
| 121 | w.set_pde(pd); | ||
| 122 | }); | ||
| 117 | r.cs().modify(|w| { | 123 | r.cs().modify(|w| { |
| 118 | w.set_ainsel(PIN::channel()); | 124 | w.set_ainsel(PIN::channel()); |
| 119 | w.set_start_once(true) | 125 | w.set_start_once(true) |
| @@ -166,7 +172,7 @@ impl_pin!(PIN_29, 3); | |||
| 166 | impl<WORD, PIN> OneShot<Adc<'static>, WORD, PIN> for Adc<'static> | 172 | impl<WORD, PIN> OneShot<Adc<'static>, WORD, PIN> for Adc<'static> |
| 167 | where | 173 | where |
| 168 | WORD: From<u16>, | 174 | WORD: From<u16>, |
| 169 | PIN: Channel<Adc<'static>, ID = u8>, | 175 | PIN: Channel<Adc<'static>, ID = u8> + Pin, |
| 170 | { | 176 | { |
| 171 | type Error = (); | 177 | type Error = (); |
| 172 | fn read(&mut self, pin: &mut PIN) -> nb::Result<WORD, Self::Error> { | 178 | fn read(&mut self, pin: &mut PIN) -> nb::Result<WORD, Self::Error> { |
