-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAccessoryServos.h
More file actions
59 lines (49 loc) · 1.19 KB
/
AccessoryServos.h
File metadata and controls
59 lines (49 loc) · 1.19 KB
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
// AccessoryServos.h
//
#ifndef _ACCESSORYSERVOS_H_
#define _ACCESSORYSERVOS_H_
#include "fdserial.h"
typedef struct
{
uint8_t servoPin;
uint16_t defaultPos;
uint16_t minPos;
uint16_t maxPos;
uint16_t stepSize;
int8_t flagIndex; // -1 means no flag, which flag disables this servo?
} ServoInfo;
typedef enum
{
IncStep,
DecStep,
GotoDefault,
GotoMin,
GotoMax,
LastServoCommand = GotoMax,
ToggleFlag,
SetFlag,
ClearFlag
} CommandType;
typedef struct
{
char* commandString;
CommandType commandType;
int index; // depends on command type (for servo motion commands this will be the servo index, for flag commands it's the flag index)
} CommandInfo;
typedef struct
{
char* flagName;
uint8_t defaultState;
} FlagInfo;
typedef struct
{
ServoInfo* servoInfos;
int numServoInfos;
CommandInfo* commandInfos;
int numCommandInfos;
FlagInfo* flagInfos;
int numFlagInfos;
} ConfigInfo;
void StartAccessoryServosController(ConfigInfo* configInfo);
void HandleAccessoryServosCommands(const char* inputString, fdserial *term);
#endif // _ACCESSORYSERVOS_H_