how to add(modify) gpio pin configuration by overlay file

when I work on dk. I need to use some empty GPIOs (Not LED and button) . 

for examples.  P0.04 is connected to nothing in DK.  I want to connect it to another pin P1.05 on another DK.

in nrf52833dk_nrf52833.dts, the GPIO is defined like this:

arduino_header: connector {
       compatible = "arduino-header-r3";
       #gpio-cells = <2>;
       gpio-map-mask = <0xffffffff 0xffffffc0>;
       gpio-map-pass-thru = <0 0x3f>;
       gpio-map = <0 0 &gpio0 3 0>, /* A0 */
                            <1 0 &gpio0 4 0>, /* A1 */
                            <10 0 &gpio1 5 0>, /* D4 */
};

in my project directory. there is a file : 

nrf52833dk_nrf52833.overlay

&pinctrl {
     spi_master_default: spi_master_default {
     group1 {
          psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
          <NRF_PSEL(SPIM_MOSI, 0, 30)>,
          <NRF_PSEL(SPIM_MISO, 0, 29)>;
     };
     };

};

my_spi_master: &spi3 {
     compatible = "nordic,nrf-spim";
     status = "okay";
     pinctrl-0 = <&spi_master_default>;
     pinctrl-1 = <&spi_master_sleep>;
     pinctrl-names = "default", "sleep";
     cs-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
     reg_my_spi_master: spi-dev-a@0 {
          reg = <0>;
     };
};

to add the new GPIO define. I add code like this:

test_button: test_button {
     foo-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>,
                         <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
this failed to build.

how can I add such GPIO define?

thanks

Parents Reply Children
No Data
Related