This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 DK GPIO pin code for 1.3.0

Hi,

I want to use some of the nrf9160 DK pin as feedback or notification out for other microcontroller.

So when i am using gpio.h Library it was showing error. I am using ncs 1.3.0 version.

does above version support gpio library ?

please check below code and let me know what is wrong. 

#include <zephyr.h>
#include <device.h>
#include <gpio.h>

void main(void)
{
	struct device *dev;

	dev = device_get_binding("GPIO_0");
	/* Set LED pin as output */
	gpio_pin_configure(dev, 3, GPIO_DIR_OUT); //p0.03 == LED2
	gpio_pin_configure(dev, 4, GPIO_DIR_OUT); //p0.04 == LED3
	gpio_pin_configure(dev, 5, GPIO_DIR_OUT); //p0.05

	while (1) {
		/* Set pin to HIGH*/
		gpio_pin_write(dev, 3, 1);//p0.03 == LED2
		gpio_pin_write(dev, 4, 1);	//p0.04 == LED3
		gpio_pin_write(dev, 5, 1);	//p0.05 
	}
}

Do i need to make any changes or add in Kconfig and project file ?

Related