nRF51 SDK - S210 SoftDevice
|
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... | |
Functions | |
static __INLINE void | nrf_gpio_range_cfg_output (uint32_t pin_range_start, uint32_t pin_range_end) |
Function for configuring the GPIO pin range as outputs with normal drive strength. This function can be used to configure pin range as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). More... | |
static __INLINE void | nrf_gpio_range_cfg_input (uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config) |
Function for configuring the GPIO pin range as inputs with given initial value set, hiding inner details. This function can be used to configure pin range as simple input. More... | |
static __INLINE void | nrf_gpio_cfg_output (uint32_t pin_number) |
Function for configuring the given GPIO pin number as output with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). More... | |
static __INLINE void | nrf_gpio_cfg_input (uint32_t pin_number, nrf_gpio_pin_pull_t pull_config) |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). More... | |
static __INLINE void | nrf_gpio_cfg_sense_input (uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config) |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). Sense capability on the pin is configurable, and input is connected to buffer so that the GPIO->IN register is readable. More... | |
static __INLINE void | nrf_gpio_pin_dir_set (uint32_t pin_number, nrf_gpio_pin_dir_t direction) |
Function for setting the direction for a GPIO pin. More... | |
static __INLINE void | nrf_gpio_pin_set (uint32_t pin_number) |
Function for setting a GPIO pin. More... | |
static __INLINE void | nrf_gpio_pin_clear (uint32_t pin_number) |
Function for clearing a GPIO pin. More... | |
static __INLINE void | nrf_gpio_pin_toggle (uint32_t pin_number) |
Function for toggling a GPIO pin. More... | |
static __INLINE void | nrf_gpio_pin_write (uint32_t pin_number, uint32_t value) |
Function for writing a value to a GPIO pin. More... | |
static __INLINE uint32_t | nrf_gpio_pin_read (uint32_t pin_number) |
Function for reading the input level of a GPIO pin. More... | |
static __INLINE void | nrf_gpio_word_byte_write (volatile uint32_t *word_address, uint8_t byte_no, uint8_t value) |
Generic function for writing a single byte of a 32 bit word at a given address. More... | |
static __INLINE uint8_t | nrf_gpio_word_byte_read (const volatile uint32_t *word_address, uint8_t byte_no) |
Generic function for reading a single byte of a 32 bit word at a given address. More... | |
static __INLINE void | nrf_gpio_port_dir_set (nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir) |
Function for setting the direction of a port. More... | |
static __INLINE uint8_t | nrf_gpio_port_read (nrf_gpio_port_select_t port) |
Function for reading a GPIO port. More... | |
static __INLINE void | nrf_gpio_port_write (nrf_gpio_port_select_t port, uint8_t value) |
Function for writing to a GPIO port. More... | |
static __INLINE void | nrf_gpio_port_set (nrf_gpio_port_select_t port, uint8_t set_mask) |
Function for setting individual pins on GPIO port. More... | |
static __INLINE void | nrf_gpio_port_clear (nrf_gpio_port_select_t port, uint8_t clr_mask) |
Function for clearing individual pins on GPIO port. More... | |
GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports.
Here, the GPIO ports are defined as follows:
enum nrf_gpio_pin_dir_t |
enum nrf_gpio_pin_pull_t |
enum nrf_gpio_pin_sense_t |
enum nrf_gpio_port_dir_t |
|
static |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
pin_number | specifies the pin number of gpio pin numbers to be configured (allowed values 0-30) |
pull_config | State of the pin range pull resistor (no pull, pulled down or pulled high) |
< Disabled.
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< Position of PULL field.
< Connect input pin.
< Position of INPUT field.
< Configure pin as an input pin.
< Position of DIR field.
|
static |
Function for configuring the given GPIO pin number as output with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
pin_number | specifies the pin number of gpio pin numbers to be configured (allowed values 0-30) |
< Disabled.
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< No pull.
< Position of PULL field.
< Disconnect input pin.
< Position of INPUT field.
< Configure pin as an output pin.
< Position of DIR field.
|
static |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases). Sense capability on the pin is configurable, and input is connected to buffer so that the GPIO->IN register is readable.
pin_number | specifies the pin number of gpio pin numbers to be configured (allowed values 0-30). |
pull_config | state of the pin pull resistor (no pull, pulled down or pulled high). |
sense_config | sense level of the pin (no sense, sense low or sense high). |
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< Position of PULL field.
< Connect input pin.
< Position of INPUT field.
< Configure pin as an input pin.
< Position of DIR field.
|
static |
Function for clearing a GPIO pin.
Note that the pin must be configured as an output for this function to have any effect.
pin_number | specifies the pin number [0:31] to clear. |
|
static |
Function for setting the direction for a GPIO pin.
pin_number | specifies the pin number [0:31] for which to set the direction. |
direction | specifies the direction |
< Disabled.
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< No pull.
< Position of PULL field.
< Connect input pin.
< Position of INPUT field.
< Configure pin as an input pin.
< Position of DIR field.
|
static |
Function for reading the input level of a GPIO pin.
Note that the pin must have input connected for the value returned from this function to be valid.
pin_number | specifies the pin number [0:31] to read. |
0 | if the pin input level is low. |
1 | if the pin input level is high. |
> | 1 should never occur. |
|
static |
Function for setting a GPIO pin.
Note that the pin must be configured as an output for this function to have any effect.
pin_number | specifies the pin number [0:31] to set. |
|
static |
Function for toggling a GPIO pin.
Note that the pin must be configured as an output for this function to have any effect.
pin_number | specifies the pin number [0:31] to toggle. |
|
static |
Function for writing a value to a GPIO pin.
Note that the pin must be configured as an output for this function to have any effect.
pin_number | specifies the pin number [0:31] to write. |
value | specifies the value to be written to the pin.
|
|
static |
Function for clearing individual pins on GPIO port.
port | is the port for which to clear the pins. |
clr_mask | is a mask specifying which pins to clear. A bit set to 1 indicates that the corresponding port pin shall be cleared. |
|
static |
Function for setting the direction of a port.
port | is the port for which to set the direction. |
dir | direction to be set for this port. |
|
static |
Function for reading a GPIO port.
port | is the port to read. |
|
static |
Function for setting individual pins on GPIO port.
port | is the port for which to set the pins. |
set_mask | is a mask specifying which pins to set. A bit set to 1 indicates that the corresponding port pin shall be set. |
|
static |
Function for writing to a GPIO port.
port | is the port to write. |
value | is the value to write to this port. |
|
static |
Function for configuring the GPIO pin range as inputs with given initial value set, hiding inner details. This function can be used to configure pin range as simple input.
pin_range_start | specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) |
pin_range_end | specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) |
pull_config | State of the pin range pull resistor (no pull, pulled down or pulled high) |
< Disabled.
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< Position of PULL field.
< Connect input pin.
< Position of INPUT field.
< Configure pin as an input pin.
< Position of DIR field.
|
static |
Function for configuring the GPIO pin range as outputs with normal drive strength. This function can be used to configure pin range as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
pin_range_start | specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) |
pin_range_end | specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30) |
< Disabled.
< Position of SENSE field.
< Standard '0', Standard '1'.
< Position of DRIVE field.
< No pull.
< Position of PULL field.
< Disconnect input pin.
< Position of INPUT field.
< Configure pin as an output pin.
< Position of DIR field.
|
static |
Generic function for reading a single byte of a 32 bit word at a given address.
This function should not be called from outside the nrf_gpio abstraction layer.
word_address | is the address of the word to be read. |
byte_no | is the the byte number (0-3) of the word to be read. |
|
static |
Generic function for writing a single byte of a 32 bit word at a given address.
This function should not be called from outside the nrf_gpio abstraction layer.
word_address | is the address of the word to be written. |
byte_no | is the the word byte number (0-3) to be written. |
value | is the value to be written to byte "byte_no" of word at address "word_address" |