添加根据不同连接状态显示不同颜色
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 手机数据接口
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user