Hi,
To turn on and turn off the LED nrf SDK is using following code in sdk12.1.
#define LEDS_OFF(leds_mask) do { NRF_GPIO->OUTSET = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \
NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0)
#define LEDS_ON(leds_mask) do { NRF_GPIO->OUTCLR = (leds_mask) & (LEDS_MASK & LEDS_INV_MASK); \
NRF_GPIO->OUTSET = (leds_mask) & (LEDS_MASK & ~LEDS_INV_MASK); } while (0)
But why we are setting the OUTSET register for clearing the LED?,Why we are setting the OUTCLR register for turning on LED?. Should it be other way around? The code is working perfectly fine, but couldn't understand the logic behind it .
What is the difference between OUTSET, OUTCLR and OUT register?.