-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSegment16.h
More file actions
69 lines (60 loc) · 1.5 KB
/
Segment16.h
File metadata and controls
69 lines (60 loc) · 1.5 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
60
61
62
63
64
65
66
67
68
/*
* Segment16.h
*
* A 16-segment LED analog for SSD1306 displays.
*
* Author: Rob Bultman
* License: MIT
*/
#ifndef SEGMENT_16_H
#define SEGMENT_16_H
#include "Adafruit_SSD1306.h"
namespace Segment16Display
{
typedef struct Vertex
{
uint8_t x;
uint8_t y;
} Vertex;
class Segment16
{
public:
Segment16(
Adafruit_SSD1306_Spi &oledRef,
uint8_t xOff,
uint8_t yOff,
uint8_t w,
uint8_t h
);
void AllOn();
void AllOff();
void SetCharacter(char c);
private:
void DrawHorizLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color);
void DrawVertLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color);
void DrawDiagLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color);
void DrawSegment();
void ClearDisplay();
private:
Adafruit_SSD1306_Spi &oled;
uint8_t xOffset;
uint8_t yOffset;
uint8_t width;
uint8_t height;
uint8_t characterOffsetX;
uint8_t characterOffsetY;
uint8_t characterWidth;
uint8_t characterHeight;
uint8_t slant;
Vertex vertexA;
Vertex vertexB;
Vertex vertexC;
Vertex vertexD;
Vertex vertexE;
Vertex vertexF;
Vertex vertexG;
Vertex vertexH;
Vertex vertexI;
};
}
#endif // SEGMENT_16_H