diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-12-30 20:45:56 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-12-30 20:45:56 +0000 |
commit | 2234fd3e31d4ce6e2b3990340b52719951e65731 (patch) | |
tree | 3d8dadab8ab98a46ab2f98ed0b94d648e86ce837 /os/hal/src | |
parent | 08feb80580ca82cfebd77a43d14d1197ec7c4f99 (diff) | |
download | ChibiOS-2234fd3e31d4ce6e2b3990340b52719951e65731.tar.gz ChibiOS-2234fd3e31d4ce6e2b3990340b52719951e65731.tar.bz2 ChibiOS-2234fd3e31d4ce6e2b3990340b52719951e65731.zip |
I2C. API changes mostly done.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3692 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/i2c.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 598719d24..f48ca9e7e 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -179,7 +179,7 @@ i2cflags_t i2cGetErrors(I2CDriver *i2cp) { */
msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp,
i2caddr_t addr,
- const uint8_t *txbuf,
+ uint8_t *txbuf,
size_t txbytes,
uint8_t *rxbuf,
size_t rxbytes,
@@ -202,7 +202,10 @@ msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp, rxbuf, rxbytes, timeout);
i2cp->id_state = I2C_READY;
chSysUnlock();
- return rdymsg;
+ if (i2cGetErrors(i2cp) != I2CD_NO_ERROR)
+ return RDY_RESET;
+ else
+ return rdymsg;
}
/**
@@ -228,7 +231,7 @@ msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp, * @api
*/
msg_t i2cMasterReceiveTimeout(I2CDriver *i2cp,
- i2caddr_t slave_addr,
+ i2caddr_t addr,
uint8_t *rxbuf,
size_t rxbytes,
systime_t timeout){
@@ -249,7 +252,10 @@ msg_t i2cMasterReceiveTimeout(I2CDriver *i2cp, rdymsg = i2c_lld_master_receive_timeout(i2cp, addr, rxbuf, rxbytes, timeout);
i2cp->id_state = I2C_READY;
chSysUnlock();
- return rdymsg;
+ if (i2cGetErrors(i2cp) != I2CD_NO_ERROR)
+ return RDY_RESET;
+ else
+ return rdymsg;
}
#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
|