diff options
| author | xoviat <[email protected]> | 2023-09-27 20:58:46 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-09-27 20:58:46 -0500 |
| commit | 79146c4bd5cdbd8337d0dbdfd93219b9cb330c47 (patch) | |
| tree | e10d53df45b95db09e1d74d19a3abd269b736f69 /embassy-stm32/src/adc/f3.rs | |
| parent | 20ea76c19c709abf652b9a044292eb26fd656223 (diff) | |
stm32/adc: cleanup f1, f3, v1, and v2
Diffstat (limited to 'embassy-stm32/src/adc/f3.rs')
| -rw-r--r-- | embassy-stm32/src/adc/f3.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/embassy-stm32/src/adc/f3.rs b/embassy-stm32/src/adc/f3.rs index 5d2ea1daa..7c13f8106 100644 --- a/embassy-stm32/src/adc/f3.rs +++ b/embassy-stm32/src/adc/f3.rs | |||
| @@ -173,3 +173,23 @@ impl<'d, T: Instance> Adc<'d, T> { | |||
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | |||
| 177 | impl<'d, T: Instance> Drop for Adc<'d, T> { | ||
| 178 | fn drop(&mut self) { | ||
| 179 | use crate::pac::adc::vals; | ||
| 180 | |||
| 181 | T::regs().cr().modify(|w| w.set_adstp(true)); | ||
| 182 | |||
| 183 | while T::regs().cr().read().adstp() {} | ||
| 184 | |||
| 185 | T::regs().cr().modify(|w| w.set_addis(true)); | ||
| 186 | |||
| 187 | while T::regs().cr().read().aden() {} | ||
| 188 | |||
| 189 | // Disable the adc regulator | ||
| 190 | T::regs().cr().modify(|w| w.set_advregen(vals::Advregen::INTERMEDIATE)); | ||
| 191 | T::regs().cr().modify(|w| w.set_advregen(vals::Advregen::DISABLED)); | ||
| 192 | |||
| 193 | T::disable(); | ||
| 194 | } | ||
| 195 | } | ||
