-
Notifications
You must be signed in to change notification settings - Fork 3
/
EucInterface.h
65 lines (55 loc) · 1.95 KB
/
EucInterface.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
64
65
#ifndef EUC_INTERFACE_H
#define EUC_INTERFACE_H
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif
class Euc {
public:
struct RawData {
unsigned char headerPrimaryPacket[8] = {0x04, 0x18, 0x5A, 0x5A, 0x5A, 0x5A, 0x55, 0xAA};
unsigned char voltage[2] = {0x00, 0x00};
unsigned char speed[2] = {0x00, 0x00};
unsigned char tempMileage[4] = {0x00, 0x00, 0x00, 0x00};
unsigned char current[2] = {0x00, 0x00};
unsigned char temperature[2] = {0x00, 0x00};
//unsigned char unknownData[4]; // TODO: figure out what that is
//unsigned char headerSecondaryPacket[8] = {0x00, 0x18, 0x5A, 0x5A, 0x5A, 0x5A, 0x55, 0xAA};
unsigned char unknownData[4] = {0x00, 0x00, 0x00, 0x00}; // TODO: figure out what that is //NOTE: only first byte seems to change
unsigned char headerSecondaryPacket[8] = {0x00, 0x18, 0x5A, 0x5A, 0x5A, 0x5A, 0x55, 0xAA};
unsigned char mileage[4] = {0x00, 0x00, 0x00, 0x00};
unsigned char end[12] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
bool dataIsNew = false;
};
struct UsableData {
float voltage;
float speed;
float tempMileage;
float current;
float temperature;
//unsigned char unknownData[4];
float mileage;
bool dataIsNew = false;
};
Stream &ReceiverSerial;
Stream &TransmitterSerial;
void (*eucLoop)(float,float,float,float,float,float,bool);
Euc::RawData receiveRawData();
Euc::UsableData makeRawDataUsable(Euc::RawData eucRawData);
Euc(Stream &ReceiverSerial, Stream &TransmitterSerial);
void tick();
void setCallback(void (*eucLoopCallback)(float,float,float,float,float,float,bool));
void beep();
void maddenMode();
void comfortMode();
void softMode();
void calibrateAlignment();
void disableLevel1Alarm();
void disableLevel2Alarm();
void enableAlarms();
void enable6kmhTiltback();
void disable6kmhTiltback();
};
#endif // EUC_INTERFACE_H