-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputabstract.h
120 lines (102 loc) · 2.95 KB
/
outputabstract.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef __INC_AA_OUTPUT_ABSTRACT
#define __INC_AA_OUTPUT_ABSTRACT
#include <stdint.h>
#include "color.h"
/**
* Abstract light output
*/
class OutputAbstract
{
public:
/**
* Constructs a new abstract light output
*
* @param numLEDs Number of LEDs
*/
OutputAbstract(int numLEDs) : _numLEDs(numLEDs)
{
}
/**
* Gets the number of LEDs
*
* @return Number of LEDs
*/
virtual int getNumLEDs();
/**
* Gets whether or not the output device simulates brightness control
*
* @return True if software brightness, false if hardware brightness
*/
virtual bool isSoftwareBrightness() = 0;
/**
* Initialize the lights
*/
virtual void initialize() = 0;
/**
* Update the lights with the currently set colors
*/
virtual void show() = 0;
/**
* Gets a color with corrections applied to match the LED deficiencies
*
* @return sCRGB color, modified to fit the light strand
*/
virtual sCRGB getCorrectedColor(sCRGB color);
/**
* Sets the LED at index to the given brightness
*
* @param index Index of the chosen LED, starting from 0
* @param brightness Brightness in range 0-255, 255 being maximum
*/
virtual void setBrightness(int index, uint8_t brightness) = 0;
/**
* Sets the LED at index to the given color at maximum brightness
*
* @param index Index of the chosen LED, starting from 0
* @param color Color as sCRGB
*/
virtual void setColor(int index, sCRGB color) = 0;
/**
* Sets the LED at index to the given color and brightness
*
* @param index Index of the chosen LED, starting from 0
* @param color Color as sCRGB
* @param brightness Brightness in range 0-255, 255 being maximum
*/
virtual void setColor(int index, sCRGB color, uint8_t brightness) = 0;
/**
* Sets the LED at index to the given color at previous brightness
*
* @param index Index of the chosen LED, starting from 0
* @param color Color as sCRGB
*/
virtual void setHue(int index, sCRGB color) = 0;
/**
* Sets all LEDs to the given brightness
*
* @param brightness Brightness in range 0-255, 255 being maximum
*/
virtual void fillBrightness(uint8_t brightness);
/**
* Sets all LEDs to the given color at maximum brightness
*
* @param color Color as sCRGB
*/
virtual void fillColor(sCRGB color);
/**
* Sets all LEDs to the given color and brightness
*
* @param color Color as sCRGB
* @param brightness Brightness in range 0-255, 255 being maximum
*/
virtual void fillColor(sCRGB color, uint8_t brightness);
/**
* Sets all LEDs to the given color at previous brightness
*
* @param color Color as sCRGB
*/
virtual void fillHue(sCRGB color);
private:
int _numLEDs = {}; ///< Number of LEDs
};
#endif