Configuring a GPIO pin through overlay

I am wondering If there's any example to demonstrate how I can configure a pin on the nRF52840DK through an overlay.

I have manipulated the board device tree and replaced the LED pin number with one of the DK's pin and I was able to use the pin through the device tree spec apis, in other words,

doing GPIO_DT_SPEC_GET(DT_ALIAS(led0)) and then using gpio_pin_configure_dt() for configuration while I have changed the led0 label in the board's device tree such that it is associated with a different PIN number. I verified it using logic analyzer.

I know that I can also use DEVICE_DT_GET() and gpio_pin_configure() and I am actually doing that for gpio pin configuration in my projects, but I want to learn how I can configure with device tree spec APIs? Is there a way to add an overlay file and do this without the need to manipulate the DK board's device tree file?

Thanks
Parents Reply Children
No Data
Related