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

Nordic SDK: swapping LEDS_ON and LEDS_OFF caused problem when checking if the LEDS are on

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 an LED using the methods LEDS_ON and LEDS_OFF. I wanted to invert the times that the LED was flashing so I went into examples/bsp/boards.h and swapped the LEDS_ON and LEDS_OFF methods. To my surprise after doing this LED_IS_ON (#define LED_IS_ON(leds_mask) ((leds_mask) & (NRF_GPIO->OUT ^ LEDS_INV_MASK) ) always returns a positive value so the led doesn't flash anymore. I am wondering how I would go about fixing this? Is it possible that a variable is being set somewhere else that is causing the LED_IS_ON to always return positive or is it the method itself (even though I didn't change it)?

Related