How to obtain the port from the button devicetree specification?

Dear Community,

Following the Nordic's sample of the (<ncs root>/nrf/sample/caf) the LED module & (CAF) Button module demonstrate the LED states & LED effects (awesome!)
After reading the code and tweaking it a bit (set the step from 15 to 31 for a very smooth visual effect).
I decided to migrate it to my hardware board (with a nrf52840) and play a little more.

So it begin with configuring the actual buttons and led reflecting its presence in the board dts or overlay.
for the demo this information is kept in the button_def.h and led_state_def.h
unfortunately, this example has some hardcoded values for button port (it does not come devicetree)

{.port = 0, .pin = DT_GPIO_PIN(DT_NODELABEL(button3), gpios)},

I already did pull-out some gray hears from my head to figure a solution.

1st question: How to obtain the port from the button specification? Which marco?

Any hint / tip / help or advice is most welcome!

Second question:
   For the common application framework - LED module - how to configure a multi-color led (that has no blue) (thus; only red+green led in one house?) 
   As a current work around i added blue + pwm and assign it to a dummy/empty pin (but the final designed product has no spare pins available) so how to overcome?

Parents Reply Children
No Data
Related