Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QJ_500-7c
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
QJ_500-7c
Commits
cfedf395
Commit
cfedf395
authored
Apr 30, 2024
by
薛小虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加经典蓝牙应用
parent
49650f37
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
22 deletions
+83
-22
CMakeLists.txt
qianjiang/main/CMakeLists.txt
+1
-1
MCU_Core_Protocol.c
qianjiang/main/MCU_Core_Protocol.c
+2
-2
app_BT_User.c
qianjiang/main/app_BT_User.c
+15
-0
app_BT_User.h
qianjiang/main/app_BT_User.h
+23
-0
app_Ble_User.c
qianjiang/main/app_Ble_User.c
+15
-15
app_Ble_User.h
qianjiang/main/app_Ble_User.h
+1
-1
gatts_table_creat_demo.c
qianjiang/main/gatts_table_creat_demo.c
+24
-1
main_user.c
qianjiang/main/main_user.c
+2
-2
No files found.
qianjiang/main/CMakeLists.txt
View file @
cfedf395
# 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"
...
...
qianjiang/main/MCU_Core_Protocol.c
View file @
cfedf395
...
...
@@ -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
);
}
...
...
qianjiang/main/app_BT_User.c
0 → 100644
View file @
cfedf395
#include "app_BT_User.h"
#define TAG "APP_BLE_USER"
BT_User_Control_Struct
BT_User
;
qianjiang/main/app_BT_User.h
0 → 100644
View file @
cfedf395
#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
qianjiang/main/app_Ble_User.c
View file @
cfedf395
...
...
@@ -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
;
...
...
qianjiang/main/app_Ble_User.h
View file @
cfedf395
...
...
@@ -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
;
...
...
qianjiang/main/gatts_table_creat_demo.c
View file @
cfedf395
...
...
@@ -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)
{
...
...
qianjiang/main/main_user.c
View file @
cfedf395
...
...
@@ -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);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment