-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbt-serial.h
63 lines (58 loc) · 1.48 KB
/
bt-serial.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
60
61
62
63
/********************************************************
* #######################################################
*
* Bluetooth Serial - bt-serial.h
*
* #######################################################
********************************************************/
#ifndef DEKBTS_h
#define DEKBTS_h
#define DEBUFFER_LIMIT 64 // 63 data bytes + null termiantor
/**
* Included Libraries:..
*/
#include <Arduino.h>
//#include <AltSoftSerial.h>
#include <SoftwareSerial.h>
/**
* BTSCommand {struct}
* n: {String}
* v: {String}
* Stores a commands name and value as strings
*/
typedef struct {
char cn[DEBUFFER_LIMIT/2];
char cv[DEBUFFER_LIMIT/2];
} BTSCommand;
/**
* BTSerial {namespace}
* See bt-serial.cpp for full definitions:..
*/
namespace BTSerial {
// Functions:..
void begin(int,bool);
bool update();
bool hasCommand();
BTSCommand getCommand();
void resetDebuffer(char*);
void flush();
void print(char*);
void println(char*);
// Variables:..
static char debuffer[DEBUFFER_LIMIT];
static int buffer_index;
// static AltSoftSerial bts;
static SoftwareSerial bts(8,9);
static BTSCommand command;
static int baud_rate;
static bool comready;
}
#endif
/********************************************************
* #######################################################
*
* End of Code
*
* #######################################################
********************************************************/