aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/i2c.c
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-18 14:31:27 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-06-18 14:31:27 +0000
commit79f477ba95384ef082a7f2ec71e228e02e62e864 (patch)
tree14e183910332e525df1033a56f39155029662033 /os/hal/src/i2c.c
parentf3e571839bd7649073664d1c2c4ea3842695b6d5 (diff)
downloadChibiOS-79f477ba95384ef082a7f2ec71e228e02e62e864.tar.gz
ChibiOS-79f477ba95384ef082a7f2ec71e228e02e62e864.tar.bz2
ChibiOS-79f477ba95384ef082a7f2ec71e228e02e62e864.zip
I2C. "Slave_addr" and "nbit_addr" fields from I2CSlaveConfig structure merged together.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3057 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src/i2c.c')
-rw-r--r--os/hal/src/i2c.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c
index cd1a238ba..f31dcb7ba 100644
--- a/os/hal/src/i2c.c
+++ b/os/hal/src/i2c.c
@@ -139,17 +139,10 @@ void i2cStop(I2CDriver *i2cp) {
*/
void i2cMasterTransmit(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg) {
- size_t n;
- i2cblock_t *txbuf;
- uint8_t nbit_addr;
-
- txbuf = i2cscfg->txbuf;
- nbit_addr = i2cscfg->nbit_addr;
- n = i2cscfg->txbytes;
-
- chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) && \
- ((nbit_addr == 7) || (nbit_addr == 10)) && (n > 0) && (txbuf != NULL),
- "i2cMasterTransmit");
+ chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) &&\
+ (i2cscfg->txbytes > 0) &&\
+ (i2cscfg->txbuf != NULL),
+ "i2cMasterTransmit");
// init slave config field in driver
i2cp->id_slave_config = i2cscfg;
@@ -188,17 +181,10 @@ void i2cMasterTransmit(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg) {
*/
void i2cMasterReceive(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg){
- size_t n;
- i2cblock_t *rxbuf;
- uint8_t nbit_addr;
-
- rxbuf = i2cscfg->rxbuf;
- n = i2cscfg->rxbytes;
- nbit_addr = i2cscfg->nbit_addr;
-
- chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) && (n > 0) && \
- ((nbit_addr == 7) || (nbit_addr == 10)) && (rxbuf != NULL),
- "i2cMasterReceive");
+ chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) &&\
+ (i2cscfg->rxbytes > 0) && \
+ (i2cscfg->rxbuf != NULL),
+ "i2cMasterReceive");
// init slave config field in driver
i2cp->id_slave_config = i2cscfg;