26#include "soc/gpio_reg.h"
35#define GPIO_PORT(num) (num)
36#if GPIO_PORT_NUMOF > 1
37# define GPIO_PORT_NUM(port) (port)
39# define GPIO_PORT_NUM(port) 0
44 static_assert(GPIO_PORT_NUMOF < 3);
45 volatile uword_t *in = (uint32_t *)GPIO_IN_REG;
49 in = (uint32_t *)GPIO_IN1_REG;
58 static_assert(GPIO_PORT_NUMOF < 3);
59 volatile uword_t *out = (uint32_t *)GPIO_OUT_REG;
62 out = (uint32_t *)GPIO_OUT1_REG;
71 static_assert(GPIO_PORT_NUMOF < 3);
72 volatile uword_t *out_w1ts = (uint32_t *)GPIO_OUT_W1TS_REG;
75 out_w1ts = (uint32_t)GPIO_OUT1_W1TS;
84 static_assert(GPIO_PORT_NUMOF < 3);
85 volatile uword_t *out_w1tc = (uint32_t *)GPIO_OUT_W1TC_REG;
88 out_w1tc = (uint32_t)GPIO_OUT1_W1TC;
97 static_assert(GPIO_PORT_NUMOF < 3);
98 volatile uword_t *out = (uint32_t *)GPIO_OUT_REG;
101 out = (uint32_t *)GPIO_OUT1_REG;
111 static_assert(GPIO_PORT_NUMOF < 3);
112 volatile uword_t *out = (uint32_t *)GPIO_OUT_REG;
115 out = (uint32_t *)GPIO_OUT1_REG;
147 return (num < GPIO_PORT_NUMOF);
Architecture specific GPIO functions for ESP8266.
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
static uint8_t gpio_get_pin_num(gpio_t pin)
Extract the pin number from a gpio_t
static void gpio_ll_set(gpio_port_t port, uword_t mask)
Perform an reg |= mask operation on the I/O register of the port.
static gpio_port_t gpio_port_pack_addr(void *addr)
Pack a pointer into a gpio_port_t.
static uword_t gpio_ll_read(gpio_port_t port)
Get the current input value of all GPIO pins of the given port as bitmask.
static gpio_port_t gpio_get_port(gpio_t pin)
Extract the gpio_port_t from a gpio_t
#define GPIO_PORT_NUM(port)
Get the number of the GPIO port belonging to the given gpio_port_t value.
static void * gpio_port_unpack_addr(gpio_port_t port)
Extract a data pointer that was packed by gpio_port_pack_addr.
#define GPIO_PORT(num)
Get the gpio_port_t value of the port identified by num.
static bool is_gpio_port_num_valid(uint_fast8_t num)
Check if the given number is a valid argument for GPIO_PORT.
static uword_t gpio_ll_read_output(gpio_port_t port)
Get the current output value of all GPIO pins of the given port as bitmask.
static void gpio_ll_clear(gpio_port_t port, uword_t mask)
Perform an reg &= ~mask operation on the I/O register of the port.
static void gpio_ll_toggle(gpio_port_t port, uword_t mask)
Perform an reg ^= mask operation on the I/O register of the port.
static void gpio_ll_write(gpio_port_t port, uword_t state)
Perform a masked write operation on the I/O register of the port.
uintptr_t gpio_port_t
GPIO port type.
uint< NUM > _t uword_t
Word sized unsigned integer.