zephyr/doc/build/dts
Gerard Marull-Paretas fff9ecbc7f devicetree: add DT_(INST_)FOREACH_CHILD(_STATUS_OKAY)_SEP(_VARGS)
It is frequent to see in Devicetree code constructs like:

```c
 #define NAME_AND_COMMA(node_id) DT_NODE_FULL_NAME(node_id),

const char *child_names[] = {
	DT_FOREACH_CHILD(DT_NODELABEL(n), NAME_AND_COMMA)
};
```

That is, an auxiliary macro to append a separator character in
DT_FOREACH* macros. Non-DT API, e.g. FOR_EACH(), takes a separator
argument to avoid such intermediate macros.

This patch adds DT_FOREACH_CHILD_SEP (and instance/status okay/vargs
versions of it). They all take an extra argument: a separator. With this
change, the example above can be simplified to:

```c
const char *child_labels[] = {
	DT_FOREACH_CHILD(DT_NODELABEL(n), DT_NODE_FULL_NAME, (,))
};
```

Notes:
- Other DT_FOREACH* macros could/should be extended as well

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
..
api kscan: Introduce zephyr,keyboard-scan chosen prop 2022-08-12 17:54:03 -05:00
api-usage.rst devicetree: s/devicetree_unfixed/devicetree_generated 2022-08-11 12:17:02 +02:00
bindings.rst edtlib: allow const arrays 2022-08-25 18:11:27 -07:00
design.rst
dt-vs-kconfig.rst
howtos.rst devices: constify device pointers initialized at compile time 2022-08-22 17:08:26 +02:00
index.rst
intro.rst doc: build: dts: Remove refs to label property 2022-08-18 19:50:39 -05:00
macros.bnf devicetree: add DT_(INST_)FOREACH_CHILD(_STATUS_OKAY)_SEP(_VARGS) 2022-08-30 16:19:57 +02:00
main-example.dts
troubleshooting.rst
zephyr_dt_build_flow.png
zephyr_dt_build_flow.svg
zephyr_dt_i2c_example.png doc: build: dts: Remove refs to label property 2022-08-18 19:50:39 -05:00
zephyr_dt_i2c_example.svg doc: build: dts: Remove refs to label property 2022-08-18 19:50:39 -05:00
zephyr_dt_i2c_high_level.png
zephyr_dt_i2c_high_level.svg
zephyr_dt_inputs_outputs.svg