blob: d972926db5e5db31343bab07d9c367a1fd6505a5 (
plain)
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
|
#ifndef STATE_MACHINE_H
#define STATE_MACHINE_H
#include "i2c_message.h"
#include <bluefruit.h>
#include <stdint.h>
#define MAX_MSG_LEN 32
enum state_t {WAIT_FOR_TYPE, WAIT_FOR_LEN, WAIT_FOR_DATA};
class StateMachine {
public:
StateMachine(BLEHidAdafruit *);
void byteReceived(uint8_t);
private:
state_t currentState;
uint8_t message[MAX_MSG_LEN];
uint8_t msgLen, msgCount;
i2c_message_t msgType;
BLEHidAdafruit *blehid;
};
#endif
|