aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-09 10:22:41 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-09 10:22:41 +0000
commit28cb4b4849c6e124baed09bdb4753d7b87a47483 (patch)
tree3bb38b043d1e4c677ebcfd5b5fbe5182b3c1ca5f /os/hal
parent8196de6aef7616f7df96d757dddc9cfa9eb661dc (diff)
downloadChibiOS-28cb4b4849c6e124baed09bdb4753d7b87a47483.tar.gz
ChibiOS-28cb4b4849c6e124baed09bdb4753d7b87a47483.tar.bz2
ChibiOS-28cb4b4849c6e124baed09bdb4753d7b87a47483.zip
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
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/src/i2c.c4
1 files changed, 4 insertions, 0 deletions
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");