Go to the documentation of this file.
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)
269 return (gpio1 == gpio2);
void gpio_irq_disable(gpio_t pin)
Disable the pin interrupt if configured as interrupt source.
@ GPIO_IN_PD
configure as input with pull-down resistor
@ GPIO_OD
configure as output in open-drain mode without pull resistor
void gpio_clear(gpio_t pin)
Set the given pin to LOW.
void gpio_set(gpio_t pin)
Set the given pin to HIGH.
@ GPIO_OUT
configure as output in push-pull mode
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.
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
@ 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 gpio_is_equal(gpio_t gpio1, gpio_t gpio2)
Test if a GPIO pin is equal to another GPIO pin.
void * arg
optional argument
@ GPIO_IN
configure as input without pull resistor
Default interrupt context for GPIO pins.
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
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.
@ GPIO_BOTH
emit interrupt on both flanks
void gpio_irq_enable(gpio_t pin)
Enable pin interrupt if configured as interrupt source.
void(* gpio_cb_t)(void *arg)
Signature of event callback functions triggered from interrupts.
gpio_cb_t cb
interrupt callback
gpio_mode_t
Available pin modes.
gpio_mode_t
Available pin modes.
unsigned int gpio_t
GPIO type identifier.
#define GPIO_UNDEF
GPIO pin not defined.