1
1
/*
2
- LEDText V5 class by Aaron Liddiment (c) 2015
2
+ LEDText V6 class by Aaron Liddiment (c) 2015
3
3
4
4
Uses my LEDMatrix class and especially the
5
5
@@ -18,36 +18,36 @@ Even the basic examples need 12k rom & 4k ram
18
18
#define SCROLL_MASK (SCROLL_LEFT | SCROLL_RIGHT | SCROLL_UP | SCROLL_DOWN)
19
19
#define COLR_MASK (COLR_RGB | COLR_HSV | COLR_SINGLE | COLR_GRAD | COLR_CHAR | COLR_AREA | COLR_VERT | COLR_HORI | COLR_EMPTY | COLR_DIMMING)
20
20
21
- #define UC_BACKGND_ERASE 0x80
22
- #define UC_BACKGND_LEAVE 0x81
23
- #define UC_BACKGND_DIMMING 0x82
24
- #define UC_FRAME_RATE 0x84
25
- # define UC_DELAY_FRAMES 0x85
26
-
27
- #define UC_CUSTOM_RC 0x88
28
-
29
- #define UC_SCROLL_LEFT 0x90
30
- # define UC_SCROLL_RIGHT 0x91
31
- #define UC_SCROLL_UP 0x92
32
- #define UC_SCROLL_DOWN 0x93
33
-
34
- #define UC_CHAR_UP 0xa0
35
- #define UC_CHAR_DOWN 0xa1
36
- #define UC_CHAR_LEFT 0xa2
37
- #define UC_CHAR_RIGHT 0xa3
38
-
39
- #define UC_RGB 0xc0
40
- #define UC_HSV 0xc1
41
- #define UC_RGB_CV 0xc2
42
- #define UC_HSV_CV 0xc3
43
- # define UC_RGB_AV 0xc6
44
- #define UC_HSV_AV 0xc7
45
- #define UC_RGB_CH 0xca
46
- #define UC_HSV_CH 0xcb
47
- # define UC_RGB_AH 0xce
48
- #define UC_HSV_AH 0xcf
49
- #define UC_COLR_EMPTY 0xd0
50
- #define UC_COLR_DIMMING 0xe0
21
+ #define UC_CHAR_UP 0xd8
22
+ #define UC_CHAR_DOWN 0xd9
23
+ #define UC_CHAR_LEFT 0xda
24
+ #define UC_CHAR_RIGHT 0xdb
25
+
26
+ # define UC_SCROLL_LEFT 0xdc
27
+ #define UC_SCROLL_RIGHT 0xdd
28
+ # define UC_SCROLL_UP 0xde
29
+ #define UC_SCROLL_DOWN 0xdf
30
+
31
+ #define UC_RGB 0xe0
32
+ #define UC_HSV 0xe1
33
+ # define UC_RGB_CV 0xe2
34
+ #define UC_HSV_CV 0xe3
35
+ #define UC_RGB_AV 0xe6
36
+ #define UC_HSV_AV 0xe7
37
+ #define UC_RGB_CH 0xea
38
+ # define UC_HSV_CH 0xeb
39
+ #define UC_RGB_AH 0xee
40
+ #define UC_HSV_AH 0xef
41
+ #define UC_COLR_EMPTY 0xf0
42
+ #define UC_COLR_DIMMING 0xf1
43
+
44
+ #define UC_BACKGND_ERASE 0xf4
45
+ #define UC_BACKGND_LEAVE 0xf5
46
+ #define UC_BACKGND_DIMMING 0xf6
47
+
48
+ #define UC_FRAME_RATE 0xf8
49
+ #define UC_DELAY_FRAMES 0xf9
50
+ #define UC_CUSTOM_RC 0xfa
51
51
52
52
53
53
void cLEDText::SetFont (const uint8_t *FontData)
@@ -192,13 +192,13 @@ void cLEDText::DecodeOptions(uint16_t *tp, uint16_t *opt, uint8_t *backDim, uint
192
192
case UC_CHAR_DOWN:
193
193
case UC_CHAR_LEFT:
194
194
case UC_CHAR_RIGHT:
195
- *opt = (*opt & (~CHAR_MASK)) | (((uint16_t )m_pText[*tp] << 2 ) & CHAR_MASK);
195
+ *opt = (*opt & (~CHAR_MASK)) | (((( uint16_t )m_pText[*tp] & 0x03 ) << 2 ) & CHAR_MASK);
196
196
break ;
197
197
case UC_SCROLL_LEFT:
198
198
case UC_SCROLL_RIGHT:
199
199
case UC_SCROLL_UP:
200
200
case UC_SCROLL_DOWN:
201
- *opt = (*opt & (~SCROLL_MASK)) | (((uint16_t )m_pText[*tp] << 4 ) & SCROLL_MASK);
201
+ *opt = (*opt & (~SCROLL_MASK)) | (((( uint16_t )m_pText[*tp] & 0x03 ) << 4 ) & SCROLL_MASK);
202
202
break ;
203
203
case UC_RGB:
204
204
case UC_HSV:
@@ -210,32 +210,27 @@ void cLEDText::DecodeOptions(uint16_t *tp, uint16_t *opt, uint8_t *backDim, uint
210
210
case UC_HSV_CH:
211
211
case UC_RGB_AH:
212
212
case UC_HSV_AH:
213
- case UC_COLR_EMPTY:
214
- case UC_COLR_DIMMING:
215
- *opt = (*opt & (~COLR_MASK)) | (((uint16_t )m_pText[*tp] << 6 ) & COLR_MASK);
216
- if ((*opt & COLR_EMPTY) != COLR_EMPTY)
213
+ *opt = (*opt & (~COLR_MASK)) | ((((uint16_t )m_pText[*tp] & 0x0f ) << 6 ) & COLR_MASK);
214
+ col1[0 ] = m_pText[*tp + 1 ];
215
+ col1[1 ] = m_pText[*tp + 2 ];
216
+ col1[2 ] = m_pText[*tp + 3 ];
217
+ *tp += 3 ;
218
+ if ((*opt & COLR_GRAD) == COLR_GRAD)
217
219
{
218
- if ((*opt & COLR_DIMMING) == COLR_DIMMING)
219
- {
220
- *colDim = (uint8_t )m_pText[*tp + 1 ];
221
- *tp += 1 ;
222
- }
223
- else
224
- {
225
- col1[0 ] = m_pText[*tp + 1 ];
226
- col1[1 ] = m_pText[*tp + 2 ];
227
- col1[2 ] = m_pText[*tp + 3 ];
228
- *tp += 3 ;
229
- if ((*opt & COLR_GRAD) == COLR_GRAD)
230
- {
231
- col2[0 ] = m_pText[*tp + 1 ];
232
- col2[1 ] = m_pText[*tp + 2 ];
233
- col2[2 ] = m_pText[*tp + 3 ];
234
- *tp += 3 ;
235
- }
236
- }
220
+ col2[0 ] = m_pText[*tp + 1 ];
221
+ col2[1 ] = m_pText[*tp + 2 ];
222
+ col2[2 ] = m_pText[*tp + 3 ];
223
+ *tp += 3 ;
237
224
}
238
225
break ;
226
+ case UC_COLR_EMPTY:
227
+ *opt = (*opt & (~COLR_MASK)) | COLR_EMPTY;
228
+ break ;
229
+ case UC_COLR_DIMMING:
230
+ *opt = (*opt & (~COLR_MASK)) | COLR_DIMMING;
231
+ *colDim = (uint8_t )m_pText[*tp + 1 ];
232
+ *tp += 1 ;
233
+ break ;
239
234
}
240
235
}
241
236
0 commit comments