37 #ifndef GPIO_LL_ARCH_H
38 #define GPIO_LL_ARCH_H
51 #define GPIO_PORT_NUMBERING_ALPHABETIC 1
56 #if _GPIO_PORT_A_PIN_COUNT
57 # define GPIO_PORT_0 0
60 #if _GPIO_PORT_B_PIN_COUNT
61 # define GPIO_PORT_1 1
64 #if _GPIO_PORT_C_PIN_COUNT
65 # define GPIO_PORT_2 2
68 #if _GPIO_PORT_D_PIN_COUNT
69 # define GPIO_PORT_3 3
72 #if _GPIO_PORT_E_PIN_COUNT
73 # define GPIO_PORT_4 4
76 #if _GPIO_PORT_F_PIN_COUNT
77 # define GPIO_PORT_6 6
80 #if _GPIO_PORT_G_PIN_COUNT
81 # define GPIO_PORT_7 7
84 #if _GPIO_PORT_H_PIN_COUNT
85 # define GPIO_PORT_8 8
88 #if _GPIO_PORT_I_PIN_COUNT
89 # define GPIO_PORT_9 9
92 #if _GPIO_PORT_J_PIN_COUNT
93 # define GPIO_PORT_10 10
96 #if _GPIO_PORT_K_PIN_COUNT
97 # define GPIO_PORT_11 11
144 return GPIO_PortInGet(port);
149 return GPIO_PortOutGet(port);
154 GPIO_PortOutSet(port, mask);
159 GPIO_PortOutClear(port, mask);
164 GPIO_PortOutToggle(port, mask);
169 GPIO->P[port].DOUT = value;
189 return GPIO_PORT_VALID(num);
#define GPIO
GPIO register bank.
static uint8_t gpio_get_pin_num(gpio_t pin)
Extract the pin number 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 void gpio_ll_set(gpio_port_t port, uword_t mask)
Perform an reg |= mask operation on the I/O register of the port.
gpio_port_t gpio_port(uword_t num)
Get the gpio_port_t value of the port number num.
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
uword_t gpio_port_num(gpio_port_t port)
Get the number of the GPIO port port refers to.
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.