Hi,
I'm using nrf52840 and trying to define the pin mappings for my custom board. In order to do this I'm studying the board definition of pca10056 (pca10056.h).
In that file I saw some definitions are mapped to single pin number, for example
#define BSP_LED_0 13 #define BUTTON_1 11.
However, there are also some definitions mapped using the macro
NRF_GPIO_PIN_MAP(port, pin) (((port) << 5) | ((pin) & 0x1F)).
My questions are the followings:
1. Just to confirm --- if I want to define a pin, for instance P1.13, I should do #define MY_PIN NRF_GPIO_PIN_MAP(1, 13), correct?
2. By looking at this macro, it seems that it should be used when I want to map to a pin on port 1. If it's on port 0, I can simply use the pin number (such as BSP_LED_0 and BUTTON_1 above)?
3. If my second point holds, why am I seeing some pins are also mapped, for example, using NRF_GPIO_PIN_MAP(0, 27)? Wouldn't this be redundant or is there something I've missed?
Thank you!