Hello, is it possible to set gpio direction (input/output) from devicetree?
I haven't found any gpio flags to do this in the gpio.h located in dt-bindings folder.
Hello, is it possible to set gpio direction (input/output) from devicetree?
I haven't found any gpio flags to do this in the gpio.h located in dt-bindings folder.
Hi,
There is no property for this in the binding for nRF GPIO, as you can see here: nordic,nrf-gpio. It should be possible to have a property to indicate this, and you can see cases of something similar with litex,gpio where they indicate that the port is output, or xlnx,xps-gpio-1.00.a where they have properties to indicate whether all GPIOs are input or output. However, you would not be able to use nordic,nrf-gpio with this, so you would have to create your own node.
This will not actually configure or set the pin as input or output. You would have to get the property from the devicetree and then use it as an input when you configure the pin with gpio_pin_configure(). It would be simpler to just directly set it when configuring it with gpio_pin_configure() instead of going through devicetree.
Best regards,
Marte
Hi,
There is no property for this in the binding for nRF GPIO, as you can see here: nordic,nrf-gpio. It should be possible to have a property to indicate this, and you can see cases of something similar with litex,gpio where they indicate that the port is output, or xlnx,xps-gpio-1.00.a where they have properties to indicate whether all GPIOs are input or output. However, you would not be able to use nordic,nrf-gpio with this, so you would have to create your own node.
This will not actually configure or set the pin as input or output. You would have to get the property from the devicetree and then use it as an input when you configure the pin with gpio_pin_configure(). It would be simpler to just directly set it when configuring it with gpio_pin_configure() instead of going through devicetree.
Best regards,
Marte