aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_pwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_pwm.c')
-rw-r--r--os/hal/src/hal_pwm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/os/hal/src/hal_pwm.c b/os/hal/src/hal_pwm.c
index e11011248..453606c19 100644
--- a/os/hal/src/hal_pwm.c
+++ b/os/hal/src/hal_pwm.c
@@ -113,11 +113,15 @@ void pwmStop(PWMDriver *pwmp) {
osalDbgCheck(pwmp != NULL);
osalSysLock();
+
osalDbgAssert((pwmp->state == PWM_STOP) || (pwmp->state == PWM_READY),
"invalid state");
+
pwm_lld_stop(pwmp);
pwmp->enabled = 0;
+ pwmp->config = NULL;
pwmp->state = PWM_STOP;
+
osalSysUnlock();
}