Add usart.{h, c}

This commit is contained in:
Alexander Heldt
2025-01-01 12:30:57 +01:00
parent 992b3c5b97
commit 95455a7161
18 changed files with 9159 additions and 478 deletions

View File

@@ -1999,6 +1999,10 @@ struct gpio {
volatile uint32_t AFRH;
};
#define GPIO_AF_USART2_RX (0b0111)
#define GPIO_AF_USART2_TX (0b0111)
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))
@@ -2022,9 +2026,9 @@ typedef enum {
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
void gpio_set_af(uint16_t pin, uint8_t af);
void gpio_write(uint16_t pin,
# 42 "src/gpio.h" 3 4
# 46 "src/gpio.h" 3 4
_Bool
# 42 "src/gpio.h"
# 46 "src/gpio.h"
val);
# 5 "src/gpio.c" 2