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

How to configure only Port0 all pins as GPIO with nrf52832

Hi Team,

I am new to nrf and using Nrf52832 and  SDK 14.2.0 for development I am facing a problem, I want to select only Port0 pins as GPIO pins. how to make it. I gone through nrf_gpio.h file I am not understanding much please suggest me.

With thanks 

Jeevan 

Parents Reply
  • Hi Jeevan.

    To configure a pin as output you just need to use (Assuming your LED is on pin 7)

    #define LED_PIN 7
    
    nrf_gpio_cfg_output(LED_PIN);// Set LED PIN pin as output
    
    To set the pin to High , use
    
    nrf_gpio_pin_set(LED_PIN);
    
    to set the pin to low, use
    
    nrf_gpio_pin_clear(LED_PIN);
    
    to toggle the pin use
    
    nrf_gpio_pin_toggle(LED_PIN);
    

    Note. You need to include "nrf_gpio.h"

    Best regards,

    Andreas

Children
Related