clean the SAADC's register while dropping

This commit is contained in:
drindr 2025-03-23 00:01:01 +08:00
parent 4033a619a8
commit 816aa9a06c

View File

@ -465,6 +465,10 @@ impl<'d, const N: usize> Drop for Saadc<'d, N> {
fn drop(&mut self) {
let r = Self::regs();
r.enable().write(|w| w.set_enable(false));
for i in 0..N {
r.ch(i).pselp().write(|w| w.set_pselp(InputChannel::NC));
r.ch(i).pseln().write(|w| w.set_pseln(InputChannel::NC));
}
}
}