]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/color.h
Fix enables for Haptic Feedback (#6707)
[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 #ifndef COLOR_H
18 #define COLOR_H
19
20 #include <stdint.h>
21 #include <stdbool.h>
22
23 #if defined(__GNUC__)
24 #    define PACKED __attribute__((__packed__))
25 #else
26 #    define PACKED
27 #endif
28
29 #if defined(_MSC_VER)
30 #    pragma pack(push, 1)
31 #endif
32
33 #ifdef RGBW
34 #    define LED_TYPE cRGBW
35 #else
36 #    define LED_TYPE RGB
37 #endif
38
39 // WS2812 specific layout
40 typedef struct PACKED {
41     uint8_t g;
42     uint8_t r;
43     uint8_t b;
44 } cRGB;
45
46 typedef cRGB RGB;
47
48 // WS2812 specific layout
49 typedef struct PACKED {
50     uint8_t g;
51     uint8_t r;
52     uint8_t b;
53     uint8_t w;
54 } cRGBW;
55
56 typedef struct PACKED {
57     uint8_t h;
58     uint8_t s;
59     uint8_t v;
60 } HSV;
61
62 #if defined(_MSC_VER)
63 #    pragma pack(pop)
64 #endif
65
66 RGB hsv_to_rgb(HSV hsv);
67
68 #endif  // COLOR_H