8000 Disable uart interrupt in uart_debug_write · stm32duino/Arduino_Core_STM32@a04106f · GitHub
[go: up one dir, main page]

Skip to content

Commit a04106f

Browse files
benwafflefpistm
authored andcommitted
Disable uart interrupt in uart_debug_write
Re-enable Serial Rx
1 parent d12cc76 commit a04106f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cores/arduino/stm32/uart.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,21 @@ size_t uart_debug_write(uint8_t *data, uint32_t size)
605605
}
606606
}
607607

608+
HAL_NVIC_DisableIRQ(serial_debug.irq);
609+
608610
while (HAL_UART_Transmit(uart_handlers[serial_debug.index], data, size, TX_TIMEOUT) != HAL_OK) {
609611
if ((HAL_GetTick() - tickstart) >= TX_TIMEOUT) {
610-
return 0;
612+
size = 0;
613+
break;
611614
}
612615
}
613616

617+
serial_t *obj = rx_callback_obj[serial_debug.index];
618+
if (obj && !serial_rx_active(obj)) {
619+
HAL_UART_Receive_IT(uart_handlers[obj->index], &(obj->recv), 1);
620+
}
621+
HAL_NVIC_EnableIRQ(serial_debug.irq);
622+
614623
return size;
615624
}
616625

0 commit comments

Comments
 (0)
0