From 28c7522e26f2edfb43089f7c013131ae8aec804b Mon Sep 17 00:00:00 2001 From: wdfk-prog <1425075683@qq.com> Date: Thu, 13 Jun 2024 09:14:24 +0800 Subject: [PATCH] =?UTF-8?q?[drivers][serial=20V1]poll=20tx=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BC=82=E5=B8=B8=E9=80=80=E5=87=BA=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/drivers/serial.h | 6 +++--- components/drivers/serial/serial.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) 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;