Skip to content
Commit 56da1407 authored by Martí Bolívar's avatar Martí Bolívar Committed by Kumar Gala
Browse files

devicetree: add new for-each macros



Add two new for-each macros:

- DT_FOREACH_STATUS_OKAY(compat, fn)
- DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...)

These can be used to expand "fn" once for every status "okay" node in
the devicetree which has a given compatible. The intended use case is
to allow doing something in C once for each node of a compatible,
but outside of a device driver.

E.g. an application might want to collect an array of structures for a
compatible, where each structure is initialized from a node.

In such cases we don't want people to be forced into using
DT_DRV_COMPAT and instance numbers, because that's in general a hint
that you're doing something driver-like.

Signed-off-by: default avatarMartí Bolívar <marti.bolivar@nordicsemi.no>
parent e7d42ff8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment