Skip to content

Commit

Permalink
fix ledGetRGBColor 565 format
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtreetech authored Apr 22, 2021
1 parent 7c91761 commit 2238203
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion TFT/src/User/Menu/LEDColor.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ uint8_t ledGetControlSubIndex(uint8_t keyNum)

uint16_t ledGetRGBColor(LED_VECT * led)
{
return (((*led)[0] & 0x001F) << 11) | (((*led)[1] & 0x003F) << 5) | (((*led)[2] & 0x001F)); // RGB color in RGB 565 16 bit format
uint8_t r = (*led)[0] >> 3;
uint8_t g = (*led)[1] >> 2;
uint8_t b = (*led)[2] >> 3;
return ((r & 0x001F) << 11) | ((g & 0x003F) << 5) | ((b & 0x001F)); // RGB color in RGB 565 16 bit format
}

uint16_t ledGetComponentRGBColor(uint8_t component, uint8_t index)
Expand Down

0 comments on commit 2238203

Please sign in to comment.