Nordic Thingy:52
|
GPIO extender API. More...
Modules | |
GPIO extender LED driver | |
GPIO extender LED driver API. | |
SX1509 GPIO extender driver | |
SX1509 GPIO extender API. | |
Data Structures | |
struct | drv_ext_gpio_init_t |
GPIO extender driver configuration. More... | |
Macros | |
#define | DRV_EXT_GPIO_NUM_PINS_TOTAL (DRV_EXT_GPIO_PIN_HIGHEST_ID + 1) |
Number of pins total. | |
#define | DRV_EXT_GPIO_PIN_HIGHEST_ID DRV_SX1509_DATA_PIN15_Pos |
Highest pin ID. | |
Enumerations | |
enum | { DRV_EXT_GPIO_STATUS_CODE_SUCCESS = NRF_SUCCESS, DRV_EXT_GPIO_STATUS_CODE_INVALID_PARAM, DRV_EXT_GPIO_STATUS_CODE_INVALID_PIN } |
The GPIO extender status codes. More... | |
enum | drv_ext_gpio_pin_dir_t { DRV_EXT_GPIO_PIN_DIR_OUTPUT, DRV_EXT_GPIO_PIN_DIR_INPUT } |
Pin direction definitions. More... | |
enum | drv_ext_gpio_pin_drive_type_t { DRV_EXT_GPIO_PIN_DRIVE_PUSHPULL, DRV_EXT_GPIO_PIN_DRIVE_OPENDRAIN } |
Push-pull or open drain operation. More... | |
enum | drv_ext_gpio_pin_input_buf_t { DRV_EXT_GPIO_PIN_INPUT_BUF_ENABLED, DRV_EXT_GPIO_PIN_INPUT_BUF_DISABLED } |
Connection of input buffer. More... | |
enum | drv_ext_gpio_pin_pull_t { DRV_EXT_GPIO_PIN_NOPULL, DRV_EXT_GPIO_PIN_PULLDOWN, DRV_EXT_GPIO_PIN_PULLUP } |
Pin to be pulled down, up, or no-pull. More... | |
enum | drv_ext_gpio_pin_slew_rate_t { DRV_EXT_GPIO_PIN_INCREASED_SLEWRATE_DISABLED, DRV_EXT_GPIO_PIN_INCREASED_SLEWRATE_ENABLED } |
Regular or increased slew rate. More... | |
Functions | |
uint32_t | drv_ext_gpio_cfg (uint32_t pin_number, drv_ext_gpio_pin_dir_t dir, drv_ext_gpio_pin_input_buf_t input_buf, drv_ext_gpio_pin_pull_t pull_config, drv_ext_gpio_pin_drive_type_t drive_type, drv_ext_gpio_pin_slew_rate_t slew_rate) |
Pin configuration function. More... | |
uint32_t | drv_ext_gpio_cfg_input (uint32_t pin_number, drv_ext_gpio_pin_pull_t pull_config) |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details. More... | |
uint32_t | drv_ext_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. More... | |
uint32_t | drv_ext_gpio_init (drv_ext_gpio_init_t const *const p_init, bool on_init_reset) |
Function for initializing the GPIO extender. More... | |
uint32_t | drv_ext_gpio_pin_clear (uint32_t pin_number) |
Function for clearing a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_dir_modify (uint32_t pin_number, drv_ext_gpio_pin_dir_t direction) |
Function for setting the direction of a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_drive_type_modify (uint32_t pin_number, drv_ext_gpio_pin_drive_type_t drive_type) |
Function for setting the drive type a given GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_input_buffer_modify (uint32_t pin_number, drv_ext_gpio_pin_input_buf_t input_buf) |
Function for enabling and disabling the input buffer. More... | |
uint32_t | drv_ext_gpio_pin_read (uint32_t pin_number, uint32_t *const p_pin) |
Function for reading the input level of a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_set (uint32_t pin_number) |
Function for setting a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_slew_rate_modify (uint32_t pin_number, drv_ext_gpio_pin_slew_rate_t slew_rate) |
Function for enabling or disabling increased slew rate for a given GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_toggle (uint32_t pin_number) |
Function for toggling a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pin_write (uint32_t pin_number, uint32_t value) |
Function for writing a value to a GPIO pin. More... | |
uint32_t | drv_ext_gpio_pins_clear (uint32_t pin_mask) |
Function for clearing GPIO pins. More... | |
uint32_t | drv_ext_gpio_pins_read (uint32_t *const p_pins) |
Function for reading the input level of all GPIO pins. More... | |
uint32_t | drv_ext_gpio_pins_set (uint32_t pin_mask) |
Function for setting GPIO pins. More... | |
uint32_t | drv_ext_gpio_pins_toggle (uint32_t pin_mask) |
Function for toggling GPIO pins. More... | |
uint32_t | drv_ext_gpio_reset (void) |
Function for resetting all the registers of the GPIO extender to their default values. More... | |
GPIO extender API.
anonymous enum |
uint32_t drv_ext_gpio_cfg | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_dir_t | dir, | ||
drv_ext_gpio_pin_input_buf_t | input_buf, | ||
drv_ext_gpio_pin_pull_t | pull_config, | ||
drv_ext_gpio_pin_drive_type_t | drive_type, | ||
drv_ext_gpio_pin_slew_rate_t | slew_rate | ||
) |
Pin configuration function.
[in] | pin_number | Specifies the pin number (Allowed values: 0 to DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | dir | Pin direction. |
[in] | input | Connect or disconnect input buffer. |
[in] | pull | Pull configuration. |
[in] | drive | type Push-pull or open drain. |
[in] | slew_rate | Normal or increased slew rate. |
uint32_t drv_ext_gpio_cfg_input | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_pull_t | pull_config | ||
) |
Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | pull_config | State of the pin range pull resistor (no pull, pulled down, or pulled high). |
uint32_t drv_ext_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.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
uint32_t drv_ext_gpio_init | ( | drv_ext_gpio_init_t const *const | p_init, |
bool | on_init_reset | ||
) |
Function for initializing the GPIO extender.
[in] | drv_ext_gpio_init_t | Configuration struct. |
[in] | on_init_reset | If true, the IO extender will be reset on init. This will put the IO extender in a known state, but will delete any previous configurations, even from other drivers. |
uint32_t drv_ext_gpio_pin_clear | ( | uint32_t | pin_number | ) |
Function for clearing a GPIO pin.
[in] | pin_number | The pin number (0-DRV_EXT_GPIO_PIN_HIGHEST_ID) to clear. |
uint32_t drv_ext_gpio_pin_dir_modify | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_dir_t | direction | ||
) |
Function for setting the direction of a GPIO pin.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | direction | The direction. |
uint32_t drv_ext_gpio_pin_drive_type_modify | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_drive_type_t | drive_type | ||
) |
Function for setting the drive type a given GPIO pin.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | drive | type Pin drive: push-pull or open drain. |
uint32_t drv_ext_gpio_pin_input_buffer_modify | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_input_buf_t | input_buf | ||
) |
Function for enabling and disabling the input buffer.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | input | buffer Disabled or enabled. |
uint32_t drv_ext_gpio_pin_read | ( | uint32_t | pin_number, |
uint32_t *const | p_pin | ||
) |
Function for reading the input level of a GPIO pin.
[in] | pin_number | The pin number (0-DRV_EXT_GPIO_PIN_HIGHEST_ID) to read. |
[out] | p_pin | Pin value. |
0 | if the pin input level is low. |
1 | if the pin input level is high. |
> | 1 should never occur. |
uint32_t drv_ext_gpio_pin_set | ( | uint32_t | pin_number | ) |
Function for setting a GPIO pin.
[in] | pin_number | The pin number (0-DRV_EXT_GPIO_PIN_HIGHEST_ID) to set. |
uint32_t drv_ext_gpio_pin_slew_rate_modify | ( | uint32_t | pin_number, |
drv_ext_gpio_pin_slew_rate_t | slew_rate | ||
) |
Function for enabling or disabling increased slew rate for a given GPIO pin.
[in] | pin_number | The pin number (allowed values 0-DRV_EXT_GPIO_PIN_HIGHEST_ID). |
[in] | direction | The direction. |
uint32_t drv_ext_gpio_pin_toggle | ( | uint32_t | pin_number | ) |
Function for toggling a GPIO pin.
[in] | pin_number | Pin number (0-DRV_EXT_GPIO_PIN_HIGHEST_ID) to toggle. |
uint32_t drv_ext_gpio_pin_write | ( | uint32_t | pin_number, |
uint32_t | value | ||
) |
Function for writing a value to a GPIO pin.
[in] | pin_number | The pin number (0-DRV_EXT_GPIO_PIN_HIGHEST_ID) to write. |
[in] | value | Specifies the value to be written to the pin.
|
uint32_t drv_ext_gpio_pins_clear | ( | uint32_t | pin_mask | ) |
Function for clearing GPIO pins.
[in] | pin_mask | Pins to clear. |
uint32_t drv_ext_gpio_pins_read | ( | uint32_t *const | p_pins | ) |
Function for reading the input level of all GPIO pins.
[out] | p_pins | State of all pins. |
uint32_t drv_ext_gpio_pins_set | ( | uint32_t | pin_mask | ) |
Function for setting GPIO pins.
[in] | pin_mask | Specifies the pins to set. |
uint32_t drv_ext_gpio_pins_toggle | ( | uint32_t | pin_mask | ) |
Function for toggling GPIO pins.
[in] | pin_mask | Pins to toggle. |
uint32_t drv_ext_gpio_reset | ( | void | ) |
Function for resetting all the registers of the GPIO extender to their default values.