FastLED 3.10.6
Loading...
Searching...
No Matches
pixel_format.cpp.hpp
Go to the documentation of this file.
1// ok no header - implementation for fl/fled/detail/pixel_format.h.
2
4
5namespace fl {
6namespace fled {
7
9 switch (pixelFormat) {
10 case static_cast<fl::u8>(PixelFormat::Rgb8): return 3;
11 case static_cast<fl::u8>(PixelFormat::Gray8): return 1;
12 case static_cast<fl::u8>(PixelFormat::Rgba8): return 4;
13 case static_cast<fl::u8>(PixelFormat::Rgbw8): return 4;
14 case static_cast<fl::u8>(PixelFormat::Rgb565Le): return 2;
15 case static_cast<fl::u8>(PixelFormat::Rgb16Linear): return 6;
16 default: return 0;
17 }
18}
19
21 if (!out) {
22 return false;
23 }
24 switch (fledFormat) {
26 out->mFormat = fl::PixelFormat::Rgb8;
27 out->mComponentByteOrder = ComponentByteOrder::NotApplicable;
28 return true;
30 out->mFormat = fl::PixelFormat::Rgb16;
31 out->mComponentByteOrder = ComponentByteOrder::LittleEndian;
32 return true;
33 // Known to the container and carried by `bytesPerLed`, but with no
34 // generic storage descriptor to map onto. Listed rather than swept into a
35 // `default:` so that a *seventh* wire format is a compile error naming
36 // this function instead of a silent `false` discovered at playback --
37 // D1 asks for a checked explicit mapping, and the check is worth more
38 // when the compiler performs it.
43 return false;
44 }
45 return false;
46}
47
48} // namespace fled
49} // namespace fl
fl::u8 bytesPerLed(fl::u8 pixelFormat) FL_NO_EXCEPT
bool toPixelStorage(PixelFormat fledFormat, PixelStorage *out) FL_NO_EXCEPT
unsigned char u8
Definition stdint.h:131
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
Base definition for an LED controller.
Definition crgb.hpp:179