Change temp to uint32_t in serial_format

Fix bug where calling set_format in MBED (which calls serial_format) causes the CTRL register to become corrupt due to saving its initial value to a uint8_t when the register is 32 bit wide
pull/15382/head
grumpyengineer 2023-02-21 19:32:32 +00:00 committed by GitHub
parent 5c8e60f80b
commit e167992769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ void serial_baud(serial_t *obj, int baudrate)
void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits)
{
LPUART_Type *base = uart_addrs[obj->index];
uint8_t temp;
uint32_t temp;
/* Set bit count and parity mode. */
temp = base->CTRL & ~(LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK | LPUART_CTRL_M_MASK);
if (parity != ParityNone) {