Hi, I am exploring the nRF connect SDK v1.9.1. along with that i have my own custom build nRF52840 board (custom board) . in that i have enabled LED,Buttons, ADC sensors, spi sensors, neopixel led, and some GPIOs .
I have created the custom board file based on the nrf52840 dk board file .
Now i want to map the pins and i want to access it as output and also pin interrupt .
to achieve that configuration .
I have tried two method
1. Example of blinky (zephyr/samples/basic/blinky)
in my custom .dts file
i made this things
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
label = "Green LED 0";
};
};
pwmleds {
compatible = "pwm-leds";
pwm_led0: pwm_led_0 {
pwms = <&pwm0 36>;
};
};
neo {
compatible = "neo-switch";
neo_switch0: neo-switch_0 {
gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
label = "neo switch";
};
};
buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio1 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
label = "Push button switch 0";
};
button1: button_1 {
gpios = <&gpio1 15 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
label = "Push button switch 1";
};
};
check i want to config P0.06 as output . How i suppose to configure here and i tried to make devicetree get binding but
#define NEO_NODE DT_ALIAS(neoswitch)
#if DT_NODE_HAS_STATUS(NEO_NODE, okay)
#define NEOSWITCH DT_GPIO_LABEL(NEO_NODE, gpios)
#define NEOPIN DT_GPIO_PIN(NEO_NODE, gpios)
#endif
void main(void)
{
int err;
const struct device *neo_dev;
neo_dev = device_get_binding(NEOSWITCH);
//if(neo_dev == NULL)
// return;
err = dk_leds_init();
if (err) {
printk("LEDs init failed (err %d)\n", err);
return;
}
err = dk_buttons_init(button_changed);
if (err) {
printk("Cannot init buttons (err: %d)\n", err);
}
}

2. I am trying to implement #include <nrfx/hal/nrf_gpio.h> based on this link https://devzone.nordicsemi.com/f/nordic-q-a/70735/gpio-pin-configuration/290413#290413

how to interface nrf_gpio drivers into the prj.conf
my current prj.conf is
# # Copyright (c) 2020 Nordic Semiconductor # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # # Network shell CONFIG_SHELL=y CONFIG_OPENTHREAD_SHELL=y CONFIG_SHELL_ARGC_MAX=26 CONFIG_SHELL_CMD_BUFF_SIZE=416 # Enable OpenThread features set CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y CONFIG_NET_L2_OPENTHREAD=y # Generic networking options CONFIG_NETWORKING=y CONFIG_ASSERT=y CONFIG_ASSERT_NO_COND_INFO=y CONFIG_MBEDTLS_SHA1_C=n CONFIG_FPU=y CONFIG_GPIO_SHELL=y CONFIG_DK_LIBRARY=y CONFIG_GPIO=y CONFIG_GPIO_NRFX=y
also i have created .overlay file for my board like
/* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
&uart0 {
status = "okay";
hw-flow-control;
};
neo {
compatible = "neo-switch";
neo_switch0: neo-switch_0 {
gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
label = "neo switch";
};
};
/ {
/*
* In some default configurations within the nRF Connect SDK,
* e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
* This devicetree overlay ensures that default is overridden wherever it
* is set, as this application uses the RNG node for entropy exclusively.
*/
chosen {
zephyr,entropy = &rng;
};
};