Skip to content

Commit 175f3f5

Browse files
committed
cores: arduino: zephyrCommon.cpp: fix struct initialization warnings
Replace {0} with {} for port_callback, set dac_channel_cfg::internal explicitly, and expand adc_sequence initialization to make default values explicit and avoid C++ initializer warnings. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
1 parent f3366c2 commit 175f3f5

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

cores/arduino/zephyrCommon.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ struct gpio_port_callback {
106106
struct arduino_callback handlers[max_ngpios];
107107
gpio_port_pins_t pins;
108108
const struct device *dev;
109-
} port_callback[port_num] = {0};
109+
} port_callback[port_num] = {};
110110

111111
struct gpio_port_callback *find_gpio_port_callback(const struct device *dev) {
112112
for (size_t i = 0; i < ARRAY_SIZE(port_callback); i++) {
@@ -210,6 +210,7 @@ static const struct device *const dac_dev = DEVICE_DT_GET(DAC_NODE);
210210
.channel_id = DT_PROP_BY_IDX(n, p, i), \
211211
.resolution = DAC_RESOLUTION, \
212212
.buffered = true, \
213+
.internal = false, \
213214
},
214215

215216
#if DT_PROP_LEN_OR(DT_PATH(zephyr_user), dac_channels, 0) > 0
@@ -571,7 +572,16 @@ int analogReadResolution() {
571572
int analogRead(pin_size_t pinNumber) {
572573
int err;
573574
uint16_t buf;
574-
struct adc_sequence seq = {.buffer = &buf, .buffer_size = sizeof(buf)};
575+
struct adc_sequence seq = {.options = nullptr,
576+
.channels = 0,
577+
.buffer = &buf,
578+
.buffer_size = sizeof(buf),
579+
#if defined(CONFIG_ADC_SEQUENCE_PRIORITY)
580+
.priority = 0,
581+
#endif
582+
.resolution = 0,
583+
.oversampling = 0,
584+
.calibrate = false};
575585
size_t idx = analog_pin_index(pinNumber);
576586

577587
if (idx >= ARRAY_SIZE(arduino_adc)) {

0 commit comments

Comments
 (0)