aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_i2c.c')
-rw-r--r--os/hal/src/hal_i2c.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/os/hal/src/hal_i2c.c b/os/hal/src/hal_i2c.c
index 30e8809a1..54a362f0c 100644
--- a/os/hal/src/hal_i2c.c
+++ b/os/hal/src/hal_i2c.c
@@ -113,12 +113,16 @@ void i2cStart(I2CDriver *i2cp, const I2CConfig *config) {
void i2cStop(I2CDriver *i2cp) {
osalDbgCheck(i2cp != NULL);
+
+ osalSysLock();
+
osalDbgAssert((i2cp->state == I2C_STOP) || (i2cp->state == I2C_READY) ||
(i2cp->state == I2C_LOCKED), "invalid state");
- osalSysLock();
i2c_lld_stop(i2cp);
- i2cp->state = I2C_STOP;
+ i2cp->config = NULL;
+ i2cp->state = I2C_STOP;
+
osalSysUnlock();
}