mirror of https://github.com/ARMmbed/mbed-os.git
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 widepull/15382/head
parent
e167992769
commit
fbf4ac03d7
|
@ -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)
|
void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits)
|
||||||
{
|
{
|
||||||
LPUART_Type *base = uart_addrs[obj->index];
|
LPUART_Type *base = uart_addrs[obj->index];
|
||||||
uint8_t temp;
|
uint32_t temp;
|
||||||
/* Set bit count and parity mode. */
|
/* Set bit count and parity mode. */
|
||||||
temp = base->CTRL & ~(LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK | LPUART_CTRL_M_MASK);
|
temp = base->CTRL & ~(LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK | LPUART_CTRL_M_MASK);
|
||||||
if (parity != ParityNone) {
|
if (parity != ParityNone) {
|
||||||
|
|
Loading…
Reference in New Issue