Test DT_INST_PROP_HAS_IDX() inside the macros for multi instances #29833
Labels
area: Devicetree Tooling
PR modifies or adds a Device Tree tooling
area: Devicetree
Enhancement
Changes/Updates/Additions to existing features
I'm fixing interrupt handling inside LIS2DH sensor driver, which has recently been made multi instance.
The LIS2DH driver should be done in a way to use two interrupts (drdy on INT1 and other vtriggers on INT2) defined in DT, like:
In the code I'm writing someling like this:
But COND_CODE_1 requires something different as it gives following errors when building:
../include/sys/util_internal.h:52:14: error: pasting "_XXXX" and "(" does not give a valid
preprocessing token
52 | __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
| ^~~~~
../include/sys/util_macro.h:112:2: note: in expansion of macro 'Z_COND_CODE_1'
112 | Z_COND_CODE_1(_flag, _if_1_code, _else_code)
| ^~~~~~~~~~~~~
/local/home/visconti/Projects/zephyrproject/zephyr/drivers/sensor/lis2dh/lis2dh.c:414:20: note: in
expansion of macro 'COND_CODE_1'
414 | .irq1_dev_name = COND_CODE_1(DT_INST_PROP_HAS_IDX(inst, irq_gpios, 0),
| ^~~~~~~~~~~
Is it possible to create new macros for handling such cases?
Thanks
The text was updated successfully, but these errors were encountered: