aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_uart.c')
-rw-r--r--os/hal/src/hal_uart.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/os/hal/src/hal_uart.c b/os/hal/src/hal_uart.c
index 8db39deb9..72d6221dd 100644
--- a/os/hal/src/hal_uart.c
+++ b/os/hal/src/hal_uart.c
@@ -120,13 +120,16 @@ void uartStop(UARTDriver *uartp) {
osalDbgCheck(uartp != NULL);
osalSysLock();
+
osalDbgAssert((uartp->state == UART_STOP) || (uartp->state == UART_READY),
"invalid state");
uart_lld_stop(uartp);
- uartp->state = UART_STOP;
+ uartp->config = NULL;
+ uartp->state = UART_STOP;
uartp->txstate = UART_TX_IDLE;
uartp->rxstate = UART_RX_IDLE;
+
osalSysUnlock();
}