Commit cfedf395 authored by 薛小虎's avatar 薛小虎

feat: 添加经典蓝牙应用

parent 49650f37
# Embed the server root certificate into the final binary
idf_build_get_property(project_dir PROJECT_DIR)
idf_component_register(SRCS "bt_app_main.c" "bt_app_hf.c" "bt_app_core.c" "gatts_table_creat_demo.c"
idf_component_register(SRCS "app_BT_User.c" "bt_app_main.c" "bt_app_hf.c" "bt_app_core.c" "gatts_table_creat_demo.c"
"simple_ota_example.c"
"Protocol_CRC16.c"
"Protocol_Lib.c"
......
......@@ -26,7 +26,7 @@ void Uart_ID01_process(void)
{
uint8_t ID01[6] = {0x00,0x00,0x00,0x00,0x00,0x00};
if(Ble_Sts_Ctrl.Navi_Updat)
if(Ble_User.Navi_Updat)
{
ID01[0] = Ble_Navi_Data.Navi_Sts;
ID01[1] = Ble_Navi_Data.Navi_Turn;//赋值为蓝牙收到的转向编码值
......@@ -44,7 +44,7 @@ void Uart_ID01_process(void)
void Uart_ID12_process(void)
{
uint8_t ID12[2] = {0x00,0x00};
ID12[1] = Ble_Sts_Ctrl.Ble_Sts;
ID12[1] = Ble_User.Ble_Sts;
Protocol_Send(0x12,ID12,2);
}
......
#include "app_BT_User.h"
#define TAG "APP_BLE_USER"
BT_User_Control_Struct BT_User;
#ifndef _APP_BT_USER_H_
#define _APP_BT_USER_H_
#include <stdlib.h>
typedef enum
{
BT_Idle = 0,
BT_Conn,
BT_Pair,
BT_Authr,
}BT_Sts_Enum;
typedef struct
{
uint8_t BT_Sts;
}BT_User_Control_Struct;
extern BT_User_Control_Struct BT_User;
#endif
\ No newline at end of file
......@@ -33,7 +33,7 @@ SemaphoreHandle_t BleRecSuc_Semaphore;
Ble_User_Control_Struct Ble_Sts_Ctrl;
Ble_User_Control_Struct Ble_User;
Ble_Navi_Info_Struct Ble_Navi_Data;
......@@ -309,8 +309,8 @@ void Ble_MsgRec_Authr_Result_Analysis(void )
//Authr result
if(BleRecData.Msg.Param[0] == 0)
{
Ble_Sts_Ctrl.Ble_Sts = Ble_Authr;
Ble_Sts_Ctrl.Request_Navi = 1;
Ble_User.Ble_Sts = Ble_Authr;
Ble_User.Request_Navi = 1;
}
}
......@@ -321,7 +321,7 @@ void Ble_Msg_RequestNavi_RLY(void )
uint8_t total_frame = 0;
uint8_t trans_len = 0;
if(Ble_Sts_Ctrl.Request_Navi)
if(Ble_User.Request_Navi)
{
BleTransData.Msg.FrameHeader = 0x24;
BleTransData.Msg.Cmd = 0x14;
......@@ -371,7 +371,7 @@ void Ble_Msg_RequestNavi_RLY(void )
// vTaskDelay(1);
}
Ble_Sts_Ctrl.Request_Navi = 0;
Ble_User.Request_Navi = 0;
}
......@@ -392,7 +392,7 @@ void Ble_MsgRec_Navi_Analysis(void )
printf("Navi sts %d Navi_Turn %x Navi_Dte0 %x Navi_Dte1 %x Navi_Dte2 %x Navi_Dte3 %x\r\n", \
Ble_Navi_Data.Navi_Sts, Ble_Navi_Data.Navi_Turn, Ble_Navi_Data.Navi_Dte[0], Ble_Navi_Data.Navi_Dte[1], Ble_Navi_Data.Navi_Dte[2],Ble_Navi_Data.Navi_Dte[3]);
Ble_Sts_Ctrl.Navi_Updat = 1;
Ble_User.Navi_Updat = 1;
}
......@@ -430,9 +430,9 @@ void Ble_Rec_Msg_Analysis_Process(void )
void Ble_Connect_Event_Pro(void )
{
Ble_Sts_Ctrl.Ble_Sts = Ble_Conn;
Ble_Sts_Ctrl.Request_Navi = 0;
Ble_Sts_Ctrl.Navi_Updat = 0;
Ble_User.Ble_Sts = Ble_Conn;
Ble_User.Request_Navi = 0;
Ble_User.Navi_Updat = 0;
Ble_Clear_Tx_Buffer();
Ble_Clear_Rx_Buffer();
......@@ -441,9 +441,9 @@ void Ble_Connect_Event_Pro(void )
void Ble_DisConnect_Event_Pro(void )
{
Ble_Sts_Ctrl.Ble_Sts = Ble_Idle;
Ble_Sts_Ctrl.Request_Navi = 0;
Ble_Sts_Ctrl.Navi_Updat = 0;
Ble_User.Ble_Sts = Ble_Idle;
Ble_User.Request_Navi = 0;
Ble_User.Navi_Updat = 0;
RecCtrl.RecLen = 0;
RecCtrl.TotalLen = 0;
......@@ -476,9 +476,9 @@ void Ble_User_Init(void )
{
BleRecSuc_Semaphore = xSemaphoreCreateBinary();
Ble_Sts_Ctrl.Ble_Sts = Ble_Idle;
Ble_Sts_Ctrl.Request_Navi = 0;
Ble_Sts_Ctrl.Navi_Updat = 0;
Ble_User.Ble_Sts = Ble_Idle;
Ble_User.Request_Navi = 0;
Ble_User.Navi_Updat = 0;
RecCtrl.RecLen = 0;
RecCtrl.TotalLen = 0;
......
......@@ -60,7 +60,7 @@ typedef struct
extern app_Ble_Rec_Data_Ctrl_Struct RecCtrl;
extern Ble_User_Control_Struct Ble_Sts_Ctrl;
extern Ble_User_Control_Struct Ble_User;
extern Ble_Navi_Info_Struct Ble_Navi_Data;
extern uint8_t Wifi_OTA_Request;
......
......@@ -129,6 +129,29 @@ void bsp_Uart_Init(void )
extern void simple_ota_main(void);
void simple_ota_service(void)
{
/*test*/
// vTaskDelay(1000);
// printf("ota 1\r\n");
// vTaskDelay(1000);
// printf("ota 2\r\n");
// vTaskDelay(1000);
// printf("ota 3\r\n");
// vTaskDelay(1000);
// printf("ota 4\r\n");
// vTaskDelay(1000);
// printf("ota 5\r\n");
// vTaskDelay(1000);
// printf("ota 6\r\n");
// vTaskDelay(1000);
// printf("ota 7\r\n");
// vTaskDelay(1000);
// printf("ota 8\r\n");
// vTaskDelay(1000);
// printf("ota 9\r\n");
// vTaskDelay(1000);
// simple_ota_main();
if(Wifi_OTA_Request == 1)
{
Wifi_OTA_Request = 2;
......@@ -497,7 +520,7 @@ int bsp_Ble_Gatts_Send_Indicate( uint8_t len, uint8_t *data)
int err = ESP_FAIL;
uint8_t retry = 5;
if(Ble_Sts_Ctrl.Ble_Sts != Ble_Idle)
if(Ble_User.Ble_Sts != Ble_Idle)
{
// if(en)
{
......
......@@ -76,9 +76,9 @@ static void Sys_Run_Tasks(void *arg)
{
testcnt = 0;
// printf("Ble_Sts_Ctrl.Ble_Sts = %d\r\n", Ble_Sts_Ctrl.Ble_Sts);
// printf("Ble_User.Ble_Sts = %d\r\n", Ble_User.Ble_Sts);
// // printf("Ble_Sts_Ctrl.Navi_Updat = %d\r\n", Ble_Sts_Ctrl.Navi_Updat);
// printf("Ble_User.Navi_Updat = %d\r\n", Ble_User.Navi_Updat);
// printf("RecCtrl.Sts = %d\r\n", RecCtrl.Sts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment