RTEMS: bsps/arm/atsam/contrib/libraries/libboard/include/lcd_color.h Source File

| RTEMS 5.4-rc2

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