wip working usart, not receiving over tty
This commit is contained in:
34
build/gpio.i
34
build/gpio.i
@@ -1,5 +1,5 @@
|
||||
# 0 "src/gpio.c"
|
||||
# 1 "/home/alex/code/own/c-compile-experiments//"
|
||||
# 1 "/home/alex/code/own/stm32-falling-sand//"
|
||||
# 0 "<built-in>"
|
||||
#define __STDC__ 1
|
||||
# 0 "<built-in>"
|
||||
@@ -1995,10 +1995,34 @@ struct gpio {
|
||||
volatile uint32_t ODR;
|
||||
volatile uint32_t BSRR;
|
||||
volatile uint32_t LCKR;
|
||||
volatile uint32_t AFRL[2];
|
||||
volatile uint32_t AFRH[2];
|
||||
volatile uint32_t AFRL;
|
||||
volatile uint32_t AFRH;
|
||||
};
|
||||
|
||||
#define GPIOA_BASE_ADDR (0x40020000U)
|
||||
#define GPIOA ((struct gpio *) GPIOA_BASE_ADDR)
|
||||
|
||||
|
||||
#define GPIO_MODER_MODER3_BIT 7
|
||||
#define GPIO_MODER_MODER3_MASK (0b11)
|
||||
#define GPIO_MODER_MODER3_AF (0b10)
|
||||
|
||||
#define GPIO_MODER_MODER2_BIT 4
|
||||
#define GPIO_MODER_MODER2_MASK (0b11)
|
||||
#define GPIO_MODER_MODER2_AF (0b10)
|
||||
|
||||
|
||||
#define GPIO_AFRL_AFRL3_BIT 12
|
||||
#define GPIO_AFRL_AFRL3_MASK (0b1111)
|
||||
#define GPIO_AFRL_AFRL3_USART2_RX (0b0111)
|
||||
|
||||
#define GPIO_AFRL_AFRL2_BIT 8
|
||||
#define GPIO_AFRL_AFRL2_MASK (0b1111)
|
||||
#define GPIO_AFRL_AFRL2_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)))
|
||||
@@ -2020,9 +2044,9 @@ typedef enum {
|
||||
|
||||
void gpio_set_mode(uint16_t pin, GPIO_MODE mode);
|
||||
void gpio_write(uint16_t pin,
|
||||
# 40 "src/gpio.h" 3 4
|
||||
# 64 "src/gpio.h" 3 4
|
||||
_Bool
|
||||
# 40 "src/gpio.h"
|
||||
# 64 "src/gpio.h"
|
||||
val);
|
||||
# 5 "src/gpio.c" 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user