disable pull-up and down resistors for rp adc blocking_read

This commit is contained in:
Dietrich Beck 2023-06-22 23:02:16 +02:00
parent 70907d84f1
commit 23c51a1874

View file

@ -112,8 +112,14 @@ impl<'d> Adc<'d> {
r.result().read().result().into() r.result().read().result().into()
} }
pub fn blocking_read<PIN: Channel<Adc<'d>, ID = u8>>(&mut self, _pin: &mut PIN) -> u16 { pub fn blocking_read<PIN: Channel<Adc<'d>, ID = u8> + Pin>(&mut self, pin: &mut PIN) -> u16 {
let r = Self::regs(); 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| { r.cs().modify(|w| {
w.set_ainsel(PIN::channel()); w.set_ainsel(PIN::channel());
w.set_start_once(true) w.set_start_once(true)
@ -166,7 +172,7 @@ impl_pin!(PIN_29, 3);
impl<WORD, PIN> OneShot<Adc<'static>, WORD, PIN> for Adc<'static> impl<WORD, PIN> OneShot<Adc<'static>, WORD, PIN> for Adc<'static>
where where
WORD: From<u16>, WORD: From<u16>,
PIN: Channel<Adc<'static>, ID = u8>, PIN: Channel<Adc<'static>, ID = u8> + Pin,
{ {
type Error = (); type Error = ();
fn read(&mut self, pin: &mut PIN) -> nb::Result<WORD, Self::Error> { fn read(&mut self, pin: &mut PIN) -> nb::Result<WORD, Self::Error> {