diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-07-04 14:27:00 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-07-04 14:27:00 +0000 |
commit | 03acd18161901b17be78e280ebbebbc0bbd47c8f (patch) | |
tree | dd81973423b5d9b7de62b2c5eabb1d62c35a49bf /os/hal/src | |
parent | ccb28114da9485c5e3f950fd31dfb67be1b8a173 (diff) | |
download | ChibiOS-03acd18161901b17be78e280ebbebbc0bbd47c8f.tar.gz ChibiOS-03acd18161901b17be78e280ebbebbc0bbd47c8f.tar.bz2 ChibiOS-03acd18161901b17be78e280ebbebbc0bbd47c8f.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3117 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/i2c.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 93d00bcae..4aade6fe9 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -165,18 +165,18 @@ void i2cMasterTransmit(I2CDriver *i2cp, /* init slave config field in driver */
i2cp->id_slave_config = i2cscfg;
-#if I2C_USE_WAIT
+#if CH_DBG_ENABLE_ASSERTS
i2c_lld_wait_bus_free(i2cp);
- if(i2c_lld_bus_is_busy(i2cp)) {
+ if(i2c_lld_bus_is_busy(i2cp)) { /* Probably slave locks up and need reset. */
#ifdef PRINTTRACE
print("I2C Bus busy!\n");
return;
#else
- /* the time is out */
+ /* the time is out. Probably slave locks up. */
chDbgAssert(FALSE, "i2cMasterTransmit(), #1", "time is out");
-#endif
+#endif /* PRINTTRACE */
};
-#endif
+#endif /* CH_DBG_ENABLE_ASSERTS */
chSysLock();
chDbgAssert(i2cp->id_state == I2C_READY,
@@ -214,18 +214,17 @@ void i2cMasterReceive(I2CDriver *i2cp, /* init slave config field in driver */
i2cp->id_slave_config = i2cscfg;
-#if I2C_USE_WAIT
+#if CH_DBG_ENABLE_ASSERTS
i2c_lld_wait_bus_free(i2cp);
if(i2c_lld_bus_is_busy(i2cp)) {
#ifdef PRINTTRACE
print("I2C Bus busy!\n");
return;
#else
- /* the time is out */
chDbgAssert(FALSE, "i2cMasterReceive(), #1", "time is out");
-#endif
+#endif /* PRINTTRACE */
};
-#endif
+#endif /* CH_DBG_ENABLE_ASSERTS */
chSysLock();
chDbgAssert(i2cp->id_state == I2C_READY,
|