From 3f4d2d02f28c41a11c36669993010824a4b382c5 Mon Sep 17 00:00:00 2001 From: OPTOC <9159397+optoc@user.noreply.gitee.com> Date: Wed, 20 Aug 2025 16:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=B9=E6=8D=AE=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E8=BF=9E=E6=8E=A5=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/drivers/sertrf/device.c | 9 +++++++++ app/drivers/sertrf/device.h | 8 -------- app/drivers/sertrf/sertrf.c | 23 ++++++++++++++++++++++- app/drivers/sertrf/sertrf.h | 4 ++++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/app/drivers/sertrf/device.c b/app/drivers/sertrf/device.c index 837e88f..51827c5 100644 --- a/app/drivers/sertrf/device.c +++ b/app/drivers/sertrf/device.c @@ -1,6 +1,15 @@ #include "device.h" #include "config/board_config.h" +/** + * @brief PC OR 手机数据内部接口 + * + * @param port 由对应的驱动提供的绑定接口获得的句柄 + * @param type 对应的数据接口类型 + * @retval 0 成功 + */ +static uint8_t pc_device_choice_inside(device_t *port, uint8_t type, uint8_t connect); + uint8_t device_init(device_t *port) { uint8_t res = DEVICE_OK; diff --git a/app/drivers/sertrf/device.h b/app/drivers/sertrf/device.h index f43931b..f953358 100644 --- a/app/drivers/sertrf/device.h +++ b/app/drivers/sertrf/device.h @@ -104,14 +104,6 @@ uint8_t wifi_init(init_device_t *port); * @retval 0 成功 */ uint8_t embedded_device_choice(device_t *port, uint8_t type); -/** - * @brief PC OR 手机数据内部接口 - * - * @param port 由对应的驱动提供的绑定接口获得的句柄 - * @param type 对应的数据接口类型 - * @retval 0 成功 - */ -static uint8_t pc_device_choice_inside(device_t *port, uint8_t type, uint8_t connect); /** * @brief PC OR 手机数据接口 * diff --git a/app/drivers/sertrf/sertrf.c b/app/drivers/sertrf/sertrf.c index 08dc118..3188cf2 100644 --- a/app/drivers/sertrf/sertrf.c +++ b/app/drivers/sertrf/sertrf.c @@ -43,8 +43,29 @@ void embedded_thread(void* arg) // SYS_LOG_INF("data : %s", data); embedded_device_write(&sertrf.device, data, embedded_size); } + pc_link_rgb_color(sertrf.device.connect_pc); //需要添加一些延时,否则会卡死,导致看门狗复位 // vTaskDelay(( TickType_t ) 1000 / configTICK_RATE_HZ); os_thread_sleep(1); } -} \ No newline at end of file +} +void pc_link_rgb_color(uint8_t connect) +{ + static uint8_t last_connect = 0; + if(connect != last_connect) + { + switch (connect) + { + case DISCONNECT: + rgb_color_change(0, RGB_COLOR_RAD); + break; + case CONNECT_WIFI: + rgb_color_change(0, RGB_COLOR_GREEN); + break; + case CONNECT_BLE: + rgb_color_change(0, RGB_COLOR_BLUE); + break; + } + last_connect = connect; + } +} diff --git a/app/drivers/sertrf/sertrf.h b/app/drivers/sertrf/sertrf.h index 8070730..92cde7b 100644 --- a/app/drivers/sertrf/sertrf.h +++ b/app/drivers/sertrf/sertrf.h @@ -34,4 +34,8 @@ void sertrf_status(void); * @brief embedded thread */ void embedded_thread(void* arg); +/** + * @brief 根据连接状态显示不同的颜色 +*/ +void pc_link_rgb_color(uint8_t connect);