@@ -22,29 +22,29 @@ uint8_t qsub8(uint8_t i, uint8_t j);
22
22
int8_t abs8 (int8_t i);
23
23
24
24
typedef uint32_t TProgmemRGBPalette16[16 ];
25
- typedef uint8_t TDynamicRGBGradientPalette_byte; // /< Byte of an RGB gradient entry, stored in dynamic (heap) memory
26
- typedef const TDynamicRGBGradientPalette_byte *TDynamicRGBGradientPalette_bytes; // /< Pointer to bytes of an RGB gradient, stored in dynamic (heap) memory
27
- typedef TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr; // /< Alias of ::TDynamicRGBGradientPalette_bytes
25
+ typedef uint8_t TDynamicRGBGradientPalette_byte; // Byte of an RGB gradient entry, stored in dynamic (heap) memory
26
+ typedef const TDynamicRGBGradientPalette_byte *TDynamicRGBGradientPalette_bytes; // Pointer to bytes of an RGB gradient, stored in dynamic (heap) memory
27
+ typedef TDynamicRGBGradientPalette_bytes TDynamicRGBGradientPalettePtr; // Alias of ::TDynamicRGBGradientPalette_bytes
28
28
typedef const uint8_t TProgmemRGBGradientPalette_byte;
29
29
typedef const TProgmemRGBGradientPalette_byte *TProgmemRGBGradientPalette_bytes;
30
30
typedef TProgmemRGBGradientPalette_bytes TProgmemRGBGradientPalettePtr;
31
31
32
- // / Color interpolation options for palette
32
+ // color interpolation options for palette
33
33
typedef enum {
34
- NOBLEND=0 , // /< No interpolation between palette entries
35
- LINEARBLEND=1 , // /< Linear interpolation between palette entries, with wrap-around from end to the beginning again
36
- LINEARBLEND_NOWRAP=2 // /< Linear interpolation between palette entries, but no wrap-around
34
+ NOBLEND=0 , // No interpolation between palette entries
35
+ LINEARBLEND=1 , // Linear interpolation between palette entries, with wrap-around from end to the beginning again
36
+ LINEARBLEND_NOWRAP=2 // Linear interpolation between palette entries, but no wrap-around
37
37
} TBlendType;
38
38
39
39
typedef union {
40
40
struct {
41
- uint8_t index; // /< index of the color entry in the gradient
42
- uint8_t r; // /< CRGB::red channel value of the color entry
43
- uint8_t g; // /< CRGB::green channel value of the color entry
44
- uint8_t b; // /< CRGB::blue channel value of the color entry
41
+ uint8_t index; // index of the color entry in the gradient
42
+ uint8_t r;
43
+ uint8_t g;
44
+ uint8_t b;
45
45
};
46
- uint32_t dword; // /< values as a packed 32-bit double word
47
- uint8_t bytes[4 ]; // /< values as an array
46
+ uint32_t dword; // values packed as 32-bit
47
+ uint8_t bytes[4 ]; // values as an array
48
48
} TRGBGradientPaletteEntryUnion;
49
49
50
50
// similar to NeoPixelBus NeoGammaTableMethod but allows dynamic changes (superseded by NPB::NeoGammaDynamicTableMethod)
@@ -122,11 +122,11 @@ struct CHSV {
122
122
return raw[x];
123
123
}
124
124
125
- // Default constructor
126
- // @warning Default values are UNITIALIZED!
125
+ // default constructor
126
+ // @warning default values are UNITIALIZED!
127
127
inline CHSV () __attribute__((always_inline)) = default;
128
128
129
- // /Allow construction from hue, saturation, and value
129
+ // allow construction from hue, saturation, and value
130
130
inline CHSV (uint8_t ih, uint8_t is, uint8_t iv) __attribute__((always_inline))
131
131
: h(ih), s(is), v(iv) { }
132
132
@@ -194,12 +194,12 @@ struct CRGB {
194
194
hsv2rgb_rainbow (hue<<8 , sat, val, raw, false ); return *this ;
195
195
}
196
196
197
- // Allow assignment from just a hue, sat and val are set to max
197
+ // allow assignment from just a hue, sat and val are set to max
198
198
inline CRGB& setHue (uint8_t hue) __attribute__((always_inline)) {
199
199
hsv2rgb_rainbow (hue<<8 , 255 , 255 , raw, false ); return *this ;
200
200
}
201
201
202
- // / Allow assignment from HSV color
202
+ // allow assignment from HSV color
203
203
inline CRGB& operator = (const CHSV& rhs) __attribute__((always_inline)) {
204
204
hsv2rgb_rainbow (rhs.h <<8 , rhs.s , rhs.v , raw, false ); return *this ;
205
205
}
@@ -214,23 +214,22 @@ struct CRGB {
214
214
return *this ;
215
215
}
216
216
217
- // / allow assignment from red, green, and blue
217
+ // allow assignment from red, green, and blue
218
218
inline CRGB& setRGB (uint8_t nr, uint8_t ng, uint8_t nb) __attribute__((always_inline)) {
219
219
r = nr;
220
220
g = ng;
221
221
b = nb;
222
222
return *this ;
223
223
}
224
224
225
- // / Allow assignment from 32-bit (really 24-bit) 0xRRGGBB color code
225
+ // allow assignment from 32-bit (really 24-bit) 0xRRGGBB color code
226
226
inline CRGB& setColorCode (uint32_t colorcode) __attribute__((always_inline)) {
227
227
r = R (colorcode);
228
228
g = G (colorcode);
229
229
b = B (colorcode);
230
230
return *this ;
231
231
}
232
232
233
-
234
233
// add one CRGB to another, saturating at 0xFF for each channel
235
234
inline CRGB& operator += (const CRGB& rhs) {
236
235
r = qadd8 (r, rhs.r );
@@ -344,7 +343,7 @@ struct CRGB {
344
343
return *this ;
345
344
}
346
345
347
- // / Return a CRGB object that is a scaled down version of this object
346
+ // return a CRGB object that is a scaled down version of this object
348
347
inline CRGB scale8 (uint8_t scaledown) const {
349
348
CRGB out = *this ;
350
349
uint32_t scale_fixed = scaledown + 1 ;
@@ -354,7 +353,7 @@ struct CRGB {
354
353
return out;
355
354
}
356
355
357
- // / Return a CRGB object that is a scaled down version of this object
356
+ // return a CRGB object that is a scaled down version of this object
358
357
inline CRGB scale8 (const CRGB& scaledown) const {
359
358
CRGB out;
360
359
out.r = ::scale8 (r, scaledown.r );
@@ -363,8 +362,7 @@ struct CRGB {
363
362
return out;
364
363
}
365
364
366
- // / fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
367
- // / @param fadefactor the amount to fade, sent to nscale8() as (255 - fadefactor)
365
+ // fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
368
366
inline CRGB& fadeToBlackBy (uint8_t fadefactor) {
369
367
uint32_t scale_fixed = 256 - fadefactor;
370
368
r = (((uint32_t )r) * scale_fixed) >> 8 ;
@@ -373,44 +371,42 @@ struct CRGB {
373
371
return *this ;
374
372
}
375
373
376
- // / "or" operator brings each channel up to the higher of the two values
374
+ // "or" operator brings each channel up to the higher of the two values
377
375
inline CRGB& operator |=(const CRGB& rhs) {
378
376
if (rhs.r > r) r = rhs.r ;
379
377
if (rhs.g > g) g = rhs.g ;
380
378
if (rhs.b > b) b = rhs.b ;
381
379
return *this ;
382
380
}
383
381
384
- // / @copydoc operator|=
385
382
inline CRGB& operator |=(uint8_t d) {
386
383
if (d > r) r = d;
387
384
if (d > g) g = d;
388
385
if (d > b) b = d;
389
386
return *this ;
390
387
}
391
388
392
- // / "and" operator brings each channel down to the lower of the two values
389
+ // "and" operator brings each channel down to the lower of the two values
393
390
inline CRGB& operator &=(const CRGB& rhs) {
394
391
if (rhs.r < r) r = rhs.r ;
395
392
if (rhs.g < g) g = rhs.g ;
396
393
if (rhs.b < b) b = rhs.b ;
397
394
return *this ;
398
395
}
399
396
400
- // / @copydoc operator&=
401
397
inline CRGB& operator &=(uint8_t d) {
402
398
if (d < r) r = d;
403
399
if (d < g) g = d;
404
400
if (d < b) b = d;
405
401
return *this ;
406
402
}
407
403
408
- // / This allows testing a CRGB for zero-ness
404
+ // this allows testing a CRGB for zero-ness
409
405
inline explicit operator bool () const __attribute__((always_inline)) {
410
406
return r || g || b;
411
407
}
412
408
413
- // / Converts a CRGB to a 32-bit color with white = 0
409
+ // converts a CRGB to a 32-bit color with white = 0
414
410
inline explicit operator uint32_t () const {
415
411
return (uint32_t {r} << 16 ) |
416
412
(uint32_t {g} << 8 ) |
@@ -662,7 +658,7 @@ class CRGBPalette16 {
662
658
const uint8_t * p = (const uint8_t *)(&(this ->entries [0 ]));
663
659
const uint8_t * q = (const uint8_t *)(&(rhs.entries [0 ]));
664
660
if (p == q) return true ;
665
- for (int i = 0 ; i < (sizeof (entries)); ++i) {
661
+ for (unsigned i = 0 ; i < (sizeof (entries)); ++i) {
666
662
if (*p != *q) return false ;
667
663
++p;
668
664
++q;
@@ -736,24 +732,24 @@ class CRGBPalette16 {
736
732
TRGBGradientPaletteEntryUnion u;
737
733
738
734
// Count entries
739
- uint32_t count = 0 ;
735
+ int count = 0 ;
740
736
do {
741
737
u.dword = *(const uint32_t *)(progent + count);
742
738
++count;
743
739
} while (u.index != 255 );
744
740
745
- int32_t lastSlotUsed = -1 ;
741
+ int lastSlotUsed = -1 ;
746
742
747
743
u.dword = *(const uint32_t *)(progent);
748
744
CRGB rgbstart (u.r , u.g , u.b );
749
745
750
- uint32_t indexstart = 0 ;
751
- uint32_t istart8 = 0 ;
752
- uint32_t iend8 = 0 ;
746
+ int indexstart = 0 ;
747
+ int istart8 = 0 ;
748
+ int iend8 = 0 ;
753
749
while (indexstart < 255 ) {
754
750
++progent;
755
751
u.dword = *(const uint32_t *)(progent);
756
- uint32_t indexend = u.index ;
752
+ int indexend = u.index ;
757
753
CRGB rgbend (u.r , u.g , u.b );
758
754
istart8 = indexstart / 16 ;
759
755
iend8 = indexend / 16 ;
@@ -779,20 +775,20 @@ class CRGBPalette16 {
779
775
TRGBGradientPaletteEntryUnion u;
780
776
781
777
// Count entries
782
- uint16_t count = 0 ;
778
+ unsigned count = 0 ;
783
779
do {
784
780
u = *(ent + count);
785
781
++count;
786
782
} while (u.index != 255 );
787
783
788
- int8_t lastSlotUsed = -1 ;
784
+ int lastSlotUsed = -1 ;
789
785
790
786
u = *ent;
791
787
CRGB rgbstart (u.r , u.g , u.b );
792
788
793
789
int indexstart = 0 ;
794
- uint8_t istart8 = 0 ;
795
- uint8_t iend8 = 0 ;
790
+ int istart8 = 0 ;
791
+ int iend8 = 0 ;
796
792
while (indexstart < 255 ) {
797
793
++ent;
798
794
u = *ent;
0 commit comments