]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/color.h
[Keyboard] fixed pins for numpad_5x4 layout (#6311)
[qmk_firmware.git] / quantum / color.h
1 /* Copyright 2017 Jason Williams
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16
17
18 #ifndef COLOR_H
19 #define COLOR_H
20
21 #include <stdint.h>
22 #include <stdbool.h>
23
24
25 #if defined(__GNUC__)
26 #define PACKED __attribute__ ((__packed__))
27 #else
28 #define PACKED
29 #endif
30
31 #if defined(_MSC_VER)
32 #pragma pack( push, 1 )
33 #endif
34
35 #ifdef RGBW
36   #define LED_TYPE cRGBW
37 #else
38   #define LED_TYPE RGB
39 #endif
40
41 // WS2812 specific layout
42 typedef struct PACKED
43 {
44         uint8_t g;
45         uint8_t r;
46         uint8_t b;
47 } cRGB;
48
49 typedef cRGB RGB;
50
51 // WS2812 specific layout
52 typedef struct PACKED
53 {
54         uint8_t g;
55         uint8_t r;
56         uint8_t b;
57         uint8_t w;
58 } cRGBW;
59
60 typedef struct PACKED
61 {
62         uint8_t h;
63         uint8_t s;
64         uint8_t v;
65 } HSV;
66
67 #if defined(_MSC_VER)
68 #pragma pack( pop )
69 #endif
70
71 RGB hsv_to_rgb(HSV hsv);
72
73 #endif // COLOR_H