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

@@ -17,6 +17,10 @@ struct gpio {
volatile uint32_t AFRH; // Alternative function high register
};
// AFRH, AFRL registers
#define GPIO_AF_USART2_RX (0b0111) // Alternative function 7 (AF7)
#define GPIO_AF_USART2_TX (0b0111) // Alternative function 7 (AF7)
#define GPIO_BASE_ADDR (0x40020000U)
#define GPIO_PORT_OFFSET (0x400U)
#define GPIO(port) ((struct gpio*)(uintptr_t)(GPIO_BASE_ADDR + (GPIO_PORT_OFFSET * port)))