diff --git a/include/libopencm3/lm4f/uart.h b/include/libopencm3/lm4f/uart.h index 3f3aa661..fbde2229 100644 --- a/include/libopencm3/lm4f/uart.h +++ b/include/libopencm3/lm4f/uart.h @@ -446,6 +446,7 @@ void uart_set_baudrate(uint32_t uart, uint32_t baud); void uart_set_databits(uint32_t uart, uint8_t databits); uint8_t uart_get_databits(uint32_t uart); void uart_set_stopbits(uint32_t uart, uint8_t stopbits); +uint8_t uart_get_stopbits(uint32_t uart); void uart_set_parity(uint32_t uart, enum uart_parity parity); void uart_set_mode(uint32_t uart, uint32_t mode); void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow); diff --git a/lib/lm4f/uart.c b/lib/lm4f/uart.c index 725c52cb..62c19cb9 100644 --- a/lib/lm4f/uart.c +++ b/lib/lm4f/uart.c @@ -172,6 +172,13 @@ void uart_set_stopbits(uint32_t uart, uint8_t stopbits) } } +uint8_t uart_get_stopbits(uint32_t uart) +{ + if (UART_LCRH(uart) & UART_LCRH_STP2) + return 2; + return 1; +} + /** * \brief Set UART parity *