This commit is contained in:
Henrik Alsér 2022-11-15 16:31:19 +01:00
parent eb149a0bd4
commit 9f870a5edf

View File

@ -120,14 +120,9 @@ impl<'d> Adc<'d> {
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>>(&mut self, _pin: &mut PIN) -> u16 {
let r = Self::regs(); let r = Self::regs();
let ch = PIN::channel();
unsafe { unsafe {
if ch == 4 {
r.cs().modify(|w| w.set_ts_en(true))
}
while !r.cs().read().ready() {}
r.cs().modify(|w| { r.cs().modify(|w| {
w.set_ainsel(ch); w.set_ainsel(PIN::channel());
w.set_start_once(true) w.set_start_once(true)
}); });
while !r.cs().read().ready() {} while !r.cs().read().ready() {}