36#define GPIO_PORT_NUMOF 5
41#define GPIO_PORT(num) (GPIOA_BASE + ((num) << 10))
46#define GPIO_PORT_NUM(port) (((port) - GPIOA_BASE) >> 10)
50 return ((GPIO_Type *)port)->ISTAT;
55 return ((GPIO_Type *)port)->OCTL;
60 ((GPIO_Type *)port)->BOP = mask;
65 ((GPIO_Type *)port)->BOP = mask << 16;
71 ((GPIO_Type *)port)->OCTL ^= mask;
77 ((GPIO_Type *)port)->OCTL = value;
82 return pin & 0xfffffff0UL;
97 if (port < GPIOA_BASE) {
106 return num < GPIO_PORT_NUMOF;
Platform-independent access to architecture details.
Peripheral GPIO Low-Level API.
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
static void * gpio_port_unpack_addr(gpio_port_t port)
Extract a data pointer that was packed by gpio_port_pack_addr.
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.
Shared CPU specific definitions for the STM32 family.