From 02d65c01db18d4460e421242e4be82b25a723ad0 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 7 Jun 2016 13:10:04 +0000 Subject: Configuration cleanup on stop in the entire HAL. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9601 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal_i2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'os/hal/src/hal_i2c.c') 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(); } -- cgit v1.2.3