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);