lm4f/uart: Implemented a function to get the current stop bits setting for a UART

This commit is contained in:
dragonmux
2022-08-23 03:14:45 +01:00
committed by Piotr Esden-Tempski
parent 78ace36308
commit f0262cb4a9
2 changed files with 8 additions and 0 deletions

View File

@@ -446,6 +446,7 @@ void uart_set_baudrate(uint32_t uart, uint32_t baud);
void uart_set_databits(uint32_t uart, uint8_t databits); void uart_set_databits(uint32_t uart, uint8_t databits);
uint8_t uart_get_databits(uint32_t uart); uint8_t uart_get_databits(uint32_t uart);
void uart_set_stopbits(uint32_t uart, uint8_t stopbits); 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_parity(uint32_t uart, enum uart_parity parity);
void uart_set_mode(uint32_t uart, uint32_t mode); void uart_set_mode(uint32_t uart, uint32_t mode);
void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow); void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow);

View File

@@ -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 * \brief Set UART parity
* *