mirror of https://github.com/ARMmbed/mbed-os.git
STM32F3: Fix serial IRQ handling
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.pull/10774/head
parent
b88b94eb75
commit
d6a48218ee
|
@ -58,12 +58,12 @@ static void uart_irq(UARTName uart_name)
|
|||
UART_HandleTypeDef *huart = &uart_handlers[id];
|
||||
if (serial_irq_ids[id] != 0) {
|
||||
if (__HAL_UART_GET_FLAG(huart, UART_FLAG_TXE) != RESET) {
|
||||
if (__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET) {
|
||||
if (__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET && __HAL_UART_GET_IT_SOURCE(huart, UART_IT_TXE)) {
|
||||
irq_handler(serial_irq_ids[id], TxIrq);
|
||||
}
|
||||
}
|
||||
if (__HAL_UART_GET_FLAG(huart, UART_FLAG_RXNE) != RESET) {
|
||||
if (__HAL_UART_GET_IT(huart, UART_IT_RXNE) != RESET) {
|
||||
if (__HAL_UART_GET_IT(huart, UART_IT_RXNE) != RESET && __HAL_UART_GET_IT_SOURCE(huart, UART_IT_RXNE)) {
|
||||
irq_handler(serial_irq_ids[id], RxIrq);
|
||||
/* Flag has been cleared when reading the content */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue