uart: add ability to configure byte length
Signed-off-by: Jean-Nicolas Graux <nicogrx@gmail.com>
This commit is contained in:
parent
a89417e26e
commit
8cb769d55d
2 changed files with 17 additions and 0 deletions
|
|
@ -160,4 +160,14 @@ static inline UART_Parity uart_get_parity(int uart_num) {
|
|||
return (UART_Parity)((UART(uart_num).CONF0 & UART_CONF0_PARITY) != 0);
|
||||
}
|
||||
|
||||
/* Set uart data bits length to the desired value */
|
||||
static inline void uart_set_byte_length(int uart_num, UART_ByteLength byte_length) {
|
||||
UART(uart_num).CONF0 = SET_FIELD(UART(uart_num).CONF0, UART_CONF0_BYTE_LEN, byte_length);
|
||||
}
|
||||
|
||||
/* Returns the current data bits length for the UART */
|
||||
static inline UART_ByteLength uart_get_byte_length(int uart_num) {
|
||||
return (UART_ByteLength)(FIELD2VAL(UART_CONF0_BYTE_LEN, UART(uart_num).CONF0));
|
||||
}
|
||||
|
||||
#endif /* _ESP_UART_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue