make USART more noise resistant

This commit is contained in:
King Kévin 2016-01-29 00:25:29 +01:00
parent 765fb2e338
commit 875e0de18b
1 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,8 @@ void usart_setup(void)
{
rcc_periph_clock_enable(USART_RCC); // enable USART1 clock
gpio_set_mode(USART_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USART_PIN_TX); // setup GPIO pin USART transmit
gpio_set_mode(USART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, USART_PIN_RX); // setup GPIO pin USART receive
gpio_set_mode(USART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USART_PIN_RX); // setup GPIO pin USART receive
gpio_set(USART_PORT, USART_PIN_RX); // pull up to avoid noise when not connected
/* setup UART parameters */
usart_set_baudrate(USART, 115200);