diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-11-03 22:27:53 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-11-03 22:27:53 +0000 |
commit | 5817b3e9281211530e226e0e676f5c22ac02fa5e (patch) | |
tree | 02260764199f62a03673cef754e7da3e63dc2ef7 /nuttx/include | |
parent | 7cda77d3020afa4b87f26e8a4783e35f4d8b4d69 (diff) | |
download | px4-nuttx-5817b3e9281211530e226e0e676f5c22ac02fa5e.tar.gz px4-nuttx-5817b3e9281211530e226e0e676f5c22ac02fa5e.tar.bz2 px4-nuttx-5817b3e9281211530e226e0e676f5c22ac02fa5e.zip |
Fix some RGB color macros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4081 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/rgbcolors.h | 9 |
1 files changed, 7 insertions, 2 deletions
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 */ |