diff options
Diffstat (limited to 'app/usart.c')
-rw-r--r-- | app/usart.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/usart.c b/app/usart.c index 177d165..29a2978 100644 --- a/app/usart.c +++ b/app/usart.c @@ -1,7 +1,13 @@ #include "project.h" #define BUFFER_SIZE 256 -#define BIG_BUFFER_SIZE 600 + + +#define USART1_TX GPIO_USART1_TX +#define USART1_TX_PORT GPIOA +#define USART1_RX GPIO_USART1_RX +#define USART1_RX_PORT GPIOA + ring_t rx1_ring; static uint8_t rx1_ring_buf[BUFFER_SIZE]; @@ -98,11 +104,10 @@ usart_init (void) /* Enable the USART1,2 interrupt. */ nvic_enable_irq (NVIC_USART1_IRQ); - /* Map pins, and set usart2 to have pull ups */ - gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_50_MHZ, - GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX); - gpio_set_mode (GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, - GPIO_USART1_RX); + /* Map pins, and usart1 to have pull ups */ + MAP_AF_PP(USART1_TX); + MAP_INPUT_PU(USART1_RX); + /* Setup UART1 parameters. */ usart_set_baudrate (USART1, 115200); @@ -113,7 +118,7 @@ usart_init (void) usart_set_mode (USART1, USART_MODE_TX_RX); - /* Enable USART1,2 Receive interrupt. */ + /* Enable USART1 Receive interrupt. */ USART_CR1 (USART1) |= USART_CR1_RXNEIE; /* Finally enable the USARTs. */ |