]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libboard_samv7-ek/include/lcd_color.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAMV71_Xplained_IAR_Keil / libboard_samv7-ek / include / lcd_color.h
1 /* ----------------------------------------------------------------------------\r
2  *         SAM Software Package License\r
3  * ----------------------------------------------------------------------------\r
4  * Copyright (c) 2011, Atmel Corporation\r
5  *\r
6  * All rights reserved.\r
7  *\r
8  * Redistribution and use in source and binary forms, with or without\r
9  * modification, are permitted provided that the following conditions are met:\r
10  *\r
11  * - Redistributions of source code must retain the above copyright notice,\r
12  * this list of conditions and the disclaimer below.\r
13  *\r
14  * Atmel's name may not be used to endorse or promote products derived from\r
15  * this software without specific prior written permission.\r
16  *\r
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
27  * ----------------------------------------------------------------------------\r
28  */\r
29 \r
30 #ifndef COLOR_H\r
31 #define COLOR_H\r
32 \r
33 /**\r
34  * \file\r
35  *\r
36  * RGB 24-bits color table definition.\r
37  *\r
38  */\r
39 \r
40 /*\r
41  * RGB 24 Bpp\r
42  * RGB 888\r
43  * R7R6R5R4 R3R2R1R0 G7G6G5G4 G3G2G1G0 B7B6B5B4 B3B2B1B0\r
44  */\r
45 \r
46 #define COLOR_BLACK          0x000000\r
47 #define COLOR_WHITE          0xFFFFFF\r
48 \r
49 #define COLOR_BLUE           0x0000FF\r
50 #define COLOR_GREEN          0x00FF00\r
51 #define COLOR_RED            0xFF0000\r
52 \r
53 #define COLOR_NAVY           0x000080\r
54 #define COLOR_DARKBLUE       0x00008B\r
55 #define COLOR_DARKGREEN      0x006400\r
56 #define COLOR_DARKCYAN       0x008B8B\r
57 #define COLOR_CYAN           0x00FFFF\r
58 #define COLOR_TURQUOISE      0x40E0D0\r
59 #define COLOR_INDIGO         0x4B0082\r
60 #define COLOR_DARKRED        0x800000\r
61 #define COLOR_OLIVE          0x808000\r
62 #define COLOR_GRAY           0x808080\r
63 #define COLOR_SKYBLUE        0x87CEEB\r
64 #define COLOR_BLUEVIOLET     0x8A2BE2\r
65 #define COLOR_LIGHTGREEN     0x90EE90\r
66 #define COLOR_DARKVIOLET     0x9400D3\r
67 #define COLOR_YELLOWGREEN    0x9ACD32\r
68 #define COLOR_BROWN          0xA52A2A\r
69 #define COLOR_DARKGRAY       0xA9A9A9\r
70 #define COLOR_SIENNA         0xA0522D\r
71 #define COLOR_LIGHTBLUE      0xADD8E6\r
72 #define COLOR_GREENYELLOW    0xADFF2F\r
73 #define COLOR_SILVER         0xC0C0C0\r
74 #define COLOR_LIGHTGREY      0xD3D3D3\r
75 #define COLOR_LIGHTCYAN      0xE0FFFF\r
76 #define COLOR_VIOLET         0xEE82EE\r
77 #define COLOR_AZUR           0xF0FFFF\r
78 #define COLOR_BEIGE          0xF5F5DC\r
79 #define COLOR_MAGENTA        0xFF00FF\r
80 #define COLOR_TOMATO         0xFF6347\r
81 #define COLOR_GOLD           0xFFD700\r
82 #define COLOR_ORANGE         0xFFA500\r
83 #define COLOR_SNOW           0xFFFAFA\r
84 #define COLOR_YELLOW         0xFFFF00\r
85 \r
86 #define BLACK 0x0000\r
87 #define BLUE  0x001F\r
88 #define RED   0xF800\r
89 #define GREEN 0x07E0\r
90 #define WHITE 0xFFFF\r
91 \r
92 #define BLUE_LEV( level)  (   (level)&BLUE )                                      // level is in [0; 31]\r
93 #define GREEN_LEV(level)  ( (((level)*2)<<5)&GREEN )                              // level is in [0; 31]\r
94 #define RED_LEV(  level)  (  ((level)<<(5+6))&RED )                               // level is in [0; 31]\r
95 #define GRAY_LEV( level)  ( BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level) ) // level is in [0; 31]\r
96 \r
97    \r
98 #define RGB_24_TO_18BIT(RGB)      (((RGB >>18) << 18) | (((RGB & 0x00FF00) >>10) << 10) | (RGB & 0x0000FC))\r
99 #define RGB_16_TO_18BIT(RGB)      (((((RGB >>11)*63)/31) << 18) | (RGB & 0x00FC00) | (((RGB & 0x00001F)*63)/31) )\r
100 #define BGR_TO_RGB_18BIT(RGB)     ((RGB & 0xFF0000) | ((RGB & 0x00FF00) >> 8 ) | ( (RGB & 0x0000FC) >> 16 ))\r
101 \r
102 #define BGR_16_TO_18BITRGB(RGB)  BGR_TO_RGB_18BIT(RGB_16_TO_18BIT(RGB))\r
103    \r
104 #endif /* #define COLOR_H */\r