It can be useful to know what a node's index is in its parent's list of children. This information is now available to C via gen_defines.py, but no user-facing macros are available to access it. Add a macro which exposes this information to users via devicetree.h. Some APIs want to build on devicetree.h by creating some derived structure for each of a node's children. It can therefore be convenient to use each child's index in the list of children as an identifier for the child. Some concrete and common examples are "gpio-keys" and "gpio-leds", which allow you to define arbitrary numbers of keys and LEDs as child nodes of nodes with those compatibles. Derived APIs can use a key or LED node's index in its list of parents as a way to identify which of several structures is relevant to a particular controlled key or LED. These are just examples, though -- the feature added here makes no assumptions about where it's being used. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no> |
||
|---|---|---|
| .. | ||
| api | ||
| api_ext | ||
| devices | ||