-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABTBlutooth.h
60 lines (48 loc) · 1.16 KB
/
ABTBlutooth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* \class ABTblutooth
* \brief Driver for bluetooth moudle.
* @file ABTblutooth.h
* @author ANTBOT
* @version V1.0.1
* @date 2018/2/24
* @brief Driver for bluetooth moudle.
*/
#ifndef ABTBLUTOOTH_H
#define ABTBLUTOOTH_H
#include <Arduino.h>
#include "ABTPort.h"
struct infoFrmBle{
char cRW;
int sID;
int sVal;
};
class ABTBlutooth : public ABTPort
{
public:
ABTBlutooth(uint8_t port);
void ABTINIT();
int ABTGetBleCmd();//接收蓝牙指令
void ABTHandleBleCmd();//处理蓝牙指令
void ABTSendCMD(char *p);//向蓝牙发送指令
void ABTSimple();//透传测试
void ABTPrint();
void ABTSensorFunc(char cRW,int sID,int sVal);//传感器模块处理函数
public:
char readcmd[64];//接收到的蓝牙数据缓存
char sendcmd[32];//发送缓存
int speedL;
int speedR;
infoFrmBle curInfo;
infoFrmBle senInfo[8];//传感器指令缓存
unsigned char senCnt;
private:
void ABTExpCmd(char * p);//解析单条帧命令
void ABTSprint(char *p);//调试接口
private:
char HEADFRAME[4];//帧头
int frameCnt;//接收帧计数
int rbytes;
private:
unsigned char _SignalPin;
};
#endif