From 23c51a18741c4c500c46955b5cd028ec0eb7d53a Mon Sep 17 00:00:00 2001 From: Dietrich Beck Date: Thu, 22 Jun 2023 23:02:16 +0200 Subject: [PATCH] disable pull-up and down resistors for rp adc blocking_read --- embassy-rp/src/adc.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index b96d5a4a..699a0d61 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs @@ -112,8 +112,14 @@ impl<'d> Adc<'d> { r.result().read().result().into() } - pub fn blocking_read, ID = u8>>(&mut self, _pin: &mut PIN) -> u16 { + pub fn blocking_read, ID = u8> + Pin>(&mut self, pin: &mut PIN) -> u16 { let r = Self::regs(); + pin.pad_ctrl().modify(|w| { + w.set_ie(true); + let (pu, pd) = (false, false); + w.set_pue(pu); + w.set_pde(pd); + }); r.cs().modify(|w| { w.set_ainsel(PIN::channel()); w.set_start_once(true) @@ -166,7 +172,7 @@ impl_pin!(PIN_29, 3); impl OneShot, WORD, PIN> for Adc<'static> where WORD: From, - PIN: Channel, ID = u8>, + PIN: Channel, ID = u8> + Pin, { type Error = (); fn read(&mut self, pin: &mut PIN) -> nb::Result {