drivers/hih6130: adapt to new i2c API
This commit is contained in:
parent
034d7f0b8f
commit
3994c51b31
@ -60,7 +60,7 @@ static inline int hih6130_measurement_request(const hih6130_t *dev)
|
|||||||
i2c_acquire(dev->i2c);
|
i2c_acquire(dev->i2c);
|
||||||
|
|
||||||
/* An empty write request triggers a new measurement */
|
/* An empty write request triggers a new measurement */
|
||||||
if (i2c_write_bytes(dev->i2c, dev->addr, NULL, 0) < 0) {
|
if (i2c_write_bytes(dev->i2c, dev->addr, NULL, 0, 0) < 0) {
|
||||||
i2c_release(dev->i2c);
|
i2c_release(dev->i2c);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ static inline int hih6130_get_humidity_temperature_raw(const hih6130_t *dev, uin
|
|||||||
|
|
||||||
i2c_acquire(dev->i2c);
|
i2c_acquire(dev->i2c);
|
||||||
|
|
||||||
if (i2c_read_bytes(dev->i2c, dev->addr, &buf[0], sizeof(buf)) != sizeof(buf)) {
|
if (i2c_read_bytes(dev->i2c, dev->addr, &buf[0], sizeof(buf), 0) < 0) {
|
||||||
i2c_release(dev->i2c);
|
i2c_release(dev->i2c);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,12 +39,6 @@ int main(void)
|
|||||||
hih6130_t dev;
|
hih6130_t dev;
|
||||||
|
|
||||||
puts("HIH6130 sensor driver test application\n");
|
puts("HIH6130 sensor driver test application\n");
|
||||||
printf("Initializing I2C_%i... ", TEST_HIH6130_I2C);
|
|
||||||
if (i2c_init_master(TEST_HIH6130_I2C, I2C_SPEED_FAST) < 0) {
|
|
||||||
puts("[Failed]");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
puts("[OK]");
|
|
||||||
|
|
||||||
printf("Initializing HIH6130 sensor at I2C_%i, address 0x%02x... ",
|
printf("Initializing HIH6130 sensor at I2C_%i, address 0x%02x... ",
|
||||||
TEST_HIH6130_I2C, TEST_HIH6130_ADDR);
|
TEST_HIH6130_I2C, TEST_HIH6130_ADDR);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user