-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeoPixSegment.h
64 lines (53 loc) · 2.15 KB
/
NeoPixSegment.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
#ifndef NEO_PIX_SEGMENT_H
#define NEO_PIX_SEGMENT_H
/***********************************************************************************/
/* ---< Project definition >--- */
/***********************************************************************************/
#define MAX_DISPLAY_SEGMENTS 10
#define ALL_SEGMENTS 0xFF
#define DF_END 0
#define DF_NUMBER 1
#define DF_DOT 2
#define DF_COLON 3
#define DF_EMPTY 4
#define LEFT_ALIGMENT 0
#define RIGHT_ALIGMENT 1
/***********************************************************************************/
/* ---< Class >--- */
/***********************************************************************************/
class NeoPixSegment {
public:
unsigned long width;
unsigned long height;
void Init(unsigned char ComPin, unsigned char LesdPerSegment,const char *DisplayFormat,bool DebugOn);
void Clear(unsigned char SegmentIndex);
void WriteCharacter(char Character, unsigned char SegmentIndex);
void WriteNumber(char Number, unsigned char SegmentIndex);
void SetColor(unsigned char R, unsigned char G, unsigned char B, unsigned char SegmentIndex);
void Show(void);
void WriteDotColon(bool Shine, unsigned char SegmentIndex);
void SegmentBlink(bool Blink, unsigned char SegmentIndex);
void SetBrightness(unsigned char Brightness);
void SetBlinkInterval(unsigned long BlinkInterval);
void WriteText(const char *Text, bool Right);
private:
unsigned char DisplayDefinition[MAX_DISPLAY_SEGMENTS];
unsigned char LedsPerSegment;
unsigned char DisplaySegments;
bool Debug;
void DebugInfo(const char *DebugText);
unsigned char GetChar(char Character);
struct SegmentStateStruct{
unsigned char R;
unsigned char G;
unsigned char B;
unsigned char Value;
bool BlinkIsActive;
}SegmentState[MAX_DISPLAY_SEGMENTS];
struct BlinkStruct{
unsigned long LastBlinkTime;
unsigned long Interval;
bool State;
}Blink;
};
#endif // NEO_PIX_SEGMENT_H