GPIO peripheral driver. More...
Data Structures | |
struct | npmx_gpio_t |
Data structure of the GPIO driver instance. More... | |
struct | npmx_gpio_config_t |
Configuration structure for GPIO. More... | |
Enumerations | |
enum | npmx_gpio_mode_t { NPMX_GPIO_MODE_INPUT = GPIOS_GPIOMODE0_GPIOMODE_GPIINPUT , NPMX_GPIO_MODE_INPUT_OVERRIDE_1 = GPIOS_GPIOMODE0_GPIOMODE_GPILOGIC1 , NPMX_GPIO_MODE_INPUT_OVERRIDE_0 = GPIOS_GPIOMODE0_GPIOMODE_GPILOGIC0 , NPMX_GPIO_MODE_INPUT_RISING_EDGE = GPIOS_GPIOMODE0_GPIOMODE_GPIEVENTRISE , NPMX_GPIO_MODE_INPUT_FALLING_EDGE = GPIOS_GPIOMODE0_GPIOMODE_GPIEVENTFALL , NPMX_GPIO_MODE_OUTPUT_IRQ = GPIOS_GPIOMODE0_GPIOMODE_GPOIRQ , NPMX_GPIO_MODE_OUTPUT_RESET = GPIOS_GPIOMODE0_GPIOMODE_GPORESET , NPMX_GPIO_MODE_OUTPUT_PLW = GPIOS_GPIOMODE0_GPIOMODE_GPOPLW , NPMX_GPIO_MODE_OUTPUT_OVERRIDE_1 = GPIOS_GPIOMODE0_GPIOMODE_GPOLOGIC1 , NPMX_GPIO_MODE_OUTPUT_OVERRIDE_0 = GPIOS_GPIOMODE0_GPIOMODE_GPOLOGIC0 , NPMX_GPIO_MODE_COUNT , NPMX_GPIO_MODE_INVALID = NPMX_INVALID_ENUM_VALUE } |
Configuration for GPIO mode selection. More... | |
enum | npmx_gpio_drive_t { NPMX_GPIO_DRIVE_1_MA = GPIOS_GPIODRIVE1_GPIODRIVE_1MA , NPMX_GPIO_DRIVE_6_MA = GPIOS_GPIODRIVE1_GPIODRIVE_6MA , NPMX_GPIO_DRIVE_COUNT , NPMX_GPIO_DRIVE_MIN = NPMX_GPIO_DRIVE_1_MA , NPMX_GPIO_DRIVE_DEFAULT = NPMX_GPIO_DRIVE_1_MA , NPMX_GPIO_DRIVE_MAX = NPMX_GPIO_DRIVE_6_MA , NPMX_GPIO_DRIVE_INVALID = NPMX_INVALID_ENUM_VALUE } |
Configuration for GPIO drive current. More... | |
enum | npmx_gpio_pull_t { NPMX_GPIO_PULL_DOWN , NPMX_GPIO_PULL_UP , NPMX_GPIO_PULL_NONE , NPMX_GPIO_PULL_COUNT , NPMX_GPIO_PULL_INVALID = NPMX_INVALID_ENUM_VALUE } |
Configuration for GPIO pull resistors. By default, all GPIOs are in NPMX_GPIO_PULL_DOWN mode. More... | |
Functions | |
npmx_gpio_t * | npmx_gpio_get (npmx_instance_t *p_pmic, uint8_t idx) |
Function for returning GPIO instance based on index. | |
npmx_gpio_drive_t | npmx_gpio_drive_convert (uint32_t milliamperes) |
Function for converting milliamperes to npmx_gpio_drive_t enumeration. | |
bool | npmx_gpio_drive_convert_to_ma (npmx_gpio_drive_t enum_value, uint32_t *p_val) |
Function for converting npmx_gpio_drive_t enumeration to milliamperes. | |
npmx_error_t | npmx_gpio_config_set (npmx_gpio_t const *p_instance, npmx_gpio_config_t const *p_config) |
Function for configuring GPIO. | |
npmx_error_t | npmx_gpio_config_get (npmx_gpio_t const *p_instance, npmx_gpio_config_t *p_config) |
Function for reading GPIO configuration. | |
npmx_error_t | npmx_gpio_mode_set (npmx_gpio_t const *p_instance, npmx_gpio_mode_t mode) |
Function for setting GPIO mode. | |
npmx_error_t | npmx_gpio_mode_get (npmx_gpio_t const *p_instance, npmx_gpio_mode_t *p_mode) |
Function for reading GPIO mode. | |
npmx_error_t | npmx_gpio_status_check (npmx_gpio_t const *p_instance, bool *p_status) |
Function for checking GPIO status of specified GPIO pin. | |
GPIO peripheral driver.
enum npmx_gpio_drive_t |
Configuration for GPIO drive current.
enum npmx_gpio_mode_t |
Configuration for GPIO mode selection.
enum npmx_gpio_pull_t |
Configuration for GPIO pull resistors. By default, all GPIOs are in NPMX_GPIO_PULL_DOWN mode.
npmx_error_t npmx_gpio_config_get | ( | npmx_gpio_t const * | p_instance, |
npmx_gpio_config_t * | p_config ) |
Function for reading GPIO configuration.
[in] | p_instance | Pointer to the GPIO instance. |
[out] | p_config | Pointer to the configuration of GPIO. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_gpio_config_set | ( | npmx_gpio_t const * | p_instance, |
npmx_gpio_config_t const * | p_config ) |
Function for configuring GPIO.
[in] | p_instance | Pointer to the GPIO instance. |
[in] | p_config | Pointer to the configuration of GPIO to be applied. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_gpio_drive_t npmx_gpio_drive_convert | ( | uint32_t | milliamperes | ) |
Function for converting milliamperes to npmx_gpio_drive_t enumeration.
[in] | milliamperes | Current in milliamperes to be converted into npmx_gpio_drive_t enumeration. |
bool npmx_gpio_drive_convert_to_ma | ( | npmx_gpio_drive_t | enum_value, |
uint32_t * | p_val ) |
Function for converting npmx_gpio_drive_t enumeration to milliamperes.
[in] | enum_value | Current defined as npmx_gpio_drive_t enumeration to be converted into milliamperes. |
[out] | p_val | Pointer to the variable that stores the conversion result. |
true | Conversion is valid. |
false | Conversion is invalid - an invalid argument was passed to the function. |
npmx_gpio_t * npmx_gpio_get | ( | npmx_instance_t * | p_pmic, |
uint8_t | idx ) |
Function for returning GPIO instance based on index.
[in] | p_pmic | Pointer to the PMIC instance. |
[in] | idx | Index of the GPIO instance. |
npmx_error_t npmx_gpio_mode_get | ( | npmx_gpio_t const * | p_instance, |
npmx_gpio_mode_t * | p_mode ) |
Function for reading GPIO mode.
[in] | p_instance | Pointer to the GPIO instance. |
[out] | p_mode | Pointer to mode of GPIO. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_gpio_mode_set | ( | npmx_gpio_t const * | p_instance, |
npmx_gpio_mode_t | mode ) |
Function for setting GPIO mode.
[in] | p_instance | Pointer to the GPIO instance. |
[in] | mode | Mode of GPIO to set. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |
npmx_error_t npmx_gpio_status_check | ( | npmx_gpio_t const * | p_instance, |
bool * | p_status ) |
Function for checking GPIO status of specified GPIO pin.
[in] | p_instance | Pointer to the GPIO instance. |
[out] | p_status | Pointer to the status of GPIO. True if specified GPIO is in a high state, false otherwise. |
NPMX_SUCCESS | Operation performed successfully. |
NPMX_ERROR_IO | Error using IO bus line. |