Go to the documentation of this file.
20 #ifndef HAL_HAL_GPIO_H
21 #define HAL_HAL_GPIO_H
50 HAL_GPIO_TRIG_NONE = GPIO_NONE,
60 HAL_GPIO_TRIG_LOW = GPIO_LOW,
64 HAL_GPIO_TRIG_HIGH = GPIO_HIGH
@ HAL_GPIO_TRIG_BOTH
IRQ occurs on either edge.
void gpio_irq_disable(gpio_t pin)
Disable the pin interrupt if configured as interrupt source.
@ HAL_GPIO_TRIG_FALLING
IRQ occurs on falling edge.
@ GPIO_IN_PD
configure as input with pull-down resistor
static void hal_gpio_irq_release(gpio_t pin)
Release a pin from being configured to trigger IRQ on state change.
static int hal_gpio_init_in(gpio_t pin, hal_gpio_pull_t pull)
Initializes the specified pin as an input.
static int hal_gpio_read(gpio_t pin)
Reads the specified pin.
@ GPIO_OUT
configure as output in push-pull mode
int gpio_init(gpio_t pin, gpio_mode_t mode)
Initialize the given pin as general purpose input or output.
@ GPIO_FALLING
emit interrupt on falling flank
@ HAL_GPIO_PULL_UP
Pull-up enabled.
static int hal_gpio_irq_init(gpio_t pin, hal_gpio_irq_handler_t handler, void *arg, hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull)
Initialize a given pin to trigger a GPIO IRQ callback.
@ GPIO_IN_PU
configure as input with pull-up resistor
@ GPIO_RISING
emit interrupt on rising flank
void gpio_write(gpio_t pin, int value)
Set the given pin to the given value.
static int hal_gpio_toggle(gpio_t pin)
Toggles the specified pin.
@ GPIO_IN
configure as input without pull resistor
gpio_mode_t hal_gpio_pull_t
hal_gpio_pull type
static void hal_gpio_irq_disable(gpio_t pin)
Disable IRQs on the passed pin.
static int hal_gpio_init_out(gpio_t pin, int val)
Initialize the specified pin as an output, setting the pin to the specified value.
int gpio_read(gpio_t pin)
Get the current value of the given pin.
void gpio_toggle(gpio_t pin)
Toggle the value of the given pin.
int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank, gpio_cb_t cb, void *arg)
Initialize a GPIO pin for external interrupt usage.
@ HAL_GPIO_PULL_DOWN
Pull-down enabled.
@ GPIO_BOTH
emit interrupt on both flanks
gpio_flank_t hal_gpio_irq_trig_t
hal_gpio_irq_trig type
void gpio_irq_enable(gpio_t pin)
Enable pin interrupt if configured as interrupt source.
@ HAL_GPIO_PULL_NONE
Pull-up/down not enabled.
void(* gpio_cb_t)(void *arg)
Signature of event callback functions triggered from interrupts.
static void hal_gpio_write(gpio_t pin, int val)
Write a value (either high or low) to the specified pin.
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
Available pin modes.
gpio_cb_t hal_gpio_irq_handler_t
Function proto for GPIO irq handler functions.
static void hal_gpio_irq_enable(gpio_t pin)
Enable IRQs on the passed pin.
@ HAL_GPIO_TRIG_RISING
IRQ occurs on rising edge.