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

Function lpd6803EncodeRGB

src/fl/chipsets/encoders/encoder_utils.h:102–108  ·  view source on GitHub ↗

@brief Convert RGB to LPD6803 16-bit format (1bbbbbgggggrrrrr) @param r Red component (0-255) @param g Green component (0-255) @param b Blue component (0-255) @return 16-bit LPD6803 command word @note Bit 15: marker (1), Bits 14-0: 5-5-5 RGB

Source from the content-addressed store, hash-verified

100/// @return 16-bit LPD6803 command word
101/// @note Bit 15: marker (1), Bits 14-0: 5-5-5 RGB
102inline u16 lpd6803EncodeRGB(u8 r, u8 g, u8 b) FL_NOEXCEPT {
103 u16 command = 0x8000; // Start marker
104 command |= (r & 0xF8) << 7; // Red: high 5 bits
105 command |= (g & 0xF8) << 2; // Green: high 5 bits
106 command |= (b >> 3); // Blue: high 5 bits
107 return command;
108}
109
110} // namespace fl

Callers 3

encodeLPD6803Function · 0.85
verifyLEDFrameFunction · 0.85
lpd6803.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected