Hi there,
Normal pins on port 0 can be accessed just like from document. But for pins on port 1, how do I access them? For example for a pin 6, I could do
NRF_GPIO->DIRSET = (1<< 6);
How could I do the something for a pin 1.4 ? Thanks.
Hi there,
Normal pins on port 0 can be accessed just like from document. But for pins on port 1, how do I access them? For example for a pin 6, I could do
NRF_GPIO->DIRSET = (1<< 6);
How could I do the something for a pin 1.4 ? Thanks.
I traced the code I found GPIO is replaced by P0 and P1. So could I use something like:
NRF_P0->DIRSET = (1<< 6);
NRF_P1->DIRSET = (1<< 6);
For pins on 0.6 and 1.6 respectively? Thanks.
Hi,
You are right, All P1 pins are configured in the corresponding P1 registers, which has their own offset (see GPIO chapter in the product specification). As you configure the pins with direct register access yourself you need to take this into account.
Note that you could avoid having to think about this if you used the GPIO HAL instead (nrf_gpio.h). Those are simple functions that help you access the GPIO registers in a user friendly manner, handling things like different GPIO ports under the hood (here P1 pins are just referred to by their pin number + 32).