diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h index 9438ed43f9..d90b90607c 100644 --- a/components/drivers/include/drivers/serial.h +++ b/components/drivers/include/drivers/serial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2023, RT-Thread Development Team + * Copyright (c) 2006-2024, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -85,8 +85,8 @@ #define RT_SERIAL_TX_DATAQUEUE_SIZE 2048 #define RT_SERIAL_TX_DATAQUEUE_LWM 30 -#define RT_SERIAL_FLOWCONTROL_CTSRTS 1 -#define RT_SERIAL_FLOWCONTROL_NONE 0 +#define RT_SERIAL_FLOWCONTROL_CTSRTS 1 +#define RT_SERIAL_FLOWCONTROL_NONE 0 /* Default config for serial_configure structure */ #define RT_SERIAL_CONFIG_DEFAULT \ diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index f2e19aa760..19043e2ad2 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2023, RT-Thread Development Team + * Copyright (c) 2006-2024, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -278,7 +278,9 @@ rt_inline int _serial_poll_tx(struct rt_serial_device *serial, const rt_uint8_t serial->ops->putc(serial, '\r'); } - serial->ops->putc(serial, *data); + if(serial->ops->putc(serial, *data) < 0) { + break; + } ++ data; -- length;