diff options
Diffstat (limited to 'keyboards/mechlovin/infinity875/keymaps/via')
5 files changed, 843 insertions, 0 deletions
diff --git a/keyboards/mechlovin/infinity875/keymaps/via/config.h b/keyboards/mechlovin/infinity875/keymaps/via/config.h new file mode 100644 index 0000000000..74ee03f3f9 --- /dev/null +++ b/keyboards/mechlovin/infinity875/keymaps/via/config.h @@ -0,0 +1,24 @@ +/* +Copyright 2021 Mechlovin' Studio + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#ifdef RGB_MATRIX_ENABLE + +#define VIA_QMK_RGBLIGHT_ENABLE + +#endif diff --git a/keyboards/mechlovin/infinity875/keymaps/via/keymap.c b/keyboards/mechlovin/infinity875/keymaps/via/keymap.c new file mode 100644 index 0000000000..283104b5b2 --- /dev/null +++ b/keyboards/mechlovin/infinity875/keymaps/via/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2021 Mechlovin' Studio + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_PSCR, KC_SLCK, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_LSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_LALT, KC_LGUI,MO(1), KC_LCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SAI, RGB_HUI, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_SAD, RGB_HUD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAI, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD, RGB_VAD, RGB_MOD + ), + [2] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [3] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; diff --git a/keyboards/mechlovin/infinity875/keymaps/via/readme.md b/keyboards/mechlovin/infinity875/keymaps/via/readme.md new file mode 100644 index 0000000000..9289e7dbe2 --- /dev/null +++ b/keyboards/mechlovin/infinity875/keymaps/via/readme.md @@ -0,0 +1 @@ +# The VIA keymap for infinity87.5 diff --git a/keyboards/mechlovin/infinity875/keymaps/via/rgb_matrix_user.inc b/keyboards/mechlovin/infinity875/keymaps/via/rgb_matrix_user.inc new file mode 100644 index 0000000000..cee6a3f038 --- /dev/null +++ b/keyboards/mechlovin/infinity875/keymaps/via/rgb_matrix_user.inc @@ -0,0 +1,764 @@ +/* +Copyright 2020 Evy Dekkers + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +RGB_MATRIX_EFFECT(solid_esc) +RGB_MATRIX_EFFECT(solid_f13) +RGB_MATRIX_EFFECT(solid_clus) +RGB_MATRIX_EFFECT(breathing_all) +RGB_MATRIX_EFFECT(breathing_esc) +RGB_MATRIX_EFFECT(breathing_f13) +RGB_MATRIX_EFFECT(breathing_clus) +RGB_MATRIX_EFFECT(band_val_all) +RGB_MATRIX_EFFECT(band_val_esc) +RGB_MATRIX_EFFECT(band_val_f13) +RGB_MATRIX_EFFECT(band_val_clus) +RGB_MATRIX_EFFECT(cycle_up_down_all) +RGB_MATRIX_EFFECT(cycle_up_down_esc) +RGB_MATRIX_EFFECT(cycle_up_down_f13) +RGB_MATRIX_EFFECT(cycle_up_down_clus) +RGB_MATRIX_EFFECT(cycle_out_in_dual_all) +RGB_MATRIX_EFFECT(cycle_out_in_dual_esc) +RGB_MATRIX_EFFECT(cycle_out_in_dual_f13) +RGB_MATRIX_EFFECT(cycle_out_in_dual_clus) +RGB_MATRIX_EFFECT(rainbow_moving_chevron_all) +RGB_MATRIX_EFFECT(rainbow_moving_chevron_esc) +RGB_MATRIX_EFFECT(rainbow_moving_chevron_f13) +RGB_MATRIX_EFFECT(rainbow_moving_chevron_clus) +RGB_MATRIX_EFFECT(cycle_pimwheel_all) +RGB_MATRIX_EFFECT(cycle_pimwheel_esc) +RGB_MATRIX_EFFECT(cycle_pimwheel_f13) +RGB_MATRIX_EFFECT(cycle_pimwheel_clus) +RGB_MATRIX_EFFECT(rainbow_beacon_all) +RGB_MATRIX_EFFECT(rainbow_beacon_esc) +RGB_MATRIX_EFFECT(rainbow_beacon_f13) +RGB_MATRIX_EFFECT(rainbow_beacon_clus) +RGB_MATRIX_EFFECT(raindrops_all) +RGB_MATRIX_EFFECT(raindrops_esc) +RGB_MATRIX_EFFECT(raindrops_f13) +RGB_MATRIX_EFFECT(raindrops_clus) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +bool effect_runner_all(effect_params_t* params, i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_esc(effect_params_t* params, i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 1; i < 18; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_f13(effect_params_t* params, i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(15, 0x00, 0x00, 0x00); + rgb_matrix_set_color(16, 0x00, 0x00, 0x00); + rgb_matrix_set_color(17, 0x00, 0x00, 0x00); + } + for (uint8_t i = 0; i < 14; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_clus(effect_params_t* params, i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 0; i < 15; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_dx_dy_all(effect_params_t* params, dx_dy_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; + int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_dx_dy_esc(effect_params_t* params, dx_dy_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; + int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 1; i < 18; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_dx_dy_f13(effect_params_t* params, dx_dy_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; + int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(15, 0x00, 0x00, 0x00); + rgb_matrix_set_color(16, 0x00, 0x00, 0x00); + rgb_matrix_set_color(17, 0x00, 0x00, 0x00); + } + for (uint8_t i = 0; i < 14; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_dx_dy_clus(effect_params_t* params, dx_dy_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; + int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 0; i < 15; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_sin_cos_all(effect_params_t* params, sin_cos_i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); + int8_t cos_value = cos8(time) - 128; + int8_t sin_value = sin8(time) - 128; + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_sin_cos_esc(effect_params_t* params, sin_cos_i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); + int8_t cos_value = cos8(time) - 128; + int8_t sin_value = sin8(time) - 128; + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 1; i < 18; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_sin_cos_f13(effect_params_t* params, sin_cos_i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); + int8_t cos_value = cos8(time) - 128; + int8_t sin_value = sin8(time) - 128; + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(15, 0x00, 0x00, 0x00); + rgb_matrix_set_color(16, 0x00, 0x00, 0x00); + rgb_matrix_set_color(17, 0x00, 0x00, 0x00); + } + for (uint8_t i = 0; i < 14; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +bool effect_runner_sin_cos_clus(effect_params_t* params, sin_cos_i_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4); + int8_t cos_value = cos8(time) - 128; + int8_t sin_value = sin8(time) - 128; + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + for (uint8_t i = 0; i < 15; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return led_max < DRIVER_LED_TOTAL; +} + +static void raindrops_set_color_all(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + + // Take the shortest path between hues + int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; + if (deltaH > 127) { + deltaH -= 256; + } else if (deltaH < -127) { + deltaH += 256; + } + + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); +} + +static void raindrops_set_color_esc(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + + // Take the shortest path between hues + int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; + if (deltaH > 127) { + deltaH -= 256; + } else if (deltaH < -127) { + deltaH += 256; + } + + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + for (uint8_t i = 1; i < 18; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } +} + +static void raindrops_set_color_f13(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + + // Take the shortest path between hues + int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; + if (deltaH > 127) { + deltaH -= 256; + } else if (deltaH < -127) { + deltaH += 256; + } + + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(15, 0x00, 0x00, 0x00); + rgb_matrix_set_color(16, 0x00, 0x00, 0x00); + rgb_matrix_set_color(17, 0x00, 0x00, 0x00); + for (uint8_t i = 0; i < 14; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } +} + +static void raindrops_set_color_clus(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; + HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + + // Take the shortest path between hues + int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; + if (deltaH > 127) { + deltaH -= 256; + } else if (deltaH < -127) { + deltaH += 256; + } + + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + for (uint8_t i = 0; i < 15; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } +} + +static HSV BAND_VAL_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { + int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; + hsv.v = scale8(v < 0 ? 0 : v, hsv.v); + return hsv; +} + +static HSV CYCLE_UP_DOWN_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = g_led_config.point[i].y - time; + return hsv; +} + +static HSV CYCLE_OUT_IN_DUAL_CUSTOM(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { + dx = (k_rgb_matrix_center.x / 2) - abs8(dx); + uint8_t dist = sqrt16(dx * dx + dy * dy); + hsv.h = 3 * dist + time; + return hsv; +} + +static HSV RAINBOW_MOVING_CHEVRON_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { + hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); + return hsv; +} + +static HSV CYCLE_PINWHEEL_CUSTOM(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { + hsv.h = atan2_8(dy, dx) + time; + return hsv; +} + +static HSV RAINBOW_BEACON_CUSTOM(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { + hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128; + return hsv; +} + + + +// Solid ESC +static bool solid_esc(effect_params_t* params) { + HSV hsv = rgb_matrix_config.hsv; + RGB rgb = hsv_to_rgb(hsv); + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 18 ; i < led_max; i++) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(0, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Solid F13 +static bool solid_f13(effect_params_t* params) { + HSV hsv = rgb_matrix_config.hsv; + RGB rgb = hsv_to_rgb(hsv); + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 18 ; i < led_max; i++) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(14, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Solid cluster +static bool solid_clus(effect_params_t* params) { + HSV hsv = rgb_matrix_config.hsv; + RGB rgb = hsv_to_rgb(hsv); + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 15 ; i < led_max; i++) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Breathing all + +bool breathing_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = rgb_matrix_config.hsv; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Breathing ESC +static bool breathing_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = rgb_matrix_config.hsv; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 18; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + rgb_matrix_set_color(0, rgb.r, rgb.g, rgb.b); + return led_max < DRIVER_LED_TOTAL; +} + +// Breathing F13 +static bool breathing_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = rgb_matrix_config.hsv; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 18; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + rgb_matrix_set_color(14, rgb.r, rgb.g, rgb.b); + return led_max < DRIVER_LED_TOTAL; +} + +// Breathing cluster +static bool breathing_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + HSV hsv = rgb_matrix_config.hsv; + uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); + hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + for (uint8_t i = 15; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Band Val all +bool band_val_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_all(params, &BAND_VAL_CUSTOM); +} + +// Band Val ESC +bool band_val_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_esc(params, &BAND_VAL_CUSTOM); +} + +// Band Val F13 +bool band_val_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_f13(params, &BAND_VAL_CUSTOM); +} + +// Band Val Cluster +bool band_val_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_clus(params, &BAND_VAL_CUSTOM); +} + +// Cycle Up Down All +static bool cycle_up_down_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_all(params, &CYCLE_UP_DOWN_CUSTOM); +} + +// Cycle Up Down ESC +static bool cycle_up_down_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_esc(params, &CYCLE_UP_DOWN_CUSTOM); +} + +// Cycle up down F13 +static bool cycle_up_down_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_f13(params, &CYCLE_UP_DOWN_CUSTOM); +} + +// Cycle up down cluster +static bool cycle_up_down_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_clus(params, &CYCLE_UP_DOWN_CUSTOM); +} + +// Cycle out in dual All +static bool cycle_out_in_dual_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_all(params, &CYCLE_OUT_IN_DUAL_CUSTOM); +} + +// Cycle out in dual ESC +static bool cycle_out_in_dual_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_esc(params, &CYCLE_OUT_IN_DUAL_CUSTOM); +} + +// Cycle out in dual f13 +static bool cycle_out_in_dual_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_f13(params, &CYCLE_OUT_IN_DUAL_CUSTOM); +} + +// Cycle out in dual cluster +static bool cycle_out_in_dual_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_clus(params, &CYCLE_OUT_IN_DUAL_CUSTOM); +} + +// Moving chevron all +static bool rainbow_moving_chevron_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_all(params, &RAINBOW_MOVING_CHEVRON_CUSTOM); +} + +// Moving chevron ESC +static bool rainbow_moving_chevron_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_esc(params, &RAINBOW_MOVING_CHEVRON_CUSTOM); +} +// Moving chevron F13 +static bool rainbow_moving_chevron_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_f13(params, &RAINBOW_MOVING_CHEVRON_CUSTOM); +} +// Moving chevron cluster +static bool rainbow_moving_chevron_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_clus(params, &RAINBOW_MOVING_CHEVRON_CUSTOM); +} + +// Moving cycle pimwheel all +static bool cycle_pimwheel_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_all(params, &CYCLE_PINWHEEL_CUSTOM); +} + +// Moving cycle pimwheel esc +static bool cycle_pimwheel_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_esc(params, &CYCLE_PINWHEEL_CUSTOM); +} + +// Moving cycle pimwheel f13 +static bool cycle_pimwheel_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_f13(params, &CYCLE_PINWHEEL_CUSTOM); +} + +// Moving cycle pimwheel cluster +static bool cycle_pimwheel_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_dx_dy_clus(params, &CYCLE_PINWHEEL_CUSTOM); +} + +// Moving rainbow beacon all +static bool rainbow_beacon_all(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_sin_cos_all(params, &RAINBOW_BEACON_CUSTOM); +} + +// Moving rainbow beacon esc +static bool rainbow_beacon_esc(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_sin_cos_esc(params, &RAINBOW_BEACON_CUSTOM); +} + +// Moving rainbow beacon f13 +static bool rainbow_beacon_f13(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_sin_cos_f13(params, &RAINBOW_BEACON_CUSTOM); +} + +// Moving rainbow beacon cluster +static bool rainbow_beacon_clus(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min ; i < led_max; i++) { + rgb_matrix_set_color(i, 0x00, 0x00, 0x00); + } + return effect_runner_sin_cos_clus(params, &RAINBOW_BEACON_CUSTOM); +} + +// Raindrops all +static bool raindrops_all(effect_params_t* params) { + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { + raindrops_set_color_all(rand() % DRIVER_LED_TOTAL, params); + } + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (int i = led_min; i < led_max; i++) { + raindrops_set_color_all(i, params); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Raindrops ESC +static bool raindrops_esc(effect_params_t* params) { + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { + raindrops_set_color_esc(rand() % DRIVER_LED_TOTAL, params); + } + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (int i = led_min; i < led_max; i++) { + raindrops_set_color_esc(i, params); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Raindrops F13 +static bool raindrops_f13(effect_params_t* params) { + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { + raindrops_set_color_f13(rand() % DRIVER_LED_TOTAL, params); + } + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (int i = led_min; i < led_max; i++) { + raindrops_set_color_f13(i, params); + } + return led_max < DRIVER_LED_TOTAL; +} + +// Raindrops Cluster +static bool raindrops_clus(effect_params_t* params) { + if (!params->init) { + // Change one LED every tick, make sure speed is not 0 + if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) { + raindrops_set_color_clus(rand() % DRIVER_LED_TOTAL, params); + } + return false; + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (int i = led_min; i < led_max; i++) { + raindrops_set_color_clus(i, params); + } + return led_max < DRIVER_LED_TOTAL; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/mechlovin/infinity875/keymaps/via/rules.mk b/keyboards/mechlovin/infinity875/keymaps/via/rules.mk new file mode 100644 index 0000000000..0e604ef69a --- /dev/null +++ b/keyboards/mechlovin/infinity875/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +RGB_MATRIX_CUSTOM_USER = yes
\ No newline at end of file |