aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/adc.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index dfa1b877a..95780c068 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -81,6 +81,16 @@ pub struct Adc<'d, M: Mode> {
81 phantom: PhantomData<(&'d ADC, M)>, 81 phantom: PhantomData<(&'d ADC, M)>,
82} 82}
83 83
84impl<'d, M: Mode> Drop for Adc<'d, M> {
85 fn drop(&mut self) {
86 let r = Self::regs();
87 // disable ADC. leaving it enabled comes with a ~150µA static
88 // current draw. the temperature sensor has already been disabled
89 // by the temperature-reading methods, so we don't need to touch that.
90 r.cs().write(|w| w.set_en(false));
91 }
92}
93
84impl<'d, M: Mode> Adc<'d, M> { 94impl<'d, M: Mode> Adc<'d, M> {
85 #[inline] 95 #[inline]
86 fn regs() -> pac::adc::Adc { 96 fn regs() -> pac::adc::Adc {