Add usart.{h, c}
This commit is contained in:
11
build/main.i
11
build/main.i
@@ -2100,6 +2100,9 @@ struct rcc {
|
||||
#define RCC_APB1ENR_PWREN_BIT 28
|
||||
#define RCC_APB1ENR_PWREN_CLOCK_ENABLE (1 << RCC_APB1ENR_PWREN_BIT)
|
||||
|
||||
#define RCC_APB1ENR_USART2EN_BIT 17
|
||||
#define RCC_APB1ENR_USART2EN_ENABLE (1 << RCC_APB1ENR_USART2EN_BIT)
|
||||
|
||||
#define RCC_APB1ENR_TIM4_BIT 2
|
||||
#define RCC_APB1ENR_TIM4_ENABLE (1 << RCC_APB1ENR_TIM4_BIT)
|
||||
# 5 "src/main.c" 2
|
||||
@@ -2123,6 +2126,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)))
|
||||
@@ -2146,9 +2153,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);
|
||||
# 6 "src/main.c" 2
|
||||
# 1 "src/flash.h" 1
|
||||
|
||||
Reference in New Issue
Block a user