Skip to content

Commit 7af39ea

Browse files
committed
zephyr: don't depend on analog overlay
1 parent eb61020 commit 7af39ea

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

build/devices/zephyr/targets/stm32u5a9j_dk/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"build": {
3-
"ZEPHYR_BOARD": "stm32u5a9j_dk"
3+
"ZEPHYR_BOARD": "stm32u5g9j_dk1"
44
},
55
"include": [
66
],

modules/io/analog/zephyr/_analog.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,27 @@ typedef struct AnalogRecord *Analog;
4747

4848
#if !DT_NODE_EXISTS(DT_PATH(zephyr_user)) || \
4949
!DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels)
50-
#error "No suitable devicetree overlay specified"
51-
#endif
50+
#warning "No suitable analog devicetree overlay specified"
51+
#define NO_CHANNELS 1
5252

53-
#define DT_SPEC_AND_COMMA(node_id, prop, idx) \
54-
ADC_DT_SPEC_GET_BY_IDX(node_id, idx),
53+
static const struct adc_dt_spec adc_channels[0];
54+
#else
55+
#define DT_SPEC_AND_COMMA(node_id, prop, idx) \
56+
ADC_DT_SPEC_GET_BY_IDX(node_id, idx),
5557

56-
static const struct adc_dt_spec adc_channels[] = {
57-
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels, DT_SPEC_AND_COMMA)
58-
};
58+
static const struct adc_dt_spec adc_channels[] = {
59+
DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels, DT_SPEC_AND_COMMA)
60+
};
61+
#endif
5962

6063
static int adc_channel_idx(int channel) {
6164
int i;
65+
#if ! NO_CHANNELS
6266
for (i = 0; i < (sizeof(adc_channels)/sizeof(struct adc_dt_spec)); i++) {
6367
if (adc_channels[i].channel_id == channel)
6468
return i;
6569
}
70+
#endif
6671
return -1;
6772
}
6873

0 commit comments

Comments
 (0)