diff --git a/drivers/isl29125/isl29125.c b/drivers/isl29125/isl29125.c index 3024cf4e0e..b8753c3501 100644 --- a/drivers/isl29125/isl29125.c +++ b/drivers/isl29125/isl29125.c @@ -62,15 +62,11 @@ int isl29125_init(isl29125_t *dev, const isl29125_params_t *params) DEBUG("isl29125_init: i2c_acquire\n"); (void) i2c_acquire(DEV_I2C); - /* initialize the I2C bus */ - DEBUG("isl29125_init: i2c_init_master\n"); - (void) i2c_init_master(DEV_I2C, I2C_SPEED_NORMAL); - /* verify the device ID */ DEBUG("isl29125_init: i2c_read_reg\n"); uint8_t reg_id; - int ret = i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_ID, ®_id); - if ((reg_id == ISL29125_ID) && (ret == 1)) { + int ret = i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_ID, ®_id, 0); + if ((reg_id == ISL29125_ID) && (ret == 0)) { DEBUG("isl29125_init: ID successfully verified\n"); } else { @@ -81,10 +77,10 @@ int isl29125_init(isl29125_t *dev, const isl29125_params_t *params) /* configure and enable the sensor */ DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_RESET)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_RESET, ISL29125_CMD_RESET); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_RESET, ISL29125_CMD_RESET, 0); DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_CONF1)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, conf1); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, conf1, 0); /* release the I2C bus */ DEBUG("isl29125_init: i2c_release\n"); @@ -127,19 +123,19 @@ int isl29125_init_int(isl29125_t *dev, isl29125_interrupt_status_t interrupt_sta } DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_CONF3)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF3, conf3); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF3, conf3, 0); DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_LTHLB)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_LTHLB, lthlb); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_LTHLB, lthlb, 0); DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_LTHHB)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_LTHHB, lthhb); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_LTHHB, lthhb, 0); DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_HTHLB)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_HTHLB, hthlb); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_HTHLB, hthlb, 0); DEBUG("isl29125_init: i2c_write_reg(ISL29125_REG_HTHHB)\n"); - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_HTHHB, hthhb); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_HTHHB, hthhb, 0); if (gpio_init_int(DEV_GPIO, GPIO_IN, GPIO_FALLING, cb, arg) < 0) { DEBUG("error: gpio_init_int failed\n"); @@ -156,7 +152,7 @@ void isl29125_read_rgb_lux(const isl29125_t *dev, isl29125_rgb_t *dest) /* read values */ uint8_t bytes[6]; - (void) i2c_read_regs(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_GDLB, bytes, 6); + (void) i2c_read_regs(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_GDLB, bytes, 6, 0); /* release the I2C bus */ (void) i2c_release(DEV_I2C); @@ -184,7 +180,7 @@ void isl29125_read_rgb_color(const isl29125_t *dev, color_rgb_t *dest) /* read values */ uint8_t bytes[6]; - (void) i2c_read_regs(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_GDLB, bytes, 6); + (void) i2c_read_regs(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_GDLB, bytes, 6, 0); /* release the I2C bus */ (void) i2c_release(DEV_I2C); @@ -203,10 +199,10 @@ void isl29125_set_mode(const isl29125_t *dev, isl29125_mode_t mode) (void) i2c_acquire(DEV_I2C); - (void) i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, &conf1); + (void) i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, &conf1, 0); conf1 &= ~ISL29125_CON1_MASK_MODE; conf1 |= mode; - (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, conf1); + (void) i2c_write_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_CONF1, conf1, 0); (void) i2c_release(DEV_I2C); } @@ -218,7 +214,7 @@ int isl29125_read_irq_status(const isl29125_t *dev) /* read status register */ uint8_t irq_status; - (void) i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_STATUS, &irq_status); + (void) i2c_read_reg(DEV_I2C, ISL29125_I2C_ADDRESS, ISL29125_REG_STATUS, &irq_status, 0); /* release the I2C bus */ (void) i2c_release(DEV_I2C); diff --git a/tests/driver_isl29125/Makefile b/tests/driver_isl29125/Makefile index 4232a3ef81..54a23309ec 100644 --- a/tests/driver_isl29125/Makefile +++ b/tests/driver_isl29125/Makefile @@ -8,12 +8,4 @@ FEATURES_REQUIRED = periph_i2c USEMODULE += isl29125 USEMODULE += xtimer -# set default device parameters in case they are undefined -TEST_ISL29125_I2C ?= I2C_DEV\(0\) -TEST_ISL29125_IRQ_PIN ?= GPIO_PIN\(0,0\) - -# export parameters -CFLAGS += -DTEST_ISL29125_I2C=$(TEST_ISL29125_I2C) -CFLAGS += -DTEST_ISL29125_IRQ_PIN=$(TEST_ISL29125_IRQ_PIN) - include $(RIOTBASE)/Makefile.include