aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/adc.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/adc.c')
-rw-r--r--os/hal/src/adc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c
index 4843ca90b..c375818a6 100644
--- a/os/hal/src/adc.c
+++ b/os/hal/src/adc.c
@@ -32,6 +32,10 @@
#if HAL_USE_ADC || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
@@ -176,13 +180,14 @@ void adcStartConversionI(ADCDriver *adcp,
adcsample_t *samples,
size_t depth) {
+ chDbgCheckClassI();
chDbgCheck((adcp != NULL) && (grpp != NULL) && (samples != NULL) &&
((depth == 1) || ((depth & 1) == 0)),
"adcStartConversionI");
-
chDbgAssert((adcp->state == ADC_READY) ||
(adcp->state == ADC_COMPLETE),
"adcStartConversionI(), #1", "not ready");
+
adcp->samples = samples;
adcp->depth = depth;
adcp->grpp = grpp;
@@ -229,12 +234,13 @@ void adcStopConversion(ADCDriver *adcp) {
*/
void adcStopConversionI(ADCDriver *adcp) {
+ chDbgCheckClassI();
chDbgCheck(adcp != NULL, "adcStopConversionI");
-
chDbgAssert((adcp->state == ADC_READY) ||
(adcp->state == ADC_ACTIVE) ||
(adcp->state == ADC_COMPLETE),
"adcStopConversionI(), #1", "invalid state");
+
if (adcp->state != ADC_READY) {
adc_lld_stop_conversion(adcp);
adcp->grpp = NULL;