aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-08 19:24:21 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-12-08 19:24:21 +0000
commitedfa9d2fae1d667b3f71a8e61aa954ac2233e493 (patch)
tree183b81b1028f3a3b14ffa2b736703033e9b6ab67 /os/hal/include
parentafc023a2222709732168314e7d695144cd30ed6c (diff)
downloadChibiOS-edfa9d2fae1d667b3f71a8e61aa954ac2233e493.tar.gz
ChibiOS-edfa9d2fae1d667b3f71a8e61aa954ac2233e493.tar.bz2
ChibiOS-edfa9d2fae1d667b3f71a8e61aa954ac2233e493.zip
I2C. Added timeout in functions. Code clean ups.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3583 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/i2c.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/os/hal/include/i2c.h b/os/hal/include/i2c.h
index f412e8a97..31dcb53d5 100644
--- a/os/hal/include/i2c.h
+++ b/os/hal/include/i2c.h
@@ -108,12 +108,12 @@ typedef enum {
*
* @notapi
*/
-#define _i2c_wait_s(i2cp) { \
+#define _i2c_wait_s(i2cp, timeout, rdymsg) { \
chDbgAssert((i2cp)->id_thread == NULL, \
"_i2c_wait(), #1", "already waiting"); \
chSysLock(); \
(i2cp)->id_thread = chThdSelf(); \
- chSchGoSleepS(THD_STATE_SUSPENDED); \
+ rdymsg = chSchGoSleepTimeoutS(THD_STATE_SUSPENDED, timeout); \
chSysUnlock(); \
}
@@ -181,14 +181,15 @@ extern "C" {
void i2cObjectInit(I2CDriver *i2cp);
void i2cStart(I2CDriver *i2cp, const I2CConfig *config);
void i2cStop(I2CDriver *i2cp);
- i2cflags_t i2cMasterTransmit(I2CDriver *i2cp,
+ msg_t i2cMasterTransmit(I2CDriver *i2cp,
uint8_t slave_addr,
uint8_t *txbuf, size_t txbytes,
- uint8_t *rxbuf, size_t rxbytes);
- i2cflags_t i2cMasterReceive(I2CDriver *i2cp,
- uint8_t slave_addr, uint8_t *rxbuf, size_t rxbytes);
- void i2cAddFlagsI(I2CDriver *i2cp, i2cflags_t mask);
- i2cflags_t i2cGetAndClearFlags(I2CDriver *i2cp);
+ uint8_t *rxbuf, size_t rxbytes,
+ i2cflags_t *errors, systime_t timeout);
+ msg_t i2cMasterReceive(I2CDriver *i2cp,
+ uint8_t slave_addr,
+ uint8_t *rxbuf, size_t rxbytes,
+ i2cflags_t *errors, systime_t timeout);
#if I2C_USE_MUTUAL_EXCLUSION
void i2cAcquireBus(I2CDriver *i2cp);