nRF51 SDK: GPIO abstraction

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Enumerations
GPIO abstraction
Peripheral Drivers

GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports. More...

## Enumerations

enum | nrf_gpio_port_dir_t { NRF_GPIO_PORT_DIR_OUTPUT, NRF_GPIO_PORT_DIR_INPUT }
| Enumerator used for setting the direction of a GPIO port. More...
enum | nrf_gpio_pin_dir_t { NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_DIR_OUTPUT }
enum | nrf_gpio_port_select_t { NRF_GPIO_PORT_SELECT_PORT0 = 0, NRF_GPIO_PORT_SELECT_PORT1, NRF_GPIO_PORT_SELECT_PORT2, NRF_GPIO_PORT_SELECT_PORT3 }
| Enumerator used for selecting between port 0 - 3. More...
enum | nrf_gpio_pin_pull_t { NRF_GPIO_PIN_NOPULL = (0x00UL), NRF_GPIO_PIN_PULLDOWN = (0x01UL), NRF_GPIO_PIN_PULLUP = (0x03UL) }
| Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration. More...
enum | nrf_gpio_pin_sense_t { NRF_GPIO_PIN_NOSENSE = (0x00UL), NRF_GPIO_PIN_SENSE_LOW = (0x03UL), NRF_GPIO_PIN_SENSE_HIGH = (0x02UL) }
| Enumerator used for selecting the pin to sense high or low level on the pin input. More...

## Detailed Description

GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports.

Here, the GPIO ports are defined as follows:

- Port 0 -> pin 0-7
- Port 1 -> pin 8-15
- Port 2 -> pin 16-23
- Port 3 -> pin 24-31

## Enumeration Type Documentation

enum nrf_gpio_pin_dir_t

Pin direction definitions.

Enumerator
NRF_GPIO_PIN_DIR_INPUT | Input.
NRF_GPIO_PIN_DIR_OUTPUT | Output.

enum nrf_gpio_pin_pull_t

Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration.

Enumerator
NRF_GPIO_PIN_NOPULL | Pin pullup resistor disabled. No pull.
NRF_GPIO_PIN_PULLDOWN | Pin pulldown resistor enabled. Pulldown on pin.
NRF_GPIO_PIN_PULLUP | Pin pullup resistor enabled. Pullup on pin.

enum nrf_gpio_pin_sense_t

Enumerator used for selecting the pin to sense high or low level on the pin input.

Enumerator
NRF_GPIO_PIN_NOSENSE | Pin sense level disabled. Disabled.
NRF_GPIO_PIN_SENSE_LOW | Pin sense low level. Wakeup on low level.
NRF_GPIO_PIN_SENSE_HIGH | Pin sense high level. Wakeup on high level.

enum nrf_gpio_port_dir_t

Enumerator used for setting the direction of a GPIO port.

Enumerator
NRF_GPIO_PORT_DIR_OUTPUT | Output.
NRF_GPIO_PORT_DIR_INPUT | Input.

enum nrf_gpio_port_select_t

Enumerator used for selecting between port 0 - 3.

Enumerator
NRF_GPIO_PORT_SELECT_PORT0 | Port 0 (GPIO pin 0-7)
NRF_GPIO_PORT_SELECT_PORT1 | Port 1 (GPIO pin 8-15)
NRF_GPIO_PORT_SELECT_PORT2 | Port 2 (GPIO pin 16-23)
NRF_GPIO_PORT_SELECT_PORT3 | Port 3 (GPIO pin 24-31)