80#include "periph_cpu.h"
81#include "periph_conf.h"
99#define GPIO_PIN(x,y) ((gpio_t)((x & 0) | y))
106#define GPIO_UNDEF ((gpio_t)(UINT_MAX))
117#ifndef HAVE_GPIO_MODE_T
133#ifndef HAVE_GPIO_FLANK_T
151#ifndef HAVE_GPIO_ISR_CTX_T
173#if defined(MODULE_PERIPH_GPIO_IRQ) || defined(DOXYGEN)
271 return (gpio1 == gpio2);
void gpio_toggle(gpio_t pin)
Toggle the value of the given pin.
void(* gpio_cb_t)(void *arg)
Signature of event callback functions triggered from interrupts.
static int gpio_is_valid(gpio_t gpio)
Test if a GPIO pin is a valid pin and not declared as undefined.
gpio_flank_t
Definition of possible active flanks for external interrupt mode.
void gpio_clear(gpio_t pin)
Set the given pin to LOW.
#define GPIO_UNDEF
GPIO pin not defined.
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.
gpio_mode_t
Available pin modes.
void gpio_set(gpio_t pin)
Set the given pin to HIGH.
void gpio_write(gpio_t pin, int value)
Set the given pin to the given value.
void gpio_irq_disable(gpio_t pin)
Disable the pin interrupt if configured as interrupt source.
void gpio_irq_enable(gpio_t pin)
Enable pin interrupt if configured as interrupt source.
int gpio_read(gpio_t pin)
Get the current value of the given pin.
int gpio_init(gpio_t pin, gpio_mode_t mode)
Initialize the given pin as general purpose input or output.
unsigned int gpio_t
GPIO type identifier.
static int gpio_is_equal(gpio_t gpio1, gpio_t gpio2)
Test if a GPIO pin is equal to another GPIO pin.
@ GPIO_FALLING
emit interrupt on falling flank
@ GPIO_RISING
emit interrupt on rising flank
@ GPIO_BOTH
emit interrupt on both flanks
@ GPIO_OUT
configure as output in push-pull mode
@ GPIO_IN
configure as input without pull resistor
@ GPIO_OD
configure as output in open-drain mode without pull resistor
@ GPIO_IN_PU
configure as input with pull-up resistor
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
@ GPIO_IN_PD
configure as input with pull-down resistor
gpio_mode_t
Available pin modes.
Default interrupt context for GPIO pins.
void * arg
optional argument
gpio_cb_t cb
interrupt callback