aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_adc.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_adc.c')
-rw-r--r--os/hal/src/hal_adc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/os/hal/src/hal_adc.c b/os/hal/src/hal_adc.c
index 0945ea9f2..222aaea4f 100644
--- a/os/hal/src/hal_adc.c
+++ b/os/hal/src/hal_adc.c
@@ -117,10 +117,14 @@ void adcStop(ADCDriver *adcp) {
osalDbgCheck(adcp != NULL);
osalSysLock();
+
osalDbgAssert((adcp->state == ADC_STOP) || (adcp->state == ADC_READY),
"invalid state");
+
adc_lld_stop(adcp);
- adcp->state = ADC_STOP;
+ adcp->config = NULL;
+ adcp->state = ADC_STOP;
+
osalSysUnlock();
}