Lines Matching refs:reg_data
23 static int reg_read(const struct device *dev, uint8_t reg_addr, uint16_t *reg_data) in reg_read() argument
31 *reg_data = sys_get_be16(rx_buf); in reg_read()
36 static int reg_write(const struct device *dev, uint8_t addr, uint16_t reg_data) in reg_write() argument
42 sys_put_be16(reg_data, &tx_buf[1]); in reg_write()
52 uint16_t reg_data; in ina3221_init() local
73 ret = reg_read(dev, INA3221_MANUF_ID, ®_data); in ina3221_init()
78 if (reg_data != INA3221_MANUF_ID_VALUE) { in ina3221_init()
79 LOG_ERR("Unexpected manufacturer ID: 0x%04x", reg_data); in ina3221_init()
82 ret = reg_read(dev, INA3221_CHIP_ID, ®_data); in ina3221_init()
86 if (reg_data != INA3221_CHIP_ID_VALUE) { in ina3221_init()
87 LOG_ERR("Unexpected chip ID: 0x%04x", reg_data); in ina3221_init()
92 ret = reg_read(dev, INA3221_CONFIG, ®_data); in ina3221_init()
96 reg_data |= INA3221_CONFIG_RST; in ina3221_init()
97 ret = reg_write(dev, INA3221_CONFIG, reg_data); in ina3221_init()
103 reg_data = (cfg->conv_time_shunt << 3) | (cfg->conv_time_bus << 6) | (cfg->avg_mode << 9) | in ina3221_init()
108 ret = reg_write(dev, INA3221_CONFIG, reg_data); in ina3221_init()
119 uint16_t reg_data; in start_measurement() local
121 ret = reg_read(dev, INA3221_CONFIG, ®_data); in start_measurement()
126 reg_data &= ~(INA3221_CONFIG_BUS | INA3221_CONFIG_SHUNT); in start_measurement()
127 reg_data |= (INA3221_CONFIG_BUS * bus) | (INA3221_CONFIG_SHUNT * shunt); in start_measurement()
129 ret = reg_write(dev, INA3221_CONFIG, reg_data); in start_measurement()
139 uint16_t reg_data; in measurement_ready() local
141 ret = reg_read(dev, INA3221_MASK_ENABLE, ®_data); in measurement_ready()
145 return reg_data & INA3221_MASK_ENABLE_CONVERSION_READY; in measurement_ready()