BlueTooth.h 1.95 KB
Newer Older
1 2
#ifndef __BLUE_TOOTH_H_
#define __BLUE_TOOTH_H_
李俭双's avatar
李俭双 committed
3

4 5 6 7 8 9 10 11 12
#include "Protocol_Lib.h"
#include <stdio.h>
#include <stdint.h>
#include "Components.h"
#include "Application.h"
#define ESP32_MCU_0x10  0x10   //蓝牙模组启动发送ID
#define MCU_ESP32_0x20  0x20   //蓝牙模组启动后,MCU回复ID
#define ESP32_MCU_0x01  0x01   //ESP32发送蓝牙导航信息的ID
#define ESP32_MCU_0x12  0x12   //低功耗蓝牙启动状态及蓝牙名称
13
#define ESP32_MCU_0x05  0x05   //esp32版本号
14
#define MCU_ESP32_0x03  0x03   //MCU发送UUID
15 16
#define ESP32_MCU_0x02  0x02   //ESP32发送重启请求
#define MCU_ESP32_0x04  0x04   //MCU发送重启命令
17 18 19 20 21 22
enum
{
    BLUE_STATE_Starting,   //蓝牙模组启动中
    BLUE_STATE_ON,         //蓝牙模组启动完成
    BLUE_STATE_OFF,
};
李俭双's avatar
李俭双 committed
23
typedef struct __attribute__((aligned(4)))
24 25 26 27 28
{
    uint8_t   BlueTooth_St; /*蓝牙模组启动状态  0启动中 1启动完成*/
    uint8_t   Navigation_St;/*导航状态   0x35 未导航或导航结束  0x33 正在导航*/
    uint8_t   Navigation_Code;/*蓝牙导向编码*/
    uint32_t  Navigation_Mileage;/*剩余里程*/
29
    uint8_t   BLE_St;  
30 31
    uint8_t   ESP32_Reset;  
    uint8_t   ESP32_SWV;   
32 33
} BlueTooth_t;

李俭双's avatar
李俭双 committed
34 35
typedef enum __attribute__((aligned(4)))
{
36 37 38 39
    EM_ESP32_BT_STARTUP_ST_STANDBY = 0,
    EM_ESP32_BT_STARTUP_ST_SUCCESS,
} EM_ESP32_BT_STARTUP_ST_T;

李俭双's avatar
李俭双 committed
40 41
typedef enum __attribute__((aligned(4)))
{
42 43 44 45
    EM_ESP32_NAVI_ST_STANDBY = 0,
    EM_ESP32_NAVI_ST_NAVIGATING,
} EM_ESP32_NAVI_ST_T;

李俭双's avatar
李俭双 committed
46 47
typedef struct __attribute__((aligned(4)))
{
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    EM_ESP32_BT_STARTUP_ST_T Startup;
    EM_ESP32_NAVI_ST_T NaviSt;
    uint8_t NaviCode;    
    uint8_t BlueToothConnectSt;
    uint32_t NaviMileage;
    uint8_t BlueName[6];
    
} ESP32_COMM_INFO_T;


extern BlueTooth_t  BlueTooth;
uint8_t Get_Navigation_St_Dis(void);
uint8_t Get_Navigation_Code_Dis(void);
uint32_t Get_Navigation_Mileage_Dis(void);
void Send_UUID_To_Esp32(void);
李俭双's avatar
李俭双 committed
63
void BlueTooth_KL30_KL15_Wakeup_Init(void);
64
void Clear_Navigation_St(void);
65 66 67 68

#endif