aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/I2C/tmp75.c
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-07-03 18:02:55 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-07-03 18:02:55 +0000
commitccb28114da9485c5e3f950fd31dfb67be1b8a173 (patch)
treea9645e52236f59fb69d4995ee9c121acaeb50808 /testhal/STM32/I2C/tmp75.c
parentaf0e40079ded13b8842e8d129fa6ed2f37fdf678 (diff)
downloadChibiOS-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 'testhal/STM32/I2C/tmp75.c')
-rw-r--r--testhal/STM32/I2C/tmp75.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/testhal/STM32/I2C/tmp75.c b/testhal/STM32/I2C/tmp75.c
index 0833e47c1..6276e7c8e 100644
--- a/testhal/STM32/I2C/tmp75.c
+++ b/testhal/STM32/I2C/tmp75.c
@@ -14,7 +14,6 @@
/* input buffer */
static i2cblock_t tmp75_rx_data[TMP75_RX_DEPTH];
-static i2cblock_t tmp75_tx_data[TMP75_TX_DEPTH];
/* temperature value */
static int16_t temperature = 0;
@@ -29,16 +28,15 @@ static void i2c_tmp75_error_cb(I2CDriver *i2cp, const I2CSlaveConfig *i2cscfg){
/* This callback raise up when transfer finished */
static void i2c_tmp75_cb(I2CDriver *i2cp, const I2CSlaveConfig *i2cscfg){
(void)*i2cp;
+ (void)*i2cscfg;
/* store temperature value */
- temperature = (i2cscfg->rxbuf[0] << 8) + i2cscfg->rxbuf[1];
+ temperature = (tmp75_rx_data[0] << 8) + tmp75_rx_data[1];
}
/* Fill TMP75 config. */
static const I2CSlaveConfig tmp75 = {
i2c_tmp75_cb,
i2c_tmp75_error_cb,
- tmp75_rx_data,
- tmp75_tx_data,
};
#define tmp75_addr 0b1001000
@@ -49,7 +47,7 @@ void request_temperature(void){
#define RXBYTES 2 /* we need to read 2 bytes */
i2cAcquireBus(&I2CD2);
- i2cMasterReceive(&I2CD2, &tmp75, tmp75_addr, RXBYTES);
+ i2cMasterReceive(&I2CD2, &tmp75, tmp75_addr, tmp75_rx_data, RXBYTES);
i2cReleaseBus(&I2CD2);
}