MCPcopy Create free account
hub / github.com/FastLED/FastLED / rgb565ToRgb888

Function rgb565ToRgb888

src/fl/fx/pixel.cpp.hpp:23–33  ·  view source on GitHub ↗

Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables

Source from the content-addressed store, hash-verified

21
22// Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables
23void rgb565ToRgb888(fl::u16 rgb565, fl::u8& r, fl::u8& g, fl::u8& b) {
24 // Extract RGB components from RGB565
25 fl::u8 r5 = (rgb565 >> 11) & 0x1F; // 5-bit red
26 fl::u8 g6 = (rgb565 >> 5) & 0x3F; // 6-bit green
27 fl::u8 b5 = rgb565 & 0x1F; // 5-bit blue
28
29 // Use lookup tables for fast conversion
30 r = FL_PGM_READ_BYTE_NEAR(&rgb565_5to8_table[r5]);
31 g = FL_PGM_READ_BYTE_NEAR(&rgb565_6to8_table[g6]);
32 b = FL_PGM_READ_BYTE_NEAR(&rgb565_5to8_table[b5]);
33}
34
35} // namespace fl

Callers 2

convertPixelsToRgbMethod · 0.85
pixel.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected