diff options
-rw-r--r-- | nuttx/ChangeLog | 3 | ||||
-rw-r--r-- | nuttx/include/nuttx/rgbcolors.h | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 0dd5c1f3e..b752b8ec3 100644 --- a/nuttx/ChangeLog +++ b/nuttx/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/nuttx/include/nuttx/rgbcolors.h b/nuttx/include/nuttx/rgbcolors.h index 93212f6e1..0f15d8158 100644 --- a/nuttx/include/nuttx/rgbcolors.h +++ b/nuttx/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 */ |