-
Notifications
You must be signed in to change notification settings - Fork 33
variants: Introduce the builtin-led-gpios node #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
variants: Introduce the builtin-led-gpios node #61
Conversation
62d1863
to
e4be5a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement and the changes LGTM.
This PR should also include an update to the variant documentation on this topic:
gsoc-2022-arduino-core/documentation/variants.md
Lines 57 to 84 in 5c305c6
### Overlays using previously-defined Arduino headers | |
When an Arduino header exists in a board's in-tree DTS file it can easily be | |
used to create the necessary overlay file. Assign the relevant mapping using the | |
Arduino header label (usually either `&arduino_header` or `&arduino_nano_header` | |
and the `gpio_map` number. The second number is used to add GPIO flags and may | |
safely be left as zero. | |
For example, creating an overlay file for the Nordic nRF52840 Development Kit | |
uses [the Arduino header definitions](https://github.com/zephyrproject-rtos/zephyr/blob/6f8ee2cdf7dd4d746de58909204ea0ce156d5bb4/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L74-L101), beginning with the first digital pin: | |
``` | |
/ { | |
zephyr,user { | |
d0_gpios = <&arduino_header 6 0>; /* Digital */ | |
d1_gpios = <&arduino_header 7 0>; | |
... | |
d13_gpios = <&arduino_header 19 0>; | |
d14_gpios = <&arduino_header 0 0>; /* Analog */ | |
d15_gpios = <&arduino_header 1 0>; | |
... | |
d19_gpios = <&arduino_header 5 0>; | |
d20_gpios = <&arduino_header 20 0>; /* SDA */ | |
d21_gpios = <&arduino_header 21 0>; /* SCL */ | |
d22_gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; /* LED0 */ | |
}; | |
}; | |
``` |
Introduce the `builtin-led-gpios` node to make possible to configuring the builtin-led from dts. This node uses to determine the value of the `LED_BUILTIN` macro. Use the `led0` alias to determine the `LED_BUILTIN` if the `builtin-led-gpios` is not defined. The behavior can override by defining the `LED_BUILTIN` in pinmap.h. It uses definitions that are defined in the header preferentially. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add a description for `builtin-led-gpios` Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
e4be5a6
to
d5d53c6
Compare
Thank you for reviewing.
I update the document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the overall code around builtin LEDs much more generic and future proof. Great addition!
Tested-by: Dhruva Gole
Introduce the
builtin-led-gpios
node to make possible to configuringthe builtin-led from dts.
This node uses to determine the value of the
LED_BUILTIN
macro.Use the
led0
alias to determine theLED_BUILTIN
if thebuiltin-led-gpios
is not defined.
The behavior can override by defining the
LED_BUILTIN
in pinmap.h.It uses definitions that are defined in the header preferentially.
The PR is contineued from #60.
I will rebase if #60 merged.