diff --git a/ChangeLog b/ChangeLog index 0dd5c1f3e5f..b752b8ec347 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2192,3 +2192,6 @@ supports using "clusters" of AT24 pages as blocks. This allows bigger block sizes and more efficient use of EEPROM when the AT24 is used to support a file system (such as NXFFS). (Contributed by Hal Glenn). + * include/nuttx/rgbcolors.h: More fixes to RGB color conversion + macros. + diff --git a/include/nuttx/rgbcolors.h b/include/nuttx/rgbcolors.h index 93212f6e170..0f15d8158c3 100644 --- a/include/nuttx/rgbcolors.h +++ b/include/nuttx/rgbcolors.h @@ -56,10 +56,15 @@ #define RBG24GREEN(rgb) (((rgb) >> 8) & 0xff) #define RBG24BLUE(rgb) ( (rgb) & 0xff) -/* This macro creates RGB16 (5:6:5) from 8:8:8 RGB */ +/* This macro creates RGB16 (5:6:5) from 8:8:8 RGB: + * + * R[7:3] -> RGB[15:11] + * G[7:2] -> RGB[10:5] + * B[7:3] -> RGB[4:0] + */ #define RGBTO16(r,g,b) \ - ((((uint16_t)(r) << 11) & 0xf800) | (((uint16_t)(g) << 5) & 0x07e0) | ((uint16_t)(b) & 0x001f)) + ((((uint16_t)(r) << 8) & 0xf800) | (((uint16_t)(g) << 3) & 0x07e0) | (((uint16_t)(b) >> 3) & 0x001f)) /* And these macros perform the inverse transformation */