-
Notifications
You must be signed in to change notification settings - Fork 1
/
controllerInterface.h
executable file
·59 lines (50 loc) · 1.07 KB
/
controllerInterface.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
/*
* controllerInterface.h
*
* Created on: Mar 3, 2019
* Author: MiguelFAlvarez
*/
#ifndef CONTROLLERINTERFACE_H_
#define CONTROLLERINTERFACE_H_
#include <stdint.h>
//#define INTERFACE_CONTROLLER
#define INTERFACE_HUB
#define CTRL_VER 0x01
#define CTRL2HUB_ID 0x10
#define HUB2CTRL_ID 0x20
#pragma pack(push, 1)
typedef struct
{
uint8_t version;
uint8_t id;
uint8_t length;
uint8_t armed;
uint16_t throttlePercent; //0 to 1000
uint16_t crc;
}STR_CTRL2HUB_MSG;
typedef struct
{
uint8_t version;
uint8_t id;
uint8_t length;
uint8_t armed;
uint32_t voltage;
uint32_t totalMah;
uint32_t totalCurrent;
uint16_t avgRpm;
uint8_t avgCapTemp;
uint8_t avgFetTemp;
int16_t baroTemp; // degrees c
uint32_t baroPressure; // hpa
uint16_t crc;
}STR_HUB2CTRL_MSG;
#pragma pack(pop)
#ifdef INTERFACE_CONTROLLER
void sendControlData(uint8_t armed, uint16_t throttlePercent);
void receiveHubData(uint8_t *buf, uint32_t size);
#endif
#ifdef INTERFACE_HUB
void receiveControlData(uint8_t *buf, uint32_t size);
void sendHubData();
#endif
#endif /* CONTROLLERINTERFACE_H_ */