SAMV71 Xplained Ultra Software Package 1.5

lcd_color.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 #ifndef COLOR_H
00031 #define COLOR_H
00032 
00033 /**
00034  * \file
00035  *
00036  * RGB 24-bits color table definition.
00037  *
00038  */
00039 
00040 /*
00041  * RGB 24 Bpp
00042  * RGB 888
00043  * R7R6R5R4 R3R2R1R0 G7G6G5G4 G3G2G1G0 B7B6B5B4 B3B2B1B0
00044  */
00045 
00046 #define COLOR_BLACK          0x000000
00047 #define COLOR_WHITE          0xFFFFFF
00048 
00049 #define COLOR_BLUE           0x0000FF
00050 #define COLOR_GREEN          0x00FF00
00051 #define COLOR_RED            0xFF0000
00052 
00053 #define COLOR_NAVY           0x000080
00054 #define COLOR_DARKBLUE       0x00008B
00055 #define COLOR_DARKGREEN      0x006400
00056 #define COLOR_DARKCYAN       0x008B8B
00057 #define COLOR_CYAN           0x00FFFF
00058 #define COLOR_TURQUOISE      0x40E0D0
00059 #define COLOR_INDIGO         0x4B0082
00060 #define COLOR_DARKRED        0x800000
00061 #define COLOR_OLIVE          0x808000
00062 #define COLOR_GRAY           0x808080
00063 #define COLOR_SKYBLUE        0x87CEEB
00064 #define COLOR_BLUEVIOLET     0x8A2BE2
00065 #define COLOR_LIGHTGREEN     0x90EE90
00066 #define COLOR_DARKVIOLET     0x9400D3
00067 #define COLOR_YELLOWGREEN    0x9ACD32
00068 #define COLOR_BROWN          0xA52A2A
00069 #define COLOR_DARKGRAY       0xA9A9A9
00070 #define COLOR_SIENNA         0xA0522D
00071 #define COLOR_LIGHTBLUE      0xADD8E6
00072 #define COLOR_GREENYELLOW    0xADFF2F
00073 #define COLOR_SILVER         0xC0C0C0
00074 #define COLOR_LIGHTGREY      0xD3D3D3
00075 #define COLOR_LIGHTCYAN      0xE0FFFF
00076 #define COLOR_VIOLET         0xEE82EE
00077 #define COLOR_AZUR           0xF0FFFF
00078 #define COLOR_BEIGE          0xF5F5DC
00079 #define COLOR_MAGENTA        0xFF00FF
00080 #define COLOR_TOMATO         0xFF6347
00081 #define COLOR_GOLD           0xFFD700
00082 #define COLOR_ORANGE         0xFFA500
00083 #define COLOR_SNOW           0xFFFAFA
00084 #define COLOR_YELLOW         0xFFFF00
00085 
00086 #define BLACK 0x0000
00087 #define BLUE  0x001F
00088 #define RED   0xF800
00089 #define GREEN 0x07E0
00090 #define WHITE 0xFFFF
00091 
00092 /* level is in [0; 31]*/
00093 #define BLUE_LEV(level)   ((level)&BLUE)
00094 #define GREEN_LEV(level)  ((((level)*2)<<5)&GREEN)
00095 #define RED_LEV(level)    (((level)<<(5+6))&RED)
00096 #define GRAY_LEV(level)   (BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level))
00097 
00098 #define RGB_24_TO_RGB565(RGB) \
00099         (((RGB >>19)<<11) | (((RGB & 0x00FC00) >>5)) | (RGB & 0x00001F))
00100 #define RGB_24_TO_18BIT(RGB) \
00101         (((RGB >>16)&0xFC) | (((RGB & 0x00FF00) >>10) << 10) | (RGB & 0x0000FC)<<16)
00102 #define RGB_16_TO_18BIT(RGB) \
00103         (((((RGB >>11)*63)/31)<<18) | (RGB & 0x00FC00) | (((RGB & 0x00001F)*63)/31))
00104 #define BGR_TO_RGB_18BIT(RGB) \
00105         (RGB & 0xFF0000) | ((RGB & 0x00FF00) >> 8) | ((RGB & 0x0000FC) >> 16))
00106 #define BGR_16_TO_18BITRGB(RGB)   BGR_TO_RGB_18BIT(RGB_16_TO_18BIT(RGB))
00107 
00108 
00109 #endif /* #define COLOR_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines