uartEnd: Unlock mutex before detaching rx and tx (#554)
* uartEnd: Unlock mutex before detaching rx and tx This should solve the device freezing issue when Serial.end() is called * Unlock UART MUTEX only for detaching Rx and Tx * Thanks to @me-no-dev for pointing it out that uart->dev->conf0.val can be inside mutex lock
This commit is contained in:
parent
9618eec19e
commit
41e36a72f3
@ -197,7 +197,7 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
|
|||||||
uart->dev->conf0.val = config;
|
uart->dev->conf0.val = config;
|
||||||
#define TWO_STOP_BITS_CONF 0x3
|
#define TWO_STOP_BITS_CONF 0x3
|
||||||
#define ONE_STOP_BITS_CONF 0x1
|
#define ONE_STOP_BITS_CONF 0x1
|
||||||
|
|
||||||
if ( uart->dev->conf0.stop_bit_num == TWO_STOP_BITS_CONF) {
|
if ( uart->dev->conf0.stop_bit_num == TWO_STOP_BITS_CONF) {
|
||||||
uart->dev->conf0.stop_bit_num = ONE_STOP_BITS_CONF;
|
uart->dev->conf0.stop_bit_num = ONE_STOP_BITS_CONF;
|
||||||
uart->dev->rs485_conf.dl1_en = 1;
|
uart->dev->rs485_conf.dl1_en = 1;
|
||||||
@ -228,11 +228,12 @@ void uartEnd(uart_t* uart)
|
|||||||
vQueueDelete(uart->queue);
|
vQueueDelete(uart->queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uart->dev->conf0.val = 0;
|
||||||
|
|
||||||
|
UART_MUTEX_UNLOCK();
|
||||||
|
|
||||||
uartDetachRx(uart);
|
uartDetachRx(uart);
|
||||||
uartDetachTx(uart);
|
uartDetachTx(uart);
|
||||||
|
|
||||||
uart->dev->conf0.val = 0;
|
|
||||||
UART_MUTEX_UNLOCK();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t uartAvailable(uart_t* uart)
|
uint32_t uartAvailable(uart_t* uart)
|
||||||
@ -419,4 +420,3 @@ int log_printf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user