diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-07-03 18:02:55 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-07-03 18:02:55 +0000 |
commit | ccb28114da9485c5e3f950fd31dfb67be1b8a173 (patch) | |
tree | a9645e52236f59fb69d4995ee9c121acaeb50808 /os/hal/src | |
parent | af0e40079ded13b8842e8d129fa6ed2f37fdf678 (diff) | |
download | ChibiOS-ccb28114da9485c5e3f950fd31dfb67be1b8a173.tar.gz ChibiOS-ccb28114da9485c5e3f950fd31dfb67be1b8a173.tar.bz2 ChibiOS-ccb28114da9485c5e3f950fd31dfb67be1b8a173.zip |
I2C. Driver looks working, but sometimes hangs up. I don't know, my big project cause troubles in it, or driver cause troubles in my project.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3116 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/i2c.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 3f4095aa3..93d00bcae 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -165,15 +165,18 @@ void i2cMasterTransmit(I2CDriver *i2cp, /* init slave config field in driver */
i2cp->id_slave_config = i2cscfg;
-//#if I2C_USE_WAIT
-// i2c_lld_wait_bus_free(i2cp);
-// if(i2c_lld_bus_is_busy(i2cp)) {
-//#ifdef PRINTTRACE
-// print("I2C Bus busy!\n");
-//#endif
-// return;
-// };
-//#endif
+#if I2C_USE_WAIT
+ 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, "i2cMasterTransmit(), #1", "time is out");
+#endif
+ };
+#endif
chSysLock();
chDbgAssert(i2cp->id_state == I2C_READY,
@@ -211,15 +214,18 @@ void i2cMasterReceive(I2CDriver *i2cp, /* init slave config field in driver */
i2cp->id_slave_config = i2cscfg;
-//#if I2C_USE_WAIT
-// i2c_lld_wait_bus_free(i2cp);
-// if(i2c_lld_bus_is_busy(i2cp)) {
-//#ifdef PRINTTRACE
-// print("I2C Bus busy!\n");
-//#endif
-// return;
-// };
-//#endif
+#if I2C_USE_WAIT
+ 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
chSysLock();
chDbgAssert(i2cp->id_state == I2C_READY,
|