Set and clear GPIO pins at the same time

Hey,

currently I use nrf_gpio_pins_set() and and nrf_gpio_pins_clear() from nrf_gpio.h to set and clear specific GPIO ports, respectively. If I want to change the current state of -say- 4 GPIO ports at once (some of them may be cleared, some of them may be set), how do I do that? It would be important that the change on all pins happens at the same time.

Any ideas? Thanks, NewtoM

Parents
No Data
Reply
  • Read the GPIO port to get the current state, set and clear bits in that value, then write it back.

    Just as there is a GPIO->OUTSET and a GPIO->OUTCLR register, so there is a GPIO->OUT register you can write to set the whole register at once.

Children
No Data
Related