From f73960c8dcbcc2f4f4b4aba8599a45485038ec82 Mon Sep 17 00:00:00 2001 From: barthess Date: Thu, 30 Jun 2011 13:43:42 +0000 Subject: I2C. API changed. Transmit and receive buffers removed from I2CSlaveConfig. Now pointers to that buffers pass in functions arguments. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/i2c_dev@3099 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/i2c.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 490ecf656..dca7c6125 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -141,19 +141,23 @@ void i2cStop(I2CDriver *i2cp) { * device address. Bit 15 must be set to 1 if 10-bit * addressing modes used. Otherwise keep it cleared. * Bits 10-14 unused. - * @param[in] txbytes number of bytes to be transmited + * @param[in] txbytes number of bytes to be transmitted + * @param[in] txbuf pointer to transmit buffer * @param[in] rxbytes number of bytes to be received + * @param[in] rxbuf pointer to receive buffer */ void i2cMasterTransmit(I2CDriver *i2cp, const I2CSlaveConfig *i2cscfg, uint16_t slave_addr, + uint8_t *txbuf, size_t txbytes, + uint8_t *rxbuf, size_t rxbytes) { chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) &&\ (slave_addr != 0) &&\ (txbytes > 0) &&\ - (i2cscfg->txbuf != NULL), + (txbuf != NULL), "i2cMasterTransmit"); /* init slave config field in driver */ @@ -174,7 +178,7 @@ void i2cMasterTransmit(I2CDriver *i2cp, "i2cMasterTransmit(), #1", "not ready"); i2cp->id_state = I2C_ACTIVE; - i2c_lld_master_transmit(i2cp, slave_addr, txbytes, rxbytes); + i2c_lld_master_transmit(i2cp, slave_addr, txbuf, txbytes, rxbuf, rxbytes); _i2c_wait_s(i2cp); #if !I2C_USE_WAIT i2c_lld_wait_bus_free(i2cp); @@ -198,12 +202,13 @@ void i2cMasterTransmit(I2CDriver *i2cp, void i2cMasterReceive(I2CDriver *i2cp, const I2CSlaveConfig *i2cscfg, uint16_t slave_addr, + uint8_t *rxbuf, size_t rxbytes){ chDbgCheck((i2cp != NULL) && (i2cscfg != NULL) &&\ (slave_addr != 0) &&\ (rxbytes > 0) && \ - (i2cscfg->rxbuf != NULL), + (rxbuf != NULL), "i2cMasterReceive"); /* init slave config field in driver */ @@ -224,7 +229,7 @@ void i2cMasterReceive(I2CDriver *i2cp, "i2cMasterReceive(), #1", "not ready"); i2cp->id_state = I2C_ACTIVE; - i2c_lld_master_receive(i2cp, slave_addr, rxbytes); + i2c_lld_master_receive(i2cp, slave_addr, rxbuf, rxbytes); _i2c_wait_s(i2cp); #if !I2C_USE_WAIT i2c_lld_wait_bus_free(i2cp); -- cgit v1.2.3