aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/I2C/tmp75.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/I2C/tmp75.c')
-rw-r--r--testhal/STM32/I2C/tmp75.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/testhal/STM32/I2C/tmp75.c b/testhal/STM32/I2C/tmp75.c
index e5f502e23..6744fe325 100644
--- a/testhal/STM32/I2C/tmp75.c
+++ b/testhal/STM32/I2C/tmp75.c
@@ -34,22 +34,23 @@ static void i2c_tmp75_cb(I2CDriver *i2cp, I2CSlaveConfig *i2cscfg){
}
// Fill TMP75 config.
-static I2CSlaveConfig tmp75 = {
+static const I2CSlaveConfig tmp75 = {
i2c_tmp75_cb,
i2c_tmp75_error_cb,
tmp75_rx_data,
tmp75_tx_data,
- 0b1001000,
{NULL},
};
+#define tmp75_addr 0b1001000
+
/* This is main function. */
void request_temperature(void){
#define TXBYTES 0 // set to zero because we need only reading
#define RXBYTES 2 // we need to read 2 bytes
i2cAcquireBus(&I2CD2);
- i2cMasterReceive(&I2CD2, &tmp75, RXBYTES);
+ i2cMasterReceive(&I2CD2, &tmp75, tmp75_addr, RXBYTES);
i2cReleaseBus(&I2CD2);
}