diff options
author | fishsoupisgood <github@madingley.org> | 2020-06-14 10:55:07 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-06-14 10:55:07 +0100 |
commit | 0060468326b7ab0cd07d0d80a84118e7c5bcf348 (patch) | |
tree | 8be8ad7b1cb23be4765b9d94a7b8fcefa4d67e27 /app/usart.c | |
parent | dbc21c1e5dfd95248fe2cd7da6d96c92bdbb97a4 (diff) | |
download | robs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.tar.gz robs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.tar.bz2 robs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.zip |
add tacho
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. */ |