dt-bindings: sensor: ina230: add configuration properties

Add properties to replace the configuration register value.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
This commit is contained in:
Eric Holmberg 2023-08-16 16:42:34 +12:00 committed by Maureen Helm
commit f0f7f8b146
3 changed files with 51 additions and 7 deletions

View file

@ -261,7 +261,11 @@ static const struct sensor_driver_api ina230_driver_api = {
static struct ina230_data drv_data_##inst; \
static const struct ina230_config drv_config_##inst = { \
.bus = I2C_DT_SPEC_INST_GET(inst), \
.config = DT_INST_PROP(inst, config), \
.config = DT_INST_PROP(inst, config) | \
(DT_INST_ENUM_IDX(inst, avg_count) << 9) | \
(DT_INST_ENUM_IDX(inst, vbus_conversion_time_us) << 6) | \
(DT_INST_ENUM_IDX(inst, vshunt_conversion_time_us) << 3) | \
DT_INST_ENUM_IDX(inst, adc_mode), \
.current_lsb = DT_INST_PROP(inst, current_lsb_microamps), \
.cal = (uint16_t)((INA230_CAL_SCALING * 10000000ULL) / \
((uint64_t)DT_INST_PROP(inst, current_lsb_microamps) * \