forked from bracci/Qlockthree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Effects.h
300 lines (279 loc) · 6.44 KB
/
Effects.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/*
Effects.h
Masken für diverse Effekte
@mc Arduino/UNO
@autor Manuel Bracher / [email protected]
@version 1.0
*/
#ifndef EFFECTS_H
#define EFFECTS_H
#include <avr/pgmspace.h>
#include "Renderer.h"
#include "Configuration.h"
#include "Colors.h"
extern Renderer renderer;
#ifdef LED_DRIVER_DEFAULT
#include "LedDriverDefault.h"
extern LedDriverDefault ledDriver;
#endif
#ifdef LED_DRIVER_UEBERPIXEL
#include "LedDriverUeberPixel.h"
extern LedDriverUeberPixel ledDriver;
#endif
#ifdef LED_DRIVER_POWER_SHIFT_REGISTER
#include "LedDriverPowerShiftRegister.h"
extern LedDriverPowerShiftRegister ledDriver;
#endif
#ifdef LED_DRIVER_NEOPIXEL
#include "LedDriverNeoPixel.h"
extern LedDriverNeoPixel ledDriver;
#define RGB_SPEED_CORRECTION 13
#endif
#ifdef LED_DRIVER_DOTSTAR
#include "LedDriverDotStar.h"
extern LedDriverDotStar ledDriver;
#define RGB_SPEED_CORRECTION 13
#endif
#ifdef LED_DRIVER_LPD8806
#include "LedDriverLPD8806.h"
extern LedDriverLPD8806 ledDriver;
#define RGB_SPEED_CORRECTION 11
#endif
class Effects {
public:
enum eEffects : byte
{
NO_EFFECT = 255,
EFFECT_FIREWORK = 0,
EFFECT_HEART,
EFFECT_CANDLE,
EFFECT_LOVEU,
EFFECT_INTRO,
BITMAP_MIN,
BITMAP_HEART = BITMAP_MIN,
BITMAP_DOTCIRCLE,
BITMAP_WEDDINGRING,
BITMAP_BDPIE,
BITMAP_CHAMPGLASS1,
BITMAP_CHAMPGLASS2,
BITMAP_CHRISTTREE1,
BITMAP_CHRISTTREE2,
BITMAP_SMILEY,
BITMAP_SMILEY_WINK,
BITMAP_LOVE_U,
ANI_BITMAP_MIN,
ANI_BITMAP_CHAMPGLASS = ANI_BITMAP_MIN,
ANI_BITMAP_CHRISTTREE,
ANI_BITMAP_SMILEY_WINK,
};
public:
static void showTickerString(const char* str2disp, byte tickerSpeed, eColors color);
static void showFireWork(byte posX, eColors color);
static void showHeart(byte duration, eColors color);
static void showCandle(eColors color);
static void showBitmap(byte bitmapIdx, byte duration, eColors color);
static void showAnimatedBitmap(byte animatedBitmap, byte duration, eColors color);
static void writeToBuffer(word aMatrix[], unsigned int aDuration, eColors color);
#ifdef DEBUG_EVENT_MATRIX
static void debug_matrix(word aMatrix[]);
#endif
};
const word effectMasksHeart[][10] PROGMEM = {
{ // 0:heart small
0b00000000000,
0b00011011000,
0b00111111100,
0b00011111000,
0b00001110000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 1:heart big
0b00111011100,
0b01100100110,
0b01000000010,
0b00100000100,
0b00010001000,
0b00001010000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000
}
};
const word effectMasksCandle[][10] PROGMEM = {
{ // 2:candle 0
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 3:candle 1&7
0b00000000000,
0b00000000000,
0b00000000000,
0b00001110000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 4:candle 2&6
0b00000000000,
0b00000000000,
0b00001110000,
0b00001110000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 5:candle 3%5
0b00000000000,
0b00001110000,
0b00001110000,
0b00001110000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 6:candle 4
0b00000100000,
0b00001110000,
0b00001110000,
0b00001110000,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 7:candle base
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00001110000,
0b00001110000,
0b00001110000,
0b00001110000
}
};
const word effectMasksFireWork[][10] PROGMEM = {
{ // 8:fireWork1
0b00000000000,
0b00000000000,
0b00001110000,
0b00011111000,
0b00001110000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 9:fireWork2
0b00000000000,
0b00001010000,
0b00010101000,
0b00101110100,
0b00010101000,
0b00001010000,
0b00000000000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 10:fireWork3
0b00001010000,
0b00010101000,
0b00001110000,
0b01011111010,
0b00001110000,
0b00010101000,
0b00001010000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 11:fireWork4
0b00001010000,
0b00100100100,
0b00001010000,
0b00101110100,
0b00001010000,
0b00100100100,
0b00001010000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 12:fireWork5
0b00000100000,
0b00100000100,
0b00010101000,
0b00101010100,
0b00010101000,
0b00100000100,
0b00000100000,
0b00000000000,
0b00000000000,
0b00000000000
},
{ // 13:fireWork6
0b00001010000,
0b00100100100,
0b00101010100,
0b01010101010,
0b00101010100,
0b00100100100,
0b00001010000,
0b00000000000,
0b00000000000,
0b00000000000
}
};
const word bitmaps[][11] PROGMEM = {
{28, 62, 127, 255, 510, 1020, 510, 255, 127, 62, 28}, // ASCII-Code 0x6 =>(6) Herz
{0, 40, 130, 0, 257, 0, 257, 0, 130, 40, 0}, // ASCII-Code 0x8 =>(8) gepunkteter Kreis
{48, 72, 132, 132, 72, 48, 72, 132, 132, 72, 48}, // ASCII-Code 0xE =>(14) Eheringe
{960, 1021, 960, 1018, 960, 1018, 960, 1018, 960, 1021, 960}, // ASCII-Code 0x18 => (24) Geburtstagskuchen
{14, 540, 1020, 540, 14, 0, 7, 270, 510, 270, 7}, // ASCII-Code 0x10 =>(16) Sektgläser 1
{7, 270, 510, 270, 7, 0, 14, 540, 1020, 540, 14}, // ASCII-Code 0x12 => (18) Sektgläser 2
{128, 288, 328, 338, 340, 1023, 340, 338, 328, 288, 128}, // ASCII-Code 0x14 => (20) Weihnachtsbaum 1
{0, 256, 320, 336, 340, 1022, 340, 336, 320, 256, 0}, // ASCII-Code 0x14 => (22) Weihnachtsbaum 2
{0, 4, 138, 266, 260, 304, 260, 266, 138, 4, 0}, // ASCII-Code 0x1C => (28) Smily :-)
{0, 68, 138, 266, 260, 304, 260, 264, 136, 68, 0}, // ASCII-Code 0x1C => (30) Smily ;-)
{ 0b0000000111,
0b0000000000,
0b0000001000,
0b0000011100,
0b0000111100,
0b0001111000,
0b0000111100,
0b0000011100,
0b1110001000,
0b1000000000,
0b1110000000
} // I Love U
};
#endif