refactor: Move to LISTIFY/DT_FOREACH_PROP_ELEM macros.

This commit is contained in:
Peter Johanson
2022-09-20 21:35:40 -04:00
committed by Pete Johanson
parent 69a4c3200d
commit 243a227ff9
10 changed files with 33 additions and 31 deletions

View File

@@ -33,13 +33,12 @@ struct conditional_layer_cfg {
int8_t then_layer;
};
#define IF_LAYER_BIT(i, n) BIT(DT_PROP_BY_IDX(n, if_layers, i)) |
#define IF_LAYER_BIT(node_id, prop, idx) BIT(DT_PROP_BY_IDX(node_id, prop, idx)) |
// Evaluates to conditional_layer_cfg struct initializer.
#define CONDITIONAL_LAYER_DECL(n) \
{ \
/* TODO: Replace UTIL_LISTIFY with DT_FOREACH_PROP_ELEM after Zepyhr 2.6.0 upgrade. */ \
.if_layers_state_mask = UTIL_LISTIFY(DT_PROP_LEN(n, if_layers), IF_LAYER_BIT, n) 0, \
.if_layers_state_mask = DT_FOREACH_PROP_ELEM(n, if_layers, IF_LAYER_BIT) 0, \
.then_layer = DT_PROP(n, then_layer), \
},