lm4f/uart: Implemented a function to get the current databits setting for a UART
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
4d23ac8714
commit
78ace36308
@@ -444,6 +444,7 @@ BEGIN_DECLS
|
|||||||
|
|
||||||
void uart_set_baudrate(uint32_t uart, uint32_t baud);
|
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);
|
||||||
void uart_set_stopbits(uint32_t uart, uint8_t stopbits);
|
void uart_set_stopbits(uint32_t uart, uint8_t stopbits);
|
||||||
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);
|
||||||
|
|||||||
@@ -151,6 +151,12 @@ void uart_set_databits(uint32_t uart, uint8_t databits)
|
|||||||
UART_LCRH(uart) = reg32;
|
UART_LCRH(uart) = reg32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t uart_get_databits(uint32_t uart)
|
||||||
|
{
|
||||||
|
const uint8_t bits = (UART_LCRH(uart) & UART_LCRH_WLEN_MASK) >> 5;
|
||||||
|
return bits + 5;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set UART stopbits
|
* \brief Set UART stopbits
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user