From 27f8924bed63be5782b3984cefa8df1d60da48b0 Mon Sep 17 00:00:00 2001 From: Michel Rottleuthner Date: Wed, 4 Jul 2018 11:06:22 +0200 Subject: [PATCH] drivers/bh1750fvi: adapt to new i2c API --- drivers/bh1750fvi/bh1750fvi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/bh1750fvi/bh1750fvi.c b/drivers/bh1750fvi/bh1750fvi.c index cba0f70c49..9b1608e9c4 100644 --- a/drivers/bh1750fvi/bh1750fvi.c +++ b/drivers/bh1750fvi/bh1750fvi.c @@ -38,10 +38,9 @@ int bh1750fvi_init(bh1750fvi_t *dev, bh1750fvi_params_t *params) /* initialize the I2C bus */ i2c_acquire(dev->i2c); - i2c_init_master(dev->i2c, params->clk); /* send a power down command to make sure we can speak to the device */ - res = i2c_write_byte(dev->i2c, dev->addr, OP_POWER_DOWN); + res = i2c_write_byte(dev->i2c, dev->addr, OP_POWER_DOWN, 0); i2c_release(dev->i2c); if (res < 0) { return BH1750FVI_ERR_I2C; @@ -57,8 +56,8 @@ uint16_t bh1750fvi_sample(const bh1750fvi_t *dev) /* power on the device and send single H-mode measurement command */ DEBUG("[bh1750fvi] sample: triggering a conversion\n"); i2c_acquire(dev->i2c); - i2c_write_byte(dev->i2c, dev->addr, OP_POWER_ON); - i2c_write_byte(dev->i2c, dev->addr, OP_SINGLE_HRES1); + i2c_write_byte(dev->i2c, dev->addr, OP_POWER_ON, 0); + i2c_write_byte(dev->i2c, dev->addr, OP_SINGLE_HRES1, 0); i2c_release(dev->i2c); /* wait for measurement to complete */ @@ -67,7 +66,7 @@ uint16_t bh1750fvi_sample(const bh1750fvi_t *dev) /* read the results */ DEBUG("[bh1750fvi] sample: reading the results\n"); i2c_acquire(dev->i2c); - i2c_read_bytes(dev->i2c, dev->addr, raw, 2); + i2c_read_bytes(dev->i2c, dev->addr, raw, 2, 0); i2c_release(dev->i2c); /* and finally we calculate the actual LUX value */