Skip to content

Commit ed8f537

Browse files
yperesscfriedt
authored andcommitted
adc: Fix C++ initialization for channel cfg
When compiling with -Werror=missing-field-initializers and the differential is disabled, we get a compilation error for the ADC drivers. We should still initialize the value to false. Signed-off-by: Yuval Peress <[email protected]>
1 parent 85e1353 commit ed8f537

File tree

1 file changed

+3
-2
lines changed
  • include/zephyr/drivers

1 file changed

+3
-2
lines changed

include/zephyr/drivers/adc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ struct adc_channel_cfg {
259259
.reference = DT_STRING_TOKEN(node_id, zephyr_reference), \
260260
.acquisition_time = DT_PROP(node_id, zephyr_acquisition_time), \
261261
.channel_id = DT_REG_ADDR(node_id), \
262-
IF_ENABLED(UTIL_OR(DT_PROP(node_id, zephyr_differential), \
262+
COND_CODE_1(UTIL_OR(DT_PROP(node_id, zephyr_differential), \
263263
UTIL_AND(CONFIG_ADC_CONFIGURABLE_INPUTS, \
264264
DT_NODE_HAS_PROP(node_id, zephyr_input_negative))), \
265-
(.differential = true,)) \
265+
(.differential = true,), \
266+
(.differential = false,)) \
266267
IF_ENABLED(CONFIG_ADC_CONFIGURABLE_INPUTS, \
267268
(.input_positive = DT_PROP_OR(node_id, zephyr_input_positive, 0), \
268269
.input_negative = DT_PROP_OR(node_id, zephyr_input_negative, 0),)) \

0 commit comments

Comments
 (0)