GPIO (General Purpose Input/Output) interface. More...
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | hw_gpio_t |
GPIO logical pin structure. More... | |
Macros | |
#define | HW_GPIO_MAX_COUNT 50 |
Maximum number of GPIO pins. More... | |
Typedefs | |
typedef struct hw_gpio_t | hw_gpio_t |
GPIO logical pin structure. | |
typedef void(* | hw_gpio_callback_t) (uint8_t pin, hw_gpio_event_t event, void *userdata) |
GPIO interrupt callback function pointer. More... | |
Enumerations | |
enum | hw_gpio_mode_t { HW_GPIO_NONE = 0, HW_GPIO_INPUT, HW_GPIO_PULLUP, HW_GPIO_PULLDOWN, HW_GPIO_OUTPUT, HW_GPIO_SPI, HW_GPIO_I2C, HW_GPIO_UART, HW_GPIO_PWM, HW_GPIO_ADC, HW_GPIO_UNKNOWN } |
GPIO mode flags for configuring GPIO pins. More... | |
enum | hw_gpio_event_t { HW_GPIO_RISING = (1 << 0), HW_GPIO_FALLING = (1 << 1) } |
GPIO mode flags for configuring GPIO pins. More... | |
Functions | |
uint8_t | hw_gpio_count (void) |
Get the total number of available GPIO pins. More... | |
static bool | hw_gpio_valid (hw_gpio_t *gpio) |
Validate the GPIO pin. More... | |
void | hw_gpio_set_callback (hw_gpio_callback_t callback, void *userdata) |
Set the global GPIO interrupt callback handler. More... | |
hw_gpio_t | hw_gpio_init (uint8_t pin, hw_gpio_mode_t mode) |
Initialize a GPIO pin with the specified mode. More... | |
void | hw_gpio_finalize (hw_gpio_t *gpio) |
Finalize and release a GPIO pin. More... | |
hw_gpio_mode_t | hw_gpio_get_mode (hw_gpio_t *gpio) |
Get the current mode configuration of a GPIO pin. More... | |
void | hw_gpio_set_mode (hw_gpio_t *gpio, hw_gpio_mode_t mode) |
Set the current mode configuration of a GPIO pin. More... | |
bool | hw_gpio_get (hw_gpio_t *gpio) |
Read the current state of a GPIO pin. More... | |
void | hw_gpio_set (hw_gpio_t *gpio, bool value) |
Set the state of a GPIO pin. More... | |