diff options
| -rw-r--r-- | keyboards/anavi/macropad8/rules.mk | 1 | ||||
| -rw-r--r-- | quantum/color.c | 26 | ||||
| -rw-r--r-- | quantum/color.h | 1 |
3 files changed, 24 insertions, 4 deletions
diff --git a/keyboards/anavi/macropad8/rules.mk b/keyboards/anavi/macropad8/rules.mk index 498c27a20..d4443e3fe 100644 --- a/keyboards/anavi/macropad8/rules.mk +++ b/keyboards/anavi/macropad8/rules.mk | |||
| @@ -23,7 +23,6 @@ NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: ht | |||
| 23 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | 23 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
| 24 | MIDI_ENABLE = no # MIDI controls | 24 | MIDI_ENABLE = no # MIDI controls |
| 25 | AUDIO_ENABLE = no # Audio output on port C6 | 25 | AUDIO_ENABLE = no # Audio output on port C6 |
| 26 | UNICODE_ENABLE = yes # Unicode | ||
| 27 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 26 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
| 28 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. | 27 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. |
| 29 | OLED_DRIVER_ENABLE = yes # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C | 28 | OLED_DRIVER_ENABLE = yes # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C |
diff --git a/quantum/color.c b/quantum/color.c index c05030062..1c5128e4a 100644 --- a/quantum/color.c +++ b/quantum/color.c | |||
| @@ -18,14 +18,20 @@ | |||
| 18 | #include "led_tables.h" | 18 | #include "led_tables.h" |
| 19 | #include "progmem.h" | 19 | #include "progmem.h" |
| 20 | 20 | ||
| 21 | RGB hsv_to_rgb(HSV hsv) { | 21 | RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) { |
| 22 | RGB rgb; | 22 | RGB rgb; |
| 23 | uint8_t region, remainder, p, q, t; | 23 | uint8_t region, remainder, p, q, t; |
| 24 | uint16_t h, s, v; | 24 | uint16_t h, s, v; |
| 25 | 25 | ||
| 26 | if (hsv.s == 0) { | 26 | if (hsv.s == 0) { |
| 27 | #ifdef USE_CIE1931_CURVE | 27 | #ifdef USE_CIE1931_CURVE |
| 28 | rgb.r = rgb.g = rgb.b = pgm_read_byte(&CIE1931_CURVE[hsv.v]); | 28 | if (use_cie) { |
| 29 | rgb.r = rgb.g = rgb.b = pgm_read_byte(&CIE1931_CURVE[hsv.v]); | ||
| 30 | } else { | ||
| 31 | rgb.r = hsv.v; | ||
| 32 | rgb.g = hsv.v; | ||
| 33 | rgb.b = hsv.v; | ||
| 34 | } | ||
| 29 | #else | 35 | #else |
| 30 | rgb.r = hsv.v; | 36 | rgb.r = hsv.v; |
| 31 | rgb.g = hsv.v; | 37 | rgb.g = hsv.v; |
| @@ -37,7 +43,11 @@ RGB hsv_to_rgb(HSV hsv) { | |||
| 37 | h = hsv.h; | 43 | h = hsv.h; |
| 38 | s = hsv.s; | 44 | s = hsv.s; |
| 39 | #ifdef USE_CIE1931_CURVE | 45 | #ifdef USE_CIE1931_CURVE |
| 40 | v = pgm_read_byte(&CIE1931_CURVE[hsv.v]); | 46 | if (use_cie) { |
| 47 | v = pgm_read_byte(&CIE1931_CURVE[hsv.v]); | ||
| 48 | } else { | ||
| 49 | v = hsv.v; | ||
| 50 | } | ||
| 41 | #else | 51 | #else |
| 42 | v = hsv.v; | 52 | v = hsv.v; |
| 43 | #endif | 53 | #endif |
| @@ -86,6 +96,16 @@ RGB hsv_to_rgb(HSV hsv) { | |||
| 86 | return rgb; | 96 | return rgb; |
| 87 | } | 97 | } |
| 88 | 98 | ||
| 99 | RGB hsv_to_rgb(HSV hsv) { | ||
| 100 | #ifdef USE_CIE1931_CURVE | ||
| 101 | return hsv_to_rgb_impl(hsv, true); | ||
| 102 | #else | ||
| 103 | return hsv_to_rgb_impl(hsv, false); | ||
| 104 | #endif | ||
| 105 | } | ||
| 106 | |||
| 107 | RGB hsv_to_rgb_nocie(HSV hsv) { return hsv_to_rgb_impl(hsv, false); } | ||
| 108 | |||
| 89 | #ifdef RGBW | 109 | #ifdef RGBW |
| 90 | # ifndef MIN | 110 | # ifndef MIN |
| 91 | # define MIN(a, b) ((a) < (b) ? (a) : (b)) | 111 | # define MIN(a, b) ((a) < (b) ? (a) : (b)) |
diff --git a/quantum/color.h b/quantum/color.h index 58d4f0407..5c5a0f0eb 100644 --- a/quantum/color.h +++ b/quantum/color.h | |||
| @@ -64,6 +64,7 @@ typedef struct PACKED { | |||
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | RGB hsv_to_rgb(HSV hsv); | 66 | RGB hsv_to_rgb(HSV hsv); |
| 67 | RGB hsv_to_rgb_nocie(HSV hsv); | ||
| 67 | #ifdef RGBW | 68 | #ifdef RGBW |
| 68 | void convert_rgb_to_rgbw(LED_TYPE *led); | 69 | void convert_rgb_to_rgbw(LED_TYPE *led); |
| 69 | #endif | 70 | #endif |
