diff options
| author | QMK Bot <hello@qmk.fm> | 2023-04-02 22:24:44 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2023-04-02 22:24:44 +0000 |
| commit | 78e0f8dd5452b71776a812f79287324568bcecf2 (patch) | |
| tree | d16ba89f0fb05e033a172b529f9b22fb9f43cd0e /users | |
| parent | d997fe1a4a8cc9530b3b9349441681c3fdeb1fe6 (diff) | |
| parent | d3008110096db2ac098db9b5cb47ad77582c01d9 (diff) | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'users')
| -rw-r--r-- | users/horrortroll/config.h | 64 | ||||
| -rw-r--r-- | users/horrortroll/horrortroll.c | 165 | ||||
| -rw-r--r-- | users/horrortroll/horrortroll.h | 49 | ||||
| -rw-r--r-- | users/horrortroll/led/cool_diagonal.c | 22 | ||||
| -rw-r--r-- | users/horrortroll/led/custom_gradient.c | 74 | ||||
| -rw-r--r-- | users/horrortroll/led/flower_blooming/flower_blooming.c | 27 | ||||
| -rw-r--r-- | users/horrortroll/led/flower_blooming/flower_blooming.h | 36 | ||||
| -rw-r--r-- | users/horrortroll/led/random_breath_rainbow.c | 55 | ||||
| -rw-r--r-- | users/horrortroll/readme.md | 24 | ||||
| -rw-r--r-- | users/horrortroll/rgb_matrix_user.inc | 13 | ||||
| -rw-r--r-- | users/horrortroll/rules.mk | 6 |
11 files changed, 535 insertions, 0 deletions
diff --git a/users/horrortroll/config.h b/users/horrortroll/config.h new file mode 100644 index 0000000000..50bc7da537 --- /dev/null +++ b/users/horrortroll/config.h | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | /* Copyright 2023 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #pragma once | ||
| 18 | |||
| 19 | /* Forcing to use NKRO instead 6KRO */ | ||
| 20 | #define FORCE_NKRO | ||
| 21 | |||
| 22 | #define DYNAMIC_KEYMAP_LAYER_COUNT 2 | ||
| 23 | |||
| 24 | #if defined(__arm__) | ||
| 25 | #ifdef RGB_MATRIX_ENABLE | ||
| 26 | #define RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | ||
| 27 | #endif | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #if defined(__AVR_ATmega32U4__) | ||
| 31 | #define NO_ACTION_ONESHOT | ||
| 32 | |||
| 33 | #ifdef RGB_MATRIX_ENABLE | ||
| 34 | /* RGB Matrix effect */ | ||
| 35 | #undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN | ||
| 36 | #undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT | ||
| 37 | #undef ENABLE_RGB_MATRIX_BAND_SAT | ||
| 38 | #undef ENABLE_RGB_MATRIX_BAND_VAL | ||
| 39 | #undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | ||
| 40 | #undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | ||
| 41 | #undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT | ||
| 42 | #undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL | ||
| 43 | #undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||
| 44 | #undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||
| 45 | #undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||
| 46 | #undef ENABLE_RGB_MATRIX_DUAL_BEACON | ||
| 47 | #undef ENABLE_RGB_MATRIX_RAINBOW_BEACON | ||
| 48 | #undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||
| 49 | #undef ENABLE_RGB_MATRIX_RAINDROPS | ||
| 50 | #undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||
| 51 | #undef ENABLE_RGB_MATRIX_HUE_WAVE | ||
| 52 | #undef ENABLE_RGB_MATRIX_PIXEL_RAIN | ||
| 53 | |||
| 54 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE | ||
| 55 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE | ||
| 56 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE | ||
| 57 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS | ||
| 58 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS | ||
| 59 | #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS | ||
| 60 | #undef ENABLE_RGB_MATRIX_SPLASH | ||
| 61 | #undef ENABLE_RGB_MATRIX_SOLID_SPLASH | ||
| 62 | #undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH | ||
| 63 | #endif | ||
| 64 | #endif | ||
diff --git a/users/horrortroll/horrortroll.c b/users/horrortroll/horrortroll.c new file mode 100644 index 0000000000..1152b2cc9d --- /dev/null +++ b/users/horrortroll/horrortroll.c | |||
| @@ -0,0 +1,165 @@ | |||
| 1 | /* Copyright 2023 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #include "horrortroll.h" | ||
| 18 | |||
| 19 | #include "rgb_matrix.h" | ||
| 20 | |||
| 21 | // For CUSTOM_GRADIENT | ||
| 22 | HSV gradient_0 = {205, 250, 255}; | ||
| 23 | HSV gradient_100 = {140, 215, 125}; | ||
| 24 | bool reflected_gradient = false; | ||
| 25 | uint8_t gp_i = 0; | ||
| 26 | |||
| 27 | typedef struct { | ||
| 28 | HSV gradient_0; | ||
| 29 | HSV gradient_1; | ||
| 30 | bool reflected; | ||
| 31 | } CUSTOM_PRESETS; | ||
| 32 | |||
| 33 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 34 | uint8_t color_adj_step = 5; | ||
| 35 | |||
| 36 | CUSTOM_PRESETS gradient_presets[] = { | ||
| 37 | {{41 , 255, 255}, {233, 245, 255}, false }, | ||
| 38 | {{45 , 245, 155}, {160, 255, 80}, false }, | ||
| 39 | {{173, 245, 40}, {41 , 255, 205}, true }, | ||
| 40 | {{32 , 255, 165}, {217, 185, 70}, false }, | ||
| 41 | {{240, 255, 145}, {115, 255, 245}, true }, | ||
| 42 | {{118, 255, 255}, {242, 255, 255}, false }, | ||
| 43 | {{212, 0 , 0}, {223, 235, 165}, true }, | ||
| 44 | {{205, 250, 255}, {140, 215, 125}, false }, | ||
| 45 | }; | ||
| 46 | |||
| 47 | uint8_t gp_length = sizeof(gradient_presets)/sizeof(gradient_presets[0]); | ||
| 48 | |||
| 49 | switch (keycode) { | ||
| 50 | case G1_HUI: | ||
| 51 | if (record->event.pressed) { | ||
| 52 | gradient_0.h += color_adj_step; | ||
| 53 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 54 | } | ||
| 55 | return false; | ||
| 56 | case G1_HUD: | ||
| 57 | if (record->event.pressed) { | ||
| 58 | gradient_0.h -= color_adj_step; | ||
| 59 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 60 | } | ||
| 61 | return false; | ||
| 62 | case G1_SAI: | ||
| 63 | if (record->event.pressed) { | ||
| 64 | gradient_0.s = (gradient_0.s + color_adj_step * 2 <= 255) ? gradient_0.s + color_adj_step * 2 : 255; | ||
| 65 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 66 | } | ||
| 67 | return false; | ||
| 68 | case G1_SAD: | ||
| 69 | if (record->event.pressed) { | ||
| 70 | gradient_0.s = (gradient_0.s - color_adj_step * 2 >= 0) ? gradient_0.s - color_adj_step * 2 : 0; | ||
| 71 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 72 | } | ||
| 73 | return false; | ||
| 74 | case G1_VAI: | ||
| 75 | if (record->event.pressed) { | ||
| 76 | gradient_0.v = (gradient_0.v + color_adj_step * 2 <= 255) ? gradient_0.v + color_adj_step * 2 : 255; | ||
| 77 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 78 | } | ||
| 79 | return false; | ||
| 80 | case G1_VAD: | ||
| 81 | if (record->event.pressed) { | ||
| 82 | gradient_0.v = (gradient_0.v - color_adj_step * 2 >= 0) ? gradient_0.v - color_adj_step * 2 : 0; | ||
| 83 | dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); | ||
| 84 | } | ||
| 85 | return false; | ||
| 86 | case G2_HUI: | ||
| 87 | if (record->event.pressed) { | ||
| 88 | gradient_100.h += color_adj_step; | ||
| 89 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 90 | } | ||
| 91 | return false; | ||
| 92 | case G2_HUD: | ||
| 93 | if (record->event.pressed) { | ||
| 94 | gradient_100.h -= color_adj_step; | ||
| 95 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 96 | } | ||
| 97 | return false; | ||
| 98 | case G2_SAI: | ||
| 99 | if (record->event.pressed) { | ||
| 100 | gradient_100.s = (gradient_100.s + color_adj_step * 2 <= 255) ? gradient_100.s + color_adj_step * 2 : 255; | ||
| 101 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 102 | } | ||
| 103 | return false; | ||
| 104 | case G2_SAD: | ||
| 105 | if (record->event.pressed) { | ||
| 106 | gradient_100.s = (gradient_100.s - color_adj_step * 2 >= 0) ? gradient_100.s - color_adj_step * 2 : 0; | ||
| 107 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 108 | } | ||
| 109 | return false; | ||
| 110 | case G2_VAI: | ||
| 111 | if (record->event.pressed) { | ||
| 112 | gradient_100.v = (gradient_100.v + color_adj_step * 2 <= 255) ? gradient_100.v + color_adj_step * 2 : 255; | ||
| 113 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 114 | } | ||
| 115 | return false; | ||
| 116 | case G2_VAD: | ||
| 117 | if (record->event.pressed) { | ||
| 118 | gradient_100.v = (gradient_100.v - color_adj_step * 2 >= 0) ? gradient_100.v - color_adj_step * 2 : 0; | ||
| 119 | dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); | ||
| 120 | } | ||
| 121 | return false; | ||
| 122 | case G_PRE: | ||
| 123 | if (record->event.pressed) { | ||
| 124 | gp_i = (gp_i + gp_length ) % gp_length; | ||
| 125 | |||
| 126 | gradient_0 = gradient_presets[gp_i].gradient_0; | ||
| 127 | gradient_100 = gradient_presets[gp_i].gradient_1; | ||
| 128 | reflected_gradient = gradient_presets[gp_i].reflected; | ||
| 129 | |||
| 130 | gp_i += 1; | ||
| 131 | } | ||
| 132 | return false; | ||
| 133 | case REF_G: | ||
| 134 | if (record->event.pressed) { | ||
| 135 | reflected_gradient = !reflected_gradient; | ||
| 136 | } | ||
| 137 | return false; | ||
| 138 | case G_FLIP: | ||
| 139 | if (record->event.pressed) { | ||
| 140 | HSV temp_color = gradient_0; | ||
| 141 | gradient_0 = gradient_100; | ||
| 142 | gradient_100 = temp_color; | ||
| 143 | } | ||
| 144 | return false; | ||
| 145 | case RGB_C_E: | ||
| 146 | if (record->event.pressed) { | ||
| 147 | switch (rgb_matrix_get_mode()) { | ||
| 148 | case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: | ||
| 149 | rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL); | ||
| 150 | return false; | ||
| 151 | case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: | ||
| 152 | rgb_matrix_mode(RGB_MATRIX_CUSTOM_FLOWER_BLOOMING); | ||
| 153 | return false; | ||
| 154 | case RGB_MATRIX_CUSTOM_FLOWER_BLOOMING: | ||
| 155 | rgb_matrix_mode(RGB_MATRIX_CUSTOM_RANDOM_BREATH_RAINBOW); | ||
| 156 | return false; | ||
| 157 | default: | ||
| 158 | rgb_matrix_mode(RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT); | ||
| 159 | return false; | ||
| 160 | } | ||
| 161 | } | ||
| 162 | return false; | ||
| 163 | } | ||
| 164 | return true; | ||
| 165 | } | ||
diff --git a/users/horrortroll/horrortroll.h b/users/horrortroll/horrortroll.h new file mode 100644 index 0000000000..a251f74d6c --- /dev/null +++ b/users/horrortroll/horrortroll.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* Copyright 2023 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #include "quantum.h" | ||
| 18 | |||
| 19 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 20 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 21 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 22 | // entirely and just use numbers. | ||
| 23 | |||
| 24 | enum layer_names { | ||
| 25 | _BASE, | ||
| 26 | _FN, | ||
| 27 | }; | ||
| 28 | |||
| 29 | enum custom_keycodes { | ||
| 30 | //Custom Gradient control keycode | ||
| 31 | G1_HUI = SAFE_RANGE, //Custom gradient color 1 hue increase | ||
| 32 | G1_HUD, //Custom gradient color 1 hue decrease | ||
| 33 | G1_SAI, //Custom gradient color 1 saturation increase | ||
| 34 | G1_SAD, //Custom gradient color 1 saturation decrease | ||
| 35 | G1_VAI, //Custom gradient color 1 value increase | ||
| 36 | G1_VAD, //Custom gradient color 1 value decrease | ||
| 37 | G2_HUI, //Custom gradient color 2 hue increase | ||
| 38 | G2_HUD, //Custom gradient color 2 hue decrease | ||
| 39 | G2_SAI, //Custom gradient color 2 saturation increase | ||
| 40 | G2_SAD, //Custom gradient color 2 saturation decrease | ||
| 41 | G2_VAI, //Custom gradient color 2 value increase | ||
| 42 | G2_VAD, //Custom gradient color 2 value decrease | ||
| 43 | G_PRE, //Gradient presets | ||
| 44 | REF_G, //Toggle between linear and reflected gradient | ||
| 45 | G_FLIP, //Flip the gradient colors | ||
| 46 | |||
| 47 | //Custom led effect keycode | ||
| 48 | RGB_C_E, //Cycle user effect | ||
| 49 | }; | ||
diff --git a/users/horrortroll/led/cool_diagonal.c b/users/horrortroll/led/cool_diagonal.c new file mode 100644 index 0000000000..900130aba5 --- /dev/null +++ b/users/horrortroll/led/cool_diagonal.c | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | static HSV COOL_DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { | ||
| 18 | hsv.h = (g_led_config.point[i].x / 4) - g_led_config.point[i].y - time; | ||
| 19 | return hsv; | ||
| 20 | } | ||
| 21 | |||
| 22 | bool COOL_DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &COOL_DIAGONAL_math); } | ||
diff --git a/users/horrortroll/led/custom_gradient.c b/users/horrortroll/led/custom_gradient.c new file mode 100644 index 0000000000..af6173d250 --- /dev/null +++ b/users/horrortroll/led/custom_gradient.c | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | extern HSV gradient_0; | ||
| 18 | extern HSV gradient_100; | ||
| 19 | extern bool reflected_gradient; | ||
| 20 | |||
| 21 | static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { | ||
| 22 | uint8_t cw, ccw; | ||
| 23 | HSV color; | ||
| 24 | |||
| 25 | cw = (gradient_0.h >= gradient_100.h) ? 255 + gradient_100.h - gradient_0.h : gradient_100.h - gradient_0.h; // Hue range is 0 to 255. | ||
| 26 | ccw = (gradient_0.h >= gradient_100.h) ? gradient_0.h - gradient_100.h : 255 + gradient_0.h - gradient_100.h; | ||
| 27 | |||
| 28 | if( cw < ccw ) { // going clockwise | ||
| 29 | color.h = gradient_0.h + (uint8_t)(step * cw); | ||
| 30 | } else { // Going counter clockwise | ||
| 31 | color.h = gradient_0.h - (uint8_t)(step * ccw); | ||
| 32 | } | ||
| 33 | |||
| 34 | color.s = gradient_0.s + step * (gradient_100.s - gradient_0.s); | ||
| 35 | |||
| 36 | // Scale V with global RGB Matrix's V, so users can still control overall brightness with RGB_VAI & RGB_VAD0 | ||
| 37 | color.v = round((gradient_0.v + step * (gradient_100.v - gradient_0.v)) * ((float)rgb_matrix_config.hsv.v / 255)); | ||
| 38 | |||
| 39 | return color; | ||
| 40 | } | ||
| 41 | |||
| 42 | static HSV CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { | ||
| 43 | float step = (float)led_x / (max_x - min_x); | ||
| 44 | float mid_gradient_pos = 0.5; | ||
| 45 | |||
| 46 | if( reflected_gradient ) { | ||
| 47 | if( step <= mid_gradient_pos ) { | ||
| 48 | return INTERPOLATE_HSV(step * (1/mid_gradient_pos), gradient_0, gradient_100); | ||
| 49 | } else { | ||
| 50 | return INTERPOLATE_HSV((step - mid_gradient_pos) * (1/(1-mid_gradient_pos)), gradient_100, gradient_0); | ||
| 51 | } | ||
| 52 | |||
| 53 | } else { | ||
| 54 | return INTERPOLATE_HSV(step, gradient_0, gradient_100); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | static bool CUSTOM_GRADIENT(effect_params_t* params) { | ||
| 59 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 60 | |||
| 61 | uint8_t min_x = 0; // X coordinate of the left-most LED | ||
| 62 | uint8_t max_x = 224; // X coordinate of the right-most LED | ||
| 63 | |||
| 64 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 65 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
| 66 | |||
| 67 | HSV hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); | ||
| 68 | RGB rgb = hsv_to_rgb(hsv_orig); | ||
| 69 | |||
| 70 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 71 | } | ||
| 72 | |||
| 73 | return led_max < RGB_MATRIX_LED_COUNT; | ||
| 74 | } | ||
diff --git a/users/horrortroll/led/flower_blooming/flower_blooming.c b/users/horrortroll/led/flower_blooming/flower_blooming.c new file mode 100644 index 0000000000..add83149cc --- /dev/null +++ b/users/horrortroll/led/flower_blooming/flower_blooming.c | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #include "led/flower_blooming/flower_blooming.h" | ||
| 18 | |||
| 19 | static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { | ||
| 20 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) | ||
| 21 | hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; | ||
| 22 | else | ||
| 23 | hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 - time; | ||
| 24 | return hsv; | ||
| 25 | } | ||
| 26 | |||
| 27 | bool FLOWER_BLOOMING(effect_params_t* params) { return effect_runner_bloom(params, &FLOWER_BLOOMING_math); } | ||
diff --git a/users/horrortroll/led/flower_blooming/flower_blooming.h b/users/horrortroll/led/flower_blooming/flower_blooming.h new file mode 100644 index 0000000000..ccdaa70d97 --- /dev/null +++ b/users/horrortroll/led/flower_blooming/flower_blooming.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #pragma once | ||
| 18 | |||
| 19 | typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); | ||
| 20 | |||
| 21 | bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { | ||
| 22 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 23 | |||
| 24 | uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 10, 1)); | ||
| 25 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 26 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
| 27 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) { | ||
| 28 | RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | ||
| 29 | rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); | ||
| 30 | } else { | ||
| 31 | RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | ||
| 32 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | return rgb_matrix_check_finished_leds(led_max); | ||
| 36 | } | ||
diff --git a/users/horrortroll/led/random_breath_rainbow.c b/users/horrortroll/led/random_breath_rainbow.c new file mode 100644 index 0000000000..ba1ca55faf --- /dev/null +++ b/users/horrortroll/led/random_breath_rainbow.c | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | static uint8_t offset[RGB_MATRIX_LED_COUNT]; | ||
| 18 | |||
| 19 | static void doRandom_breath_rainbow(int i, effect_params_t* params) { | ||
| 20 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; | ||
| 21 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 6); | ||
| 22 | |||
| 23 | if (rand() * 50 == 1) { | ||
| 24 | if (rand() * 2 == 1) { | ||
| 25 | offset[i]++; | ||
| 26 | } | ||
| 27 | else { | ||
| 28 | offset[i]--; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | //float val = (((float)sin8(time + offset[i]) / 256)/2.1) + .05; | ||
| 33 | HSV hsv = {0, 255, 255}; | ||
| 34 | hsv.h = scale16by8(g_rgb_timer + offset[i], rgb_matrix_config.speed / 4) + (offset[i]*2); | ||
| 35 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | ||
| 36 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | ||
| 37 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 38 | } | ||
| 39 | |||
| 40 | bool RANDOM_BREATH_RAINBOW(effect_params_t* params) { | ||
| 41 | |||
| 42 | if (!params->init) { | ||
| 43 | // Change one LED every tick, make sure speed is not 0 | ||
| 44 | doRandom_breath_rainbow(rand() % RGB_MATRIX_LED_COUNT, params); | ||
| 45 | return false; | ||
| 46 | } | ||
| 47 | |||
| 48 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 49 | |||
| 50 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 51 | doRandom_breath_rainbow(i, params); | ||
| 52 | } | ||
| 53 | |||
| 54 | return led_max < RGB_MATRIX_LED_COUNT; | ||
| 55 | } | ||
diff --git a/users/horrortroll/readme.md b/users/horrortroll/readme.md new file mode 100644 index 0000000000..420c9b0986 --- /dev/null +++ b/users/horrortroll/readme.md | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* Copyright 2023 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | # My personal keymap with custom LED | ||
| 18 | |||
| 19 | ### Custom LED effect list: | ||
| 20 | |||
| 21 | - Custom gradient ([ported from SirTimmyTimbit code](https://github.com/SirTimmyTimbit/customizable-gradient-effect-for-drop-alt)) | ||
| 22 | - Cool diagonal ([ported from pleasuretek code](https://github.com/pleasuretek/qmk_firmware)) | ||
| 23 | - Flower Blooming | ||
| 24 | - Random breath rainbow ([based from daed code](https://github.com/daed/qmk_firmware/blob/master/keyboards/massdrop/alt/keymaps/daed) and modify by me) | ||
diff --git a/users/horrortroll/rgb_matrix_user.inc b/users/horrortroll/rgb_matrix_user.inc new file mode 100644 index 0000000000..08c608dc44 --- /dev/null +++ b/users/horrortroll/rgb_matrix_user.inc | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | RGB_MATRIX_EFFECT(CUSTOM_GRADIENT) | ||
| 2 | RGB_MATRIX_EFFECT(COOL_DIAGONAL) | ||
| 3 | RGB_MATRIX_EFFECT(FLOWER_BLOOMING) | ||
| 4 | RGB_MATRIX_EFFECT(RANDOM_BREATH_RAINBOW) | ||
| 5 | |||
| 6 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
| 7 | |||
| 8 | #include "led/custom_gradient.c" | ||
| 9 | #include "led/cool_diagonal.c" | ||
| 10 | #include "led/flower_blooming/flower_blooming.c" | ||
| 11 | #include "led/random_breath_rainbow.c" | ||
| 12 | |||
| 13 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
diff --git a/users/horrortroll/rules.mk b/users/horrortroll/rules.mk new file mode 100644 index 0000000000..579f5fd38b --- /dev/null +++ b/users/horrortroll/rules.mk | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | RGB_MATRIX_CUSTOM_USER = yes | ||
| 3 | |||
| 4 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | ||
| 5 | SRC += $(USER_PATH)/horrortroll.c | ||
| 6 | endif | ||
