The GPIO peripheral implements two pins, GPIO0 and GPIO1. Both pins can be individually configured in the CONFIG[n], USAGE[n], and OUTPUT[n] registers.
General purpose input
GPIO can be used as a general purpose input to monitor the input logic level. For a pin to function as a GPIO, select GPIO in register USAGE[n]. Input buffer enable, debounce, pull-down, and pull-up are set in the CONFIG[n] register. Pin state can be read in the READ register.
GPIO can also be used as an input to trigger an event using INTEN_GPIO_SET to enable events. Set bit GPIO[n]RISE to generate an event on the rising edge. To generate an event on a falling edge, set bit GPIO[n]FALL. The events are visible in register EVENTS_GPIO_SET.
Control input
For a pin to function as a control input, first select GPIO in USAGE[n], then configure the pin in CONFIG[n].
The following components can be controlled through GPIO once enabled in the corresponding register.
- LDOSW – Registers LDOSW.GPIO and LDOSW.SEL (select PINCTRL)
- BOOST – Registers BOOST.PIN and BOOST.GPIO
Output
For a pin to function as an output, select GPIO in the USAGE[n] register. Use the CONFIG[n] register to enable the output buffer and configure the settings. OUTPUT[n] drives the pin to the desired state.
Interrupt output
A pin is set as an interrupt output by selecting INTHI or INTLO (active high or low, respectively) in the USAGE[n] register. The CONFIG[n] register is used to enable the output buffer and configure the settings.