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

Editing LEDS_ON and LEDS_OFF

I am working on a project using a ble nano (nrf51822) using the Nordic SDK 8.1. In the examples I found a way to control the onboard led that uses the methods LEDS_ON and LEDS_OFF. I wanted to change my code to light up an external LED attached to a GPIO pin instead of the onboard LED. To do this I went into the header file for the board (custom_board.h) and changed the pin number from the onboard LED to an external LED. After doing this I was surprised to find out that LEDS_OFF turned the external LED on and LEDS_ON turned the external LED off. Now I'm wondering how I can fix this. My thoughts are I have 2 possible approaches: 1) Swap the LEDS_ON and LEDS_OFF functions by editing them. I can't figure out how I would do that though. How can I change these functions? Or 2) Create my own function that controls the LED attached to the GPIO pin and replace all instances of LEDS_ON and LEDS_OFF with it. How should I tackle this problem?

Related