drivers: led: i2c: replace use of i2c_burst_write
i2c_burst_write is not portable, as it is not supported by some drivers, replace its use with i2c_write. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
committed by
Henrik Brix Andersen
parent
3d6000e070
commit
d49a55265e
@@ -121,7 +121,13 @@ static int ncp5623_led_init(const struct device *dev)
|
||||
const struct ncp5623_config *config = dev->config;
|
||||
const struct led_info *led_info = NULL;
|
||||
int i;
|
||||
uint8_t buf[6] = {0x70, NCP5623_LED_PWM0, 0x70, NCP5623_LED_PWM1, 0x70, NCP5623_LED_PWM2};
|
||||
uint8_t buf[7] = {NCP5623_LED_CURRENT | NCP5623_MAX_BRIGHTNESS,
|
||||
0x70,
|
||||
NCP5623_LED_PWM0,
|
||||
0x70,
|
||||
NCP5623_LED_PWM1,
|
||||
0x70,
|
||||
NCP5623_LED_PWM2};
|
||||
|
||||
if (!i2c_is_ready_dt(&config->bus)) {
|
||||
LOG_ERR("%s: I2C device not ready", dev->name);
|
||||
@@ -161,8 +167,7 @@ static int ncp5623_led_init(const struct device *dev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (i2c_burst_write_dt(&config->bus, NCP5623_LED_CURRENT | NCP5623_MAX_BRIGHTNESS, buf,
|
||||
6)) {
|
||||
if (i2c_write_dt(&config->bus, buf, sizeof(buf))) {
|
||||
LOG_ERR("%s: LED write failed", dev->name);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user