Replies: 1 comment
-
@perowle, Hope this help 2) Purpose of dt_flags: dt_flags in gpio_dt_spec holds the flag settings defined in the device tree.
3) Split of GPIO Configuration Symbols: The symbols in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Looking for advice on how to set up GPIOs for a project. I've read through the documentation and experimented quite a bit, but still my solution seems like it'll be difficult to support, given that configuration for a GPIO is spread across multiple files (mostly the .dtsi and .c files), and I end up using a lot of memory of all the gpio_dt_spec structs.
First, I notice there's only a dt-binding for LEDs and Buttons, so I created gpio-generic.yaml, which just lets me create any GPIO without pre-supposing it's one of the pre-defined (LED,Button). My yaml file is below.
Now, to define the GPIOs, I created a .dtsi (also below) for my board which groups the GPIO's by subsystem in my application (essentially by thread).
After doing this configuration, I have to go into my code, and for each gpio:
then finally, I can
So questions:
1) Is this the right way to manage GPIO's, or is there something simpler?
2) What is the dt_flags member of the gpio_dt_spec structure used for?
3) Along those lines, why are the GPIO configuration symbols split between drivers/gpio.h and dt-bindings/gpio/gpio.h. My initial thought was that I could set the pin configuration in the dtsi, and then use it in the code, this doesn't seem to be the case.
Thanks for any help understanding this - maybe I'm overcomplicating it.
Peter
myboard_gpios.dtsi
gpio-generic.yaml
Beta Was this translation helpful? Give feedback.
All reactions