From 28cb4b4849c6e124baed09bdb4753d7b87a47483 Mon Sep 17 00:00:00 2001 From: barthess Date: Fri, 9 Dec 2011 10:22:41 +0000 Subject: I2C. Added forgotten check of BUSY flag. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3587 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/i2c.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'os/hal/src/i2c.c') diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index f7f7c335e..c67f3a8c6 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -168,6 +168,8 @@ msg_t i2cMasterTransmit(I2CDriver *i2cp, ((rxbytes == 0) || ((rxbytes > 0) && (rxbuf != NULL))) && (timeout > TIME_IMMEDIATE) && (errors != NULL), "i2cMasterTransmit"); + + i2c_lld_wait_bus_free(i2cp); i2cp->errors = I2CD_NO_ERROR; /* clear error flags from previous run */ chDbgAssert(i2cp->id_state == I2C_READY, "i2cMasterTransmit(), #1", "not ready"); @@ -209,6 +211,8 @@ msg_t i2cMasterReceive(I2CDriver *i2cp, (rxbytes > 0) && (rxbuf != NULL) && (timeout > TIME_IMMEDIATE) && (errors != NULL), "i2cMasterReceive"); + + i2c_lld_wait_bus_free(i2cp); i2cp->errors = I2CD_NO_ERROR; /* clear error flags from previous run */ chDbgAssert(i2cp->id_state == I2C_READY, "i2cMasterReceive(), #1", "not ready"); -- cgit v1.2.3