Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / common / color.h
blob3eb7a53cfccb5f6341dccac432e4ce45c1a0389f
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
24 typedef enum {
25 RGB_RED = 0,
26 RGB_GREEN,
27 RGB_BLUE
28 } colorComponent_e;
30 #define RGB_COLOR_COMPONENT_COUNT (RGB_BLUE + 1)
32 struct rgbColor24bpp_s {
33 uint8_t r;
34 uint8_t g;
35 uint8_t b;
38 typedef union {
39 struct rgbColor24bpp_s rgb;
40 uint8_t raw[RGB_COLOR_COMPONENT_COUNT];
41 } rgbColor24bpp_t;
43 #define HSV_HUE_MAX 359
44 #define HSV_SATURATION_MAX 255
45 #define HSV_VALUE_MAX 255
47 typedef enum {
48 HSV_HUE = 0,
49 HSV_SATURATION,
50 HSV_VALUE
51 } hsvColorComponent_e;
53 #define HSV_COLOR_COMPONENT_COUNT (HSV_VALUE + 1)
55 typedef struct hsvColor_s {
56 uint16_t h; // 0 - 359
57 uint8_t s; // 0 - 255
58 uint8_t v; // 0 - 255
59 } hsvColor_t;