From d172847da58d52caca92866308b47b418c57aa2b Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Mon, 7 Oct 2024 20:58:42 +0200 Subject: [PATCH] drivers: sensor: adi: ltc2990 init trigger measurement This commit triggers measurement during sensor initialization Signed-off-by: Jilay Pandya --- drivers/sensor/adi/adltc2990/adltc2990.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/adi/adltc2990/adltc2990.c b/drivers/sensor/adi/adltc2990/adltc2990.c index ea56065ede6e09..8dcd1dec66f174 100644 --- a/drivers/sensor/adi/adltc2990/adltc2990.c +++ b/drivers/sensor/adi/adltc2990/adltc2990.c @@ -228,6 +228,7 @@ static int adltc2990_fetch_property_value(const struct device *dev, static int adltc2990_init(const struct device *dev) { const struct adltc2990_config *cfg = dev->config; + int err; if (!i2c_is_ready_dt(&cfg->bus)) { LOG_ERR("I2C bus %s not ready", cfg->bus.bus->name); @@ -238,12 +239,17 @@ static int adltc2990_init(const struct device *dev) cfg->measurement_mode[1] << 3 | cfg->measurement_mode[0]; LOG_DBG("Setting Control Register to: 0x%x", ctrl_reg_setting); - int err = i2c_reg_write_byte_dt(&cfg->bus, ADLTC2990_REG_CONTROL, ctrl_reg_setting); - + err = i2c_reg_write_byte_dt(&cfg->bus, ADLTC2990_REG_CONTROL, ctrl_reg_setting); if (err < 0) { LOG_ERR("configuring for single bus failed: %d", err); return err; } + + err = adltc2990_trigger_measurement(dev); + if (err < 0) { + LOG_ERR("triggering measurement failed: %d", err); + } + LOG_INF("Initializing ADLTC2990 with name %s", dev->name); return 0; }