-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFtmodules.h
89 lines (72 loc) · 1.71 KB
/
Ftmodules.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
Header for fischertechnik modules class
*/
#ifndef ftmodules_h
#define ftmodules_h
#include <Arduino.h>
#include <Simpletypes.h>
class FtModules
{
public:
// ----------------------------- I²C
class I2C
{
public:
static void Cmd(int address, byte cmd);
static void Cmd(int address, byte cmd, byte param);
static void Cmd(int address, byte cmd, byte param1, byte param2);
static void Cmd(int address, byte cmd, byte param1, byte param2, byte param3);
static void Cmd(int address, byte cmd, byte param1, byte param2, byte param3, byte param4);
static void Cmd(int address, int cmd, char *param);
};
// ----------------------------- Seven-segment display
class SevenSegDisplay
{
public:
// void Clear(int address);
// void Test(int address);
// void Display(int address, char *str);
// void Hold(int address, uint ms);
// void Flash(int address, uint ms);
// void Rotate(int address, uint ms);
// void Stop(int address);
// Commands for 7-segment display module
enum Command
{
cmdBlank = 0x10,
cmdTest = 0x11,
cmdDisplay = 0x12,
cmdFlash = 0x13,
cmdRotate = 0x14,
cmdHold = 0x15,
cmdStop = 0x40,
};
static const byte maxDisplayChars = 80;
};
// ----------------------------- Motor driver
class MotorDriver
{
public:
MotorDriver(FtModules::I2C i2c);
// Commands for motor driver module
enum Command
{
cmdHello = 0x21,
cmdOutput1 = 0x31,
cmdOutput2 = 0x32,
cmdOutput3 = 0x33,
cmdOutput4 = 0x34,
cmdMode = 0x40,
cmdSpeed = 0x41,
cmdCoast = 0x42,
cmdForward = 0x43,
cmdBackwards = 0x44,
cmdBrake = 0x45,
cmdHome = 0x46,
cmdTarget = 0x49,
};
private:
FtModules::I2C _i2c;
};
};
#endif // ftmodules_h