diff --git a/keyboards/crkbd/info.json b/keyboards/crkbd/info.json index 5a8e0c109f..575b06053b 100644 --- a/keyboards/crkbd/info.json +++ b/keyboards/crkbd/info.json @@ -25,8 +25,64 @@ }, "diode_direction": "COL2ROW", "split": { - "enabled": true + "enabled": true, + "soft_serial_pin": "D2" }, "processor": "atmega32u4", - "community_layouts": [ "split_3x5_3", "split_3x6_3" ] + "development_board": "promicro", + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0.3}, + {"matrix": [0, 1], "x": 1, "y": 0.3}, + {"matrix": [0, 2], "x": 2, "y": 0.1}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0.1}, + {"matrix": [0, 5], "x": 5, "y": 0.2}, + + {"matrix": [4, 5], "x": 9, "y": 0.2}, + {"matrix": [4, 4], "x": 10, "y": 0.1}, + {"matrix": [4, 3], "x": 11, "y": 0}, + {"matrix": [4, 2], "x": 12, "y": 0.1}, + {"matrix": [4, 1], "x": 13, "y": 0.3}, + {"matrix": [4, 0], "x": 14, "y": 0.3}, + + {"matrix": [1, 0], "x": 0, "y": 1.3}, + {"matrix": [1, 1], "x": 1, "y": 1.3}, + {"matrix": [1, 2], "x": 2, "y": 1.1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1.1}, + {"matrix": [1, 5], "x": 5, "y": 1.2}, + + {"matrix": [5, 5], "x": 9, "y": 1.2}, + {"matrix": [5, 4], "x": 10, "y": 1.1}, + {"matrix": [5, 3], "x": 11, "y": 1}, + {"matrix": [5, 2], "x": 12, "y": 1.1}, + {"matrix": [5, 1], "x": 13, "y": 1.3}, + {"matrix": [5, 0], "x": 14, "y": 1.3}, + + {"matrix": [2, 0], "x": 0, "y": 2.3}, + {"matrix": [2, 1], "x": 1, "y": 2.3}, + {"matrix": [2, 2], "x": 2, "y": 2.1}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2.1}, + {"matrix": [2, 5], "x": 5, "y": 2.2}, + + {"matrix": [6, 5], "x": 9, "y": 2.2}, + {"matrix": [6, 4], "x": 10, "y": 2.1}, + {"matrix": [6, 3], "x": 11, "y": 2}, + {"matrix": [6, 2], "x": 12, "y": 2.1}, + {"matrix": [6, 1], "x": 13, "y": 2.3}, + {"matrix": [6, 0], "x": 14, "y": 2.3}, + + {"matrix": [3, 3], "x": 4, "y": 3.7}, + {"matrix": [3, 4], "x": 5, "y": 3.7}, + {"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5}, + + {"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5}, + {"matrix": [7, 4], "x": 9, "y": 3.7}, + {"matrix": [7, 3], "x": 10, "y": 3.7} + ] + } + } } diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h index 9d4be81fa3..dff054388a 100644 --- a/keyboards/crkbd/keymaps/default/config.h +++ b/keyboards/crkbd/keymaps/default/config.h @@ -30,20 +30,3 @@ along with this program. If not, see . //#define QUICK_TAP_TERM 0 //#define TAPPING_TERM 100 - -#ifdef RGBLIGHT_ENABLE - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_RAINBOW_MOOD - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - #define RGBLIGHT_EFFECT_SNAKE - #define RGBLIGHT_EFFECT_KNIGHT - #define RGBLIGHT_EFFECT_CHRISTMAS - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - #define RGBLIGHT_EFFECT_RGB_TEST - #define RGBLIGHT_EFFECT_ALTERNATING - #define RGBLIGHT_EFFECT_TWINKLE - #define RGBLIGHT_LIMIT_VAL 120 - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 -#endif diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c index e46743af6b..84d7b33f49 100644 --- a/keyboards/crkbd/keymaps/default/keymap.c +++ b/keyboards/crkbd/keymaps/default/keymap.c @@ -19,7 +19,7 @@ along with this program. If not, see . #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_split_3x6_3( + [0] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -32,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), - [1] = LAYOUT_split_3x6_3( + [1] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -44,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //`--------------------------' `--------------------------' ), - [2] = LAYOUT_split_3x6_3( + [2] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| @@ -56,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //`--------------------------' `--------------------------' ), - [3] = LAYOUT_split_3x6_3( + [3] = LAYOUT( //,-----------------------------------------------------. ,-----------------------------------------------------. - QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT //`--------------------------' `--------------------------' diff --git a/keyboards/crkbd/lib/rgb_state_reader.c b/keyboards/crkbd/lib/rgb_state_reader.c deleted file mode 100644 index a255cd662d..0000000000 --- a/keyboards/crkbd/lib/rgb_state_reader.c +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef RGBLIGHT_ENABLE - -#include -#include "quantum.h" - -extern rgblight_config_t rgblight_config; -char rbf_info_str[24]; -const char *read_rgb_info(void) { - - snprintf(rbf_info_str, sizeof(rbf_info_str), "%s %2d h%3d s%3d v%3d", - rgblight_config.enable ? "on" : "- ", rgblight_config.mode, - rgblight_config.hue, rgblight_config.sat, rgblight_config.val); - return rbf_info_str; -} -#endif diff --git a/keyboards/crkbd/post_config.h b/keyboards/crkbd/post_config.h index 133014b02a..f792a4377d 100644 --- a/keyboards/crkbd/post_config.h +++ b/keyboards/crkbd/post_config.h @@ -30,20 +30,6 @@ # define BOOTMAGIC_LITE_COLUMN_RIGHT 1 #endif -#ifdef RGBLIGHT_ENABLE -# ifndef RGBLIGHT_LIMIT_VAL -# define RGBLIGHT_LIMIT_VAL 120 -# endif -#endif - -#ifdef RGB_MATRIX_ENABLE -# ifndef RGB_MATRIX_MAXIMUM_BRIGHTNESS -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 -# endif -#endif - -#ifdef OLED_ENABLE - #ifndef OLED_FONT_H - #define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" - #endif +#ifndef OLED_FONT_H +# define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" #endif diff --git a/keyboards/crkbd/readme.md b/keyboards/crkbd/readme.md index 75267463b2..e101868b32 100644 --- a/keyboards/crkbd/readme.md +++ b/keyboards/crkbd/readme.md @@ -25,85 +25,3 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to The Corne PCBs have a reset button next to the TRRS jack to enter in to the bootloader. Additionally, if you hold down the "Q" or "P" buttons when plugging in that half of the keyboard (per the default QWERTY layout), this will jump to the bootloader and reset the EEPROM (persistent storage). This would normally be the very top corner-most position, but due to the breakaway column, it's left at Q and P for compatibility. - -## RGB Matrix -The Corne Keyboard also supports using the RGB Matrix feature, in place of RGB Light. This provides a better experience when using the keyboard, as it supports a number of per key effects properly. If you're not using the in switch LEDs, then you may want to pass on doing this. - -In your keymap's `rules.mk` file, add the following: - -```make -RGBLIGHT_ENABLE = no -RGB_MATRIX_ENABLE = yes -``` - -And in your `config.h` file, add the following: - -```c - -#ifdef RGB_MATRIX_ENABLE -# define RGB_MATRIX_KEYPRESSES // reacts to keypresses -// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) -# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS -// # define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) -// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. -# define RGB_MATRIX_HUE_STEP 8 -# define RGB_MATRIX_SAT_STEP 8 -# define RGB_MATRIX_VAL_STEP 8 -# define RGB_MATRIX_SPD_STEP 10 - -/* Enable the animations you want/need. You may need to enable only a small number of these because * - * they take up a lot of space. Enable and confirm that you can still successfully compile your firmware. */ -// RGB Matrix Animation modes. Explicitly enabled -// For full list of effects, see: -// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects -# define ENABLE_RGB_MATRIX_ALPHAS_MODS -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_PIXEL_RAIN -# define ENABLE_RGB_MATRIX_PIXEL_FLOW -# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# define ENABLE_RGB_MATRIX_SPLASH -# define ENABLE_RGB_MATRIX_MULTISPLASH -# define ENABLE_RGB_MATRIX_SOLID_SPLASH -# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -#endif -``` - -After this is done, you should be able to use the normal RGB keycodes, but you'll see the RGB Matrix effects in use, giving a much better experience. diff --git a/keyboards/crkbd/rev1/config.h b/keyboards/crkbd/rev1/config.h deleted file mode 100644 index 60a49100e3..0000000000 --- a/keyboards/crkbd/rev1/config.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2019 @foostan -Copyright 2020 Drashna Jaelre <@drashna> - -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 . -*/ - -#pragma once - -#ifdef RGB_MATRIX_ENABLE -# define RGB_MATRIX_LED_COUNT 54 -# define RGB_MATRIX_SPLIT \ - { 27, 27 } -# define SPLIT_TRANSPORT_MIRROR -#endif diff --git a/keyboards/crkbd/rev1/info.json b/keyboards/crkbd/rev1/info.json deleted file mode 100644 index 27efd3a73d..0000000000 --- a/keyboards/crkbd/rev1/info.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "features": { - "rgblight": true - }, - "split": { - "soft_serial_pin": "D2" - }, - "rgblight": { - "led_count": 54, - "split_count": [27, 27] - }, - "ws2812": { - "pin": "D3" - }, - "development_board": "promicro", - "layout_aliases": { - "LAYOUT": "LAYOUT_split_3x6_3" - }, - "layouts": { - "LAYOUT_split_3x5_3": { - "layout": [ - {"matrix": [0, 1], "x": 0, "y": 0.3}, - {"matrix": [0, 2], "x": 1, "y": 0.1}, - {"matrix": [0, 3], "x": 2, "y": 0}, - {"matrix": [0, 4], "x": 3, "y": 0.1}, - {"matrix": [0, 5], "x": 4, "y": 0.2}, - - {"matrix": [4, 5], "x": 8, "y": 0.2}, - {"matrix": [4, 4], "x": 9, "y": 0.1}, - {"matrix": [4, 3], "x": 10, "y": 0}, - {"matrix": [4, 2], "x": 11, "y": 0.1}, - {"matrix": [4, 1], "x": 12, "y": 0.3}, - - {"matrix": [1, 1], "x": 0, "y": 1.3}, - {"matrix": [1, 2], "x": 1, "y": 1.1}, - {"matrix": [1, 3], "x": 2, "y": 1}, - {"matrix": [1, 4], "x": 3, "y": 1.1}, - {"matrix": [1, 5], "x": 4, "y": 1.2}, - - {"matrix": [5, 5], "x": 8, "y": 1.2}, - {"matrix": [5, 4], "x": 9, "y": 1.1}, - {"matrix": [5, 3], "x": 10, "y": 1}, - {"matrix": [5, 2], "x": 11, "y": 1.1}, - {"matrix": [5, 1], "x": 12, "y": 1.3}, - - {"matrix": [2, 1], "x": 0, "y": 2.3}, - {"matrix": [2, 2], "x": 1, "y": 2.1}, - {"matrix": [2, 3], "x": 2, "y": 2}, - {"matrix": [2, 4], "x": 3, "y": 2.1}, - {"matrix": [2, 5], "x": 4, "y": 2.2}, - - {"matrix": [6, 5], "x": 8, "y": 2.2}, - {"matrix": [6, 4], "x": 9, "y": 2.1}, - {"matrix": [6, 3], "x": 10, "y": 2}, - {"matrix": [6, 2], "x": 11, "y": 2.1}, - {"matrix": [6, 1], "x": 12, "y": 2.3}, - - {"matrix": [3, 3], "x": 3, "y": 3.7}, - {"matrix": [3, 4], "x": 4, "y": 3.7}, - {"matrix": [3, 5], "x": 5, "y": 3.2, "h": 1.5}, - - {"matrix": [7, 5], "x": 7, "y": 3.2, "h": 1.5}, - {"matrix": [7, 4], "x": 8, "y": 3.7}, - {"matrix": [7, 3], "x": 9, "y": 3.7} - ] - }, - "LAYOUT_split_3x6_3": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0.3}, - {"matrix": [0, 1], "x": 1, "y": 0.3}, - {"matrix": [0, 2], "x": 2, "y": 0.1}, - {"matrix": [0, 3], "x": 3, "y": 0}, - {"matrix": [0, 4], "x": 4, "y": 0.1}, - {"matrix": [0, 5], "x": 5, "y": 0.2}, - - {"matrix": [4, 5], "x": 9, "y": 0.2}, - {"matrix": [4, 4], "x": 10, "y": 0.1}, - {"matrix": [4, 3], "x": 11, "y": 0}, - {"matrix": [4, 2], "x": 12, "y": 0.1}, - {"matrix": [4, 1], "x": 13, "y": 0.3}, - {"matrix": [4, 0], "x": 14, "y": 0.3}, - - {"matrix": [1, 0], "x": 0, "y": 1.3}, - {"matrix": [1, 1], "x": 1, "y": 1.3}, - {"matrix": [1, 2], "x": 2, "y": 1.1}, - {"matrix": [1, 3], "x": 3, "y": 1}, - {"matrix": [1, 4], "x": 4, "y": 1.1}, - {"matrix": [1, 5], "x": 5, "y": 1.2}, - - {"matrix": [5, 5], "x": 9, "y": 1.2}, - {"matrix": [5, 4], "x": 10, "y": 1.1}, - {"matrix": [5, 3], "x": 11, "y": 1}, - {"matrix": [5, 2], "x": 12, "y": 1.1}, - {"matrix": [5, 1], "x": 13, "y": 1.3}, - {"matrix": [5, 0], "x": 14, "y": 1.3}, - - {"matrix": [2, 0], "x": 0, "y": 2.3}, - {"matrix": [2, 1], "x": 1, "y": 2.3}, - {"matrix": [2, 2], "x": 2, "y": 2.1}, - {"matrix": [2, 3], "x": 3, "y": 2}, - {"matrix": [2, 4], "x": 4, "y": 2.1}, - {"matrix": [2, 5], "x": 5, "y": 2.2}, - - {"matrix": [6, 5], "x": 9, "y": 2.2}, - {"matrix": [6, 4], "x": 10, "y": 2.1}, - {"matrix": [6, 3], "x": 11, "y": 2}, - {"matrix": [6, 2], "x": 12, "y": 2.1}, - {"matrix": [6, 1], "x": 13, "y": 2.3}, - {"matrix": [6, 0], "x": 14, "y": 2.3}, - - {"matrix": [3, 3], "x": 4, "y": 3.7}, - {"matrix": [3, 4], "x": 5, "y": 3.7}, - {"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5}, - - {"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5}, - {"matrix": [7, 4], "x": 9, "y": 3.7}, - {"matrix": [7, 3], "x": 10, "y": 3.7} - ] - } - } -} diff --git a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/config.h b/keyboards/crkbd/rev1/keymaps/dvorak_42_key/config.h deleted file mode 100644 index fcf6befb16..0000000000 --- a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/config.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022 LucW (@luc-languagetools) -// SPDX-License-Identifier: GPL-2.0-or-later - - -#pragma once - - -/* Select hand configuration */ - -// #define MASTER_LEFT -#define MASTER_RIGHT -// #define EE_HANDS - -//#define QUICK_TAP_TERM 0 -//#define TAPPING_TERM 100 - -// #define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD -#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD - -// MOUSE SETTINGS -// ============== - -#define MOUSEKEY_TIME_TO_MAX 200 - -#define RGBLIGHT_LAYERS - -#ifdef RGBLIGHT_ENABLE - #define RGBLIGHT_LIMIT_VAL 90 - // #define RGBLIGHT_LIMIT_VAL 0 - #define RGBLIGHT_HUE_STEP 10 - #define RGBLIGHT_SAT_STEP 17 - #define RGBLIGHT_VAL_STEP 17 -#endif - -#ifdef RGB_MATRIX_ENABLE - // #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON - // #define RGB_MATRIX_KEYPRESSES // reacts to keypresses - // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE - // #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE - // #define ENABLE_RGB_MATRIX_SPLASH - //#define ENABLE_RGB_MATRIX_SOLID_SPLASH -#endif - -#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" diff --git a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/keymap.c b/keyboards/crkbd/rev1/keymaps/dvorak_42_key/keymap.c deleted file mode 100644 index 43bbd9a617..0000000000 --- a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/keymap.c +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright 2022 LucW (@luc-languagetools) -// SPDX-License-Identifier: GPL-2.0-or-later - - -#include QMK_KEYBOARD_H -#include -#include "dvorak_42_key.h" - -// to build: qmk compile -kb crkbd/rev1 -km dvorak_42_key - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [BASE] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. - OSL(VSCODE), KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_TAB, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -OSL(SHELL_NAV), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, TD(TD_DEL_WORD_DEL), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -OSM(MOD_LSFT),KC_SEMICOLON, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, OSM(MOD_LSFT), - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - MO(BROWSER_CONTROL), MO(COMBINED),MO(KEYNAV), KC_ENTER, KC_SPACE, OSL(SHORTCUTS) - //`--------------------------' `--------------------------' - - ), - - [KEYNAV] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. -KC_ESC, RCTL(KC_ENTER), RCTL(KC_K), RCTL(KC_Z), RCTL(KC_S), RCTL(KC_N), KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_DELETE, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, MO(KEYSEL), KC_TRNS, RSFT(KC_TAB), KC_TAB, RCTL(KC_F), LCTL(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LCTL(KC_RIGHT), KC_BSPC, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, RCTL(KC_P), RCTL(KC_O), RCTL(KC_A), RCTL(KC_B), NP_DUPE_LINE, KC_TRNS, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), KC_PGDN, RCTL(KC_DELETE), - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - //`--------------------------' `--------------------------' - ), - - - [KEYSEL] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RSFT(KC_HOME), RSFT(KC_UP), RSFT(KC_END), RSFT(KC_PGUP), KC_TRNS, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RSFT(RCTL(KC_LEFT)), RSFT(KC_LEFT), RSFT(KC_DOWN), RSFT(KC_RIGHT), RSFT(RCTL(KC_RIGHT)), KC_TRNS, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), RSFT(KC_PGDN), KC_TRNS, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - //`--------------------------' `--------------------------' - ), - - - [SHELL_NAV] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. -TO(BASE),SHELL_GIT_DIFF, SHELL_PGREP, SHELL_PLESS, SHELL_LESS, KC_TRNS, RCTL(KC_D), KC_HOME, KC_UP, KC_END, RCTL(KC_L), RCTL(KC_X), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -OSL(SHELL_SCREEN),SHELL_GIT_STATUS,SHELL_CDPRE,SHELL_LSLTR,SHELL_LS, SHELL_LSLA, LALT(KC_B), KC_LEFT, KC_DOWN, KC_RIGHT, LALT(KC_F), RCTL(KC_W), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS,SHELL_SCREEN_LIST, SHELL_SCREENRD, SHELL_SCREEN_NEW, SHELL_TAILF, KC_TRNS, RCTL(KC_U), LALT(KC_DOT), RCTL(KC_R), KC_BTN2, RCTL(KC_K), RCTL(KC_C), - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, LCTL(LSFT(KC_V)), KC_TRNS, KC_TRNS - //`--------------------------' `--------------------------' - ), - - [SHELL_SCREEN] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. -TO(BASE),KC_TRNS, SCREEN_READREG_3, SCREEN_READREG_2, SCREEN_READREG_1,KC_TRNS, KC_TRNS, SCREEN_7, SCREEN_8, SCREEN_9, SCREEN_RENAME, KC_TRNS, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -TO(BASE),KC_TRNS,SCREEN_PASTEREG_3,SCREEN_PASTEREG_2,SCREEN_PASTEREG_1,SCREEN_DETACH, SCREEN_TAB_LEFT, SCREEN_4, SCREEN_5, SCREEN_6, SCREEN_TAB_RIGHT, SCREEN_COPY_MODE, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, SCREEN_1, SCREEN_2, SCREEN_3, SCREEN_NUMBER, SCREEN_PASTE, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, SCREEN_KILL, SCREEN_NEW_TAB, SCREEN_0 - //`--------------------------' `--------------------------' - ), - - [VSCODE] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. -TO(BASE), KC_TRNS, VS_FIND_FILES, VS_CMT_BLOCK, VS_CMT_LINE, VS_BM_LISTALL, VS_COPYLINEDOWN, VS_REFERENCES, VS_DEFINITION, VS_IMPLEMENTATION, VS_LINE, VS_BRACKET, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, KC_TRNS, VS_TOGGLE_TERMINAL, VS_FOCUS_TERMINAL, VS_FOCUS_EDITOR, VS_BM_LIST, VS_CLOSETAB, VS_TABLEFT, VS_TABRIGHT, VS_SYMBOLEDITOR, VS_FILE, VS_BACK, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, VS_BM_CLEARALL, VS_JUMPY, VS_BM_PREV, VS_BM_NEXT, VS_GROUP_1, VS_GROUP_2, VS_BM_TOGGLE, -//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, VS_DEL_LEFT, VS_DEL_RIGHT, VS_DEL_LINE, VS_JUMPY, VS_COMMANDS - //`--------------------------' `--------------------------' - ), - - [COMBINED] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_PLUS, KC_7, KC_8, KC_9, KC_ASTR, KC_PIPE, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_GRAVE, KC_LPRN, KC_RPRN, KC_LBRC, KC_RBRC, KC_UNDS, KC_MINUS, KC_4, KC_5, KC_6, KC_SLSH, KC_BSLS, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_CIRC, KC_COLN, KC_DQUO, KC_LCBR, KC_RCBR, KC_AMPR, KC_EQUAL, KC_1, KC_2, KC_3, KC_QUES, KC_DOT, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0 - //`--------------------------' `--------------------------' - ), - - // chrome OS keyboard shortcuts: https://support.google.com/chromebook/answer/183101?hl=en - // search key == windows key - [BROWSER_CONTROL] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. -KC_TRNS, KC_TRNS, KC_BTN3, KC_MS_U, KC_BTN1, KC_BTN2, KC_UP, KC_PGUP, KC_PGDN, KC_MS_WH_UP, KC_TRNS, KC_TRNS, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - CO_WS_LEFT, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_DOWN, RCTL(KC_PGUP), RCTL(KC_PGDN), KC_MS_WH_DOWN, LALT(KC_LEFT), CO_WS_RIGHT, - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, RCTL(LSFT(KC_TAB)), RCTL(KC_TAB), WINDOWS10_WORKSPACE_LEFT, WINDOWS10_WORKSPACE_RIGHT, WINDOWS10_TASK_VIEW, KC_TRNS, RCTL(KC_1), RCTL(KC_9), LCTL(KC_L), KC_F5, KC_TRNS, - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, RCTL(KC_W), RCTL(KC_T), KC_TRNS - //`--------------------------' `--------------------------' - ), - - - [SHORTCUTS] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, MEH(KC_F1), MEH(KC_F2), MEH(KC_F3), MEH(KC_F4), MEH(KC_F5), MEH(KC_F6), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, MEH(KC_F7), MEH(KC_F8), MEH(KC_F9), MEH(KC_F10), MEH(KC_F11), MEH(KC_F12), - //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| -KC_TRNS, OSM(MOD_LSFT), OSM(MOD_LGUI), OSM(MOD_LALT), OSM(MOD_LCTL), KC_TRNS, MEH(KC_F13), MEH(KC_F14), MEH(KC_F15), MEH(KC_F16), MEH(KC_F17), MEH(KC_F18), - //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(SHORTCUTS), TO(BASE) - //`--------------------------' `--------------------------' - ), - - /* - // empty layer - [15] = LAYOUT_split_3x6_3( - //,-----------------------------------------------------. ,-----------------------------------------------------. - 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 - //`--------------------------' `--------------------------' - ), - */ - - -}; - -#ifdef OLED_ENABLE -oled_rotation_t oled_init_user(oled_rotation_t rotation) { - if (!is_keyboard_master()) { - return OLED_ROTATION_180; // flips the display 180 degrees if offhand - } - // return rotation; - return OLED_ROTATION_180; -} - - -#define DISPLAY_LAYER_NAME(LAYER_NAME, LAYER_STRING) \ - if(get_highest_layer(layer_state) == LAYER_NAME) { \ - oled_write_ln_P(PSTR(LAYER_STRING), false); \ - return;\ - }\ - - -void oled_render_layer_state(void) { - // if caps word is enabled, show - if(is_caps_word_on()) { - oled_write_ln_P(PSTR("CAPS WORD"), false); - return; - } - DISPLAY_LAYER_NAME(SHORTCUTS, "SHORTCUTS"); - DISPLAY_LAYER_NAME(VSCODE, "VSCODE"); - DISPLAY_LAYER_NAME(COMBINED, "SYMBOLS"); - DISPLAY_LAYER_NAME(BROWSER_CONTROL, "BROWSER"); - DISPLAY_LAYER_NAME(SHELL_SCREEN, "SHELL SCREEN"); - DISPLAY_LAYER_NAME(SHELL_NAV, "SHELL NAV"); - DISPLAY_LAYER_NAME(KEYSEL, "KEYSEL"); - DISPLAY_LAYER_NAME(KEYNAV, "KEYNAV"); - DISPLAY_LAYER_NAME(BASE, "BASE"); - -} - -const rgblight_segment_t PROGMEM rgb_layer_off[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 0, 0} -); - -const rgblight_segment_t PROGMEM rgb_layer_blue[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_BLUE} -); - -const rgblight_segment_t PROGMEM rgb_layer_purple[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_PURPLE} -); - -const rgblight_segment_t PROGMEM rgb_layer_red[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_RED} -); - -const rgblight_segment_t PROGMEM rgb_layer_orange[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_ORANGE} -); - -const rgblight_segment_t PROGMEM rgb_layer_yellow[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_YELLOW} -); - -const rgblight_segment_t PROGMEM rgb_layer_green[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_GREEN} -); - -const rgblight_segment_t PROGMEM rgb_layer_pink[] = RGBLIGHT_LAYER_SEGMENTS( - {0, RGBLED_NUM, HSV_PINK} -); - - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - rgb_layer_off, - rgb_layer_blue, - rgb_layer_purple, - rgb_layer_red, - rgb_layer_orange, - rgb_layer_yellow, - rgb_layer_green, - rgb_layer_pink -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(0, layer_state_cmp(state, BASE)); - return state; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - - - rgblight_set_layer_state(1, layer_state_cmp(state, KEYNAV)); - rgblight_set_layer_state(2, layer_state_cmp(state, KEYSEL)); - - - rgblight_set_layer_state(3, layer_state_cmp(state, SHELL_NAV)); - rgblight_set_layer_state(4, layer_state_cmp(state, SHELL_SCREEN)); - - rgblight_set_layer_state(5, layer_state_cmp(state, SHORTCUTS)); - - rgblight_set_layer_state(6, layer_state_cmp(state, VSCODE)); - - return state; -} - -void caps_word_set_user(bool active) { - // will enable/disable rgb layer 7 based on whether caps word is active - rgblight_set_layer_state(7, active); -} - -void render_bootmagic_status(bool status) { - /* Show Ctrl-Gui Swap options */ - static const char PROGMEM logo[][2][3] = { - {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, - {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, - }; - if (status) { - oled_write_ln_P(logo[0][0], false); - oled_write_ln_P(logo[0][1], false); - } else { - oled_write_ln_P(logo[1][0], false); - oled_write_ln_P(logo[1][1], false); - } -} - -void oled_render_logo(void) { - static const char PROGMEM crkbd_logo[] = { - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, - 0}; - oled_write_P(crkbd_logo, false); -} - -bool oled_task_user(void) { - if (is_keyboard_master( )) { - oled_render_layer_state(); - } else { - oled_render_logo(); - } - return false; -} - -#endif // OLED_ENABLE diff --git a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/rules.mk b/keyboards/crkbd/rev1/keymaps/dvorak_42_key/rules.mk deleted file mode 100644 index 9fe565335a..0000000000 --- a/keyboards/crkbd/rev1/keymaps/dvorak_42_key/rules.mk +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright 2022 LucW (@luc-languagetools) -# SPDX-License-Identifier: GPL-2.0-or-later - -MOUSEKEY_ENABLE = yes # Mouse keys -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -# RGB_MATRIX_ENABLE = no -OLED_ENABLE = yes -LTO_ENABLE = yes diff --git a/keyboards/crkbd/rev1/rules.mk b/keyboards/crkbd/rev1/rules.mk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/keyboards/crkbd/rules.mk b/keyboards/crkbd/rules.mk index a63f102097..e69de29bb2 100644 --- a/keyboards/crkbd/rules.mk +++ b/keyboards/crkbd/rules.mk @@ -1,8 +0,0 @@ -# Build Options -# change yes to no to disable -# - -DEFAULT_FOLDER = crkbd/rev1 - -RGBLIGHT_SUPPORTED = yes -RGB_MATRIX_SUPPORTED = yes diff --git a/layouts/community/split_3x5_2/manna-harbour_miryoku/config.h b/layouts/community/split_3x5_2/manna-harbour_miryoku/config.h deleted file mode 100644 index c9f1117a6f..0000000000 --- a/layouts/community/split_3x5_2/manna-harbour_miryoku/config.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Manna Harbour -// https://github.com/manna-harbour/miryoku - -// 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 . - -#pragma once - -#define LAYOUT_miryoku( \ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, \ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, \ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, \ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_split_3x5_2( \ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, \ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, \ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, \ - K33, K34, K35, K36 \ -) diff --git a/layouts/community/split_3x5_2/manna-harbour_miryoku/keymap.c b/layouts/community/split_3x5_2/manna-harbour_miryoku/keymap.c deleted file mode 100644 index dbab7f9820..0000000000 --- a/layouts/community/split_3x5_2/manna-harbour_miryoku/keymap.c +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2019 Manna Harbour -// https://github.com/manna-harbour/miryoku - -// 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 . diff --git a/layouts/community/split_3x5_2/manna-harbour_miryoku/rules.mk b/layouts/community/split_3x5_2/manna-harbour_miryoku/rules.mk deleted file mode 100644 index ef40279cbc..0000000000 --- a/layouts/community/split_3x5_2/manna-harbour_miryoku/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2021 Manna Harbour -# https://github.com/manna-harbour/miryoku - -MIRYOKU_KLUDGE_THUMBCOMBOS=yes diff --git a/layouts/community/split_3x5_2/scotto/keymap.c b/layouts/community/split_3x5_2/scotto/keymap.c deleted file mode 100644 index fcba0f483b..0000000000 --- a/layouts/community/split_3x5_2/scotto/keymap.c +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 2023 Joe Scotto - -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 . -*/ - -#include QMK_KEYBOARD_H -#include "scotto.h" - -#define LAYOUT_split_3x5_2_wrapper(...) LAYOUT_split_3x5_2(__VA_ARGS__) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_split_3x5_2_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3a_________________, - _______THUMB4_1_______ - ), - [1] = LAYOUT_split_3x5_2_wrapper( - ______________SYM_MEDIA_NAV1______________, - ______________SYM_MEDIA_NAV2______________, - ______________SYM_MEDIA_NAV3______________, - _____THUMB4_TRNS______ - ), - [2] = LAYOUT_split_3x5_2_wrapper( - _________________NUM_SYM1_________________, - _________________NUM_SYM2_________________, - _________________NUM_SYM3a________________, - _____THUMB4_TRNS______ - ), - [3] = LAYOUT_split_3x5_2_wrapper( - ________________FUNC_SYS1a________________, - ________________FUNC_SYS2_________________, - ________________FUNC_SYS3_________________, - _____THUMB4_TRNS______ - ), - [4] = LAYOUT_split_3x5_2_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3a_________________, - _______THUMB4_4_______ - ), - [5] = LAYOUT_split_3x5_2_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3b_________________, - _______THUMB4_5_______ - ), - [6] = LAYOUT_split_3x5_2_wrapper( - ______________SYM_MEDIA_NAV1______________, - ______________SYM_MEDIA_NAV2______________, - ______________SYM_MEDIA_NAV3______________, - _____THUMB4_TRNS______ - ), - [7] = LAYOUT_split_3x5_2_wrapper( - _________________NUM_SYM1_________________, - _________________NUM_SYM2_________________, - _________________NUM_SYM3b________________, - _____THUMB4_TRNS______ - ), - [8] = LAYOUT_split_3x5_2_wrapper( - ________________FUNC_SYS1b________________, - ________________FUNC_SYS2_________________, - ________________FUNC_SYS3_________________, - _____THUMB4_TRNS______ - ) -}; diff --git a/layouts/community/split_3x5_3/manna-harbour_miryoku/config.h b/layouts/community/split_3x5_3/manna-harbour_miryoku/config.h deleted file mode 100644 index 3f55144b41..0000000000 --- a/layouts/community/split_3x5_3/manna-harbour_miryoku/config.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2019 Manna Harbour -// https://github.com/manna-harbour/miryoku - -// 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 . - -#pragma once - -#define LAYOUT_miryoku(\ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_split_3x5_3(\ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ - K32, K33, K34, K35, K36, K37\ -) diff --git a/layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c b/layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c deleted file mode 100644 index dbab7f9820..0000000000 --- a/layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2019 Manna Harbour -// https://github.com/manna-harbour/miryoku - -// 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 . diff --git a/layouts/community/split_3x5_3/scotto/keymap.c b/layouts/community/split_3x5_3/scotto/keymap.c deleted file mode 100644 index b0d4d9a038..0000000000 --- a/layouts/community/split_3x5_3/scotto/keymap.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2023 Joe Scotto -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 . -*/ - -#include QMK_KEYBOARD_H -#include "scotto.h" - -#define LAYOUT_split_3x5_3_wrapper(...) LAYOUT_split_3x5_3(__VA_ARGS__) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_split_3x5_3_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3a_________________, - _______THUMB6_1_______ - ), - [1] = LAYOUT_split_3x5_3_wrapper( - ______________SYM_MEDIA_NAV1______________, - ______________SYM_MEDIA_NAV2______________, - ______________SYM_MEDIA_NAV3______________, - _____THUMB6_TRNS______ - ), - [2] = LAYOUT_split_3x5_3_wrapper( - _________________NUM_SYM1_________________, - _________________NUM_SYM2_________________, - _________________NUM_SYM3a________________, - _____THUMB6_TRNS______ - ), - [3] = LAYOUT_split_3x5_3_wrapper( - ________________FUNC_SYS1a________________, - ________________FUNC_SYS2_________________, - ________________FUNC_SYS3_________________, - _____THUMB6_TRNS______ - ), - [4] = LAYOUT_split_3x5_3_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3a_________________, - _______THUMB6_4_______ - ), - [5] = LAYOUT_split_3x5_3_wrapper( - _________________KEYMAP1__________________, - _________________KEYMAP2__________________, - _________________KEYMAP3b_________________, - _______THUMB6_5_______ - ), - [6] = LAYOUT_split_3x5_3_wrapper( - ______________SYM_MEDIA_NAV1______________, - ______________SYM_MEDIA_NAV2______________, - ______________SYM_MEDIA_NAV3______________, - _____THUMB6_TRNS______ - ), - [7] = LAYOUT_split_3x5_3_wrapper( - _________________NUM_SYM1_________________, - _________________NUM_SYM2_________________, - _________________NUM_SYM3b________________, - _____THUMB6_TRNS______ - ), - [8] = LAYOUT_split_3x5_3_wrapper( - ________________FUNC_SYS1b________________, - ________________FUNC_SYS2_________________, - ________________FUNC_SYS3_________________, - _____THUMB6_TRNS______ - ) -}; diff --git a/layouts/community/split_3x6_3/bcat/config.h b/layouts/community/split_3x6_3/bcat/config.h deleted file mode 100644 index 556fb90d5f..0000000000 --- a/layouts/community/split_3x6_3/bcat/config.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2020 Jonathan Rascher - * - * 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 . - */ - -#pragma once - -#define BCAT_ORTHO_LAYERS - -#if defined(KEYBOARD_crkbd_rev1) -# define EE_HANDS - -# if defined(OLED_ENABLE) -# undef OLED_FONT_H -# define OLED_FONT_H "lib/glcdfont.c" -# endif -#endif diff --git a/layouts/community/split_3x6_3/bcat/keymap.c b/layouts/community/split_3x6_3/bcat/keymap.c deleted file mode 100644 index 535950da53..0000000000 --- a/layouts/community/split_3x6_3/bcat/keymap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2020 Jonathan Rascher - * - * 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 . - */ - -#include QMK_KEYBOARD_H - -#include "bcat.h" - -#if defined(OLED_ENABLE) -# include "bcat_oled.h" -#endif - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - // clang-format off - /* Default layer: http://www.keyboard-layout-editor.com/#/gists/08d9827d916662a9414f48805aa895a5 */ - [LAYER_DEFAULT] = LAYOUT_split_3x6_3( - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, LY_LWR, KC_SPC, KC_ENT, LY_RSE, KC_RALT - ), - /* Lower layer: http://www.keyboard-layout-editor.com/#/gists/c3fba5eaa2cd70fdfbdbc0f9e34d3bc0 */ - [LAYER_LOWER] = LAYOUT_split_3x6_3( - MC_ALTT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, - KY_CSPC, KY_ZMRST, KY_ZMOUT, KY_ZMIN, KC_WBAK, KC_WFWD, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_TILD, - _______, KC_APP, KC_PSCR, KC_SCRL, KC_PAUS, KC_LGUI, KC_BSLS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_GRV, - _______, _______, _______, _______, _______, _______ - ), - /* Raise layer: http://www.keyboard-layout-editor.com/#/gists/08b44355d4ca85d294bad9e2821f91d7 */ - [LAYER_RAISE] = LAYOUT_split_3x6_3( - KC_CAPS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_F11, KC_DEL, - _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_F12, KC_INS, - _______, _______, _______, _______, _______, _______ - ), - /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee */ - [LAYER_ADJUST] = LAYOUT_split_3x6_3( - _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, EE_CLR, QK_BOOT, _______, _______, _______, _______, - _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, RGB_RMOD, RGB_VAD, RGB_VAI, RGB_MOD, RGB_SPI, _______, - _______, _______, _______, KC_MUTE, _______, _______, RGB_HUI, RGB_SAD, RGB_SAI, RGB_HUD, RGB_SPD, _______, - _______, _______, _______, RGB_TOG, _______, _______ - ), - // clang-format on -}; - -#if defined(OLED_ENABLE) -oled_rotation_t oled_init_user(oled_rotation_t rotation) { return is_keyboard_master() ? OLED_ROTATION_270 : OLED_ROTATION_180; } - -void oled_task_keymap(const oled_keyboard_state_t *keyboard_state) { - render_oled_layers(); - oled_advance_page(/*clearPageRemainder=*/false); - render_oled_indicators(keyboard_state->leds); - oled_advance_page(/*clearPageRemainder=*/false); - oled_advance_page(/*clearPageRemainder=*/false); - render_oled_wpm(keyboard_state->wpm); - render_oled_pet(/*col=*/0, /*line=*/12, keyboard_state); -} -#endif diff --git a/layouts/community/split_3x6_3/bcat/readme.md b/layouts/community/split_3x6_3/bcat/readme.md deleted file mode 100644 index b7b5d3de7d..0000000000 --- a/layouts/community/split_3x6_3/bcat/readme.md +++ /dev/null @@ -1,131 +0,0 @@ -# bcat's split 3x6 + 3 thumb keys layout - -(See also the -[BlueMicro](https://github.com/jpconstantineau/BlueMicro_BLE/tree/master/firmware/keyboards/crkbd/keymaps/bcat) -and [ZMK](https://github.com/bcat/zmk-config/blob/master/config/corne.keymap) -versions of this keymap.) - -This is my favorite split ergo layout for typing, featuring the traditional -four ortho/ergo layers (Default, Lower, Raise, Adjust). It is loosely inspired -by the default Planck (numbers on Lower, symbols on Raise) and Crkbd (Space on -left, Enter on right) layouts, but has since been redesigned heavily according -to the principles described below. - -* Since my most-frequently-used keyboard shortcuts involve Ctrl, which lives on -the left half of the keyboard, keys frequently used with it (numbers, function -keys, etc.) are on the Raise layer activated by the right thumb. - -* Navigation can be done on the right half alone, to enable simultaneous -left-handed mousing. Additionally, Web pages can be scrolled with Space or -Shift+Space on the left half alone, to enable taking notes with the right hand -at the same time. - -* Other than Right Shift (which I seldom use), mods aren't rebound on layers. - -* Likewise, Backspace is not rebound on layers to avoid having to let go of -layer-switch keys to correct mistakes. - -## Default layer - -![Default layer layout](https://i.imgur.com/g5N7g8D.png) - -([KLE](http://www.keyboard-layout-editor.com/#/gists/08d9827d916662a9414f48805aa895a5)) - -* The alpha keys are a standard QWERTY layout, no funny business there. - -* Tab and Backspace are in familiar locations from my row-staggered boards -(almost all of which use HHKB-style split backspace). - -* The Esc key is next to the home row for convenience in Vim. - -* There are two Shift keys, although I generally use Left Shift. (I've -considered replacing Right Shift with another key, but haven't chosen one.) - -* Lower and Raise layer-switch keys are in the resting position of my left and -right thumbs, respectively. - -* Space and Enter are on the big thumb keys so they're easy to press. - -* Ctrl is on the left for ease of chording, especially one-handed use of common -shortcuts like Ctrl+T and Ctrl+W. This puts Alt on the right by the process of -elimination. (I would really like one more 1U thumb key on each half to allow -for a redundant Alt key on the left and a dedicated Super key on the right.) - -## Lower layer - -![Lower layer layout](https://i.imgur.com/vaIc9JY.png) - -([KLE](http://www.keyboard-layout-editor.com/#/gists/c3fba5eaa2cd70fdfbdbc0f9e34d3bc0)) - -* This could also be called the "symbol layer". - -* Shifted numbers are bound in their usual positions on the top row. - -* Hyphen/Underscore and Equals/Plus are in the right index- and middle-finger -columns for easy reach. They share the same relative position as on a -row-staggered keyboard, and the shifted versions are physically above the -unshifted versions as a mnemonic device. - -* Brackets and braces are placed below the parens for easy recall. Once again, -the shifted versions are on the home row and the unshifted versions are on the -bottom row. - -* Forward Slash/Pipe and Backtick/Tilde fill out the remaining positions on the -right half, with the same relative positions as on a row-staggered HHKB layout. -And yup, the shifted versions are above the unshifted versions. - -* Remaining keys from a TKL are placed out of the way on the bottom row of the -left half. - -* The home row on the left half contains handy shortcuts for zooming and browser -navigation. - -* Lower+Esc is bound to Ctrl+Space because the Ctrl and Space keys are both on -the left thumb, so this key combination (which I use for tmux prefix and editor -autocomplete) is hard to press in its natural location. - -* Lower+Tab is bound to a custom Alt+Tab macro that keeps the Alt modifier held -as long as the Lower key is held down. This means that window switching is on -Lower+Tab immediately next to browser tab switching (Ctrl+Tab). - -## Raise layer - -![Raise layer layout](https://i.imgur.com/VNEiV9A.png) - -([KLE](http://www.keyboard-layout-editor.com/#/gists/08b44355d4ca85d294bad9e2821f91d7)) - -* This could also be called the "number layer". - -* Unshifted numbers are bound in their usual positions on the top row. - -* Arrow keys are on VIM-style HJKL keys. - -* Home/End and Page Up/Page Down are in the same column as the arrow keys, but -translated down one row. (This means that the comma and period keys are not -bound on the number layer, which makes data entry a bit funky. I might add a -dedicated numpad layer to compensate.) - -* Function keys F1–F10 take up most of remaining space on the left half, with -F11 and F12 spilling over to the right half. (This puts the most used function -keys (F1–F5) on the home row.) - -* Insert and Delete are on the rightmost column, because there didn't seem to -be a better place to put them. - -* Caps Lock is bound in the same position as on an HHKB, for lack of an obvious -better location. - -## Adjust layer - -![Adjust layer layout](https://i.imgur.com/Q4rN6cQ.png) - -([KLE](http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee)) - -* Media keys are centered around the ESDF cluster, just like I arrange them on -row-staggered keyboards. (It's even more sensible with columnar stagger.) - -* The navigation keys are replaced by RGB controls. Again, this mirrors the -positioning I use on my row-staggered keyboards. - -* Finally, reset keys live at the top-left corner of the right half where it's -reasonably hard to press them by accident. diff --git a/layouts/community/split_3x6_3/bcat/rules.mk b/layouts/community/split_3x6_3/bcat/rules.mk deleted file mode 100644 index e0ce760a79..0000000000 --- a/layouts/community/split_3x6_3/bcat/rules.mk +++ /dev/null @@ -1,8 +0,0 @@ -BCAT_OLED_PET = luna - -ifeq ($(strip $(KEYBOARD)), crkbd/rev1) - BOOTLOADER = atmel-dfu # Elite-C - - OLED_ENABLE = yes # dual 128x32 OLED screens - RGB_MATRIX_ENABLE = yes # per-key RGB and underglow -endif diff --git a/layouts/community/split_3x6_3/drashna/chconf.h b/layouts/community/split_3x6_3/drashna/chconf.h deleted file mode 100644 index 1e277d357d..0000000000 --- a/layouts/community/split_3x6_3/drashna/chconf.h +++ /dev/null @@ -1,11 +0,0 @@ - -#if defined(KEYBOARD_crkbd) -# define CH_CFG_ST_RESOLUTION 16 -# define CH_CFG_ST_FREQUENCY 10000 -#endif - -#if __has_include("platforms/chibios/common/configs/chconf.h") -# include_next "platforms/chibios/common/configs/chconf.h" -#else -# include_next -#endif diff --git a/layouts/community/split_3x6_3/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h deleted file mode 100644 index cfed26931b..0000000000 --- a/layouts/community/split_3x6_3/drashna/config.h +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) - * - * 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 . - */ - -#pragma once - -/* Select hand configuration */ - -// #define MASTER_LEFT -// #define MASTER_RIGHT -#define EE_HANDS -#define SPLIT_MODS_ENABLE - -#undef USE_I2C - -// #define QUICK_TAP_TERM 0 -// #define TAPPING_TERM 100 - -#ifdef RGBLIGHT_ENABLE -# undef RGBLED_NUM -# define RGBLED_NUM 27 - -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 5 -# define RGBLIGHT_LIMIT_VAL 120 -#endif - -#ifdef RGB_MATRIX_ENABLE -# ifdef CONVERT_TO_PROTON_C -# undef WS2812_DI_PIN -# define WS2812_DI_PIN A3 -# endif -# define RGB_MATRIX_KEYPRESSES // reacts to keypresses -// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) -# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended -// # define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) -// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) -# ifndef RGB_MATRIX_MAXIMUM_BRIGHTNESS -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 -# endif -# define RGB_MATRIX_HUE_STEP 8 -# define RGB_MATRIX_SAT_STEP 8 -# define RGB_MATRIX_VAL_STEP 5 -# define RGB_MATRIX_SPD_STEP 10 -#endif - -#ifdef CONVERT_TO_PROTON_C -# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 -# define WS2812_PWM_CHANNEL 4 // default: 2 -# define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 -# define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. -# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. -# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. - -# undef SOFT_SERIAL_PIN -# define SOFT_SERIAL_PIN D3 -# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 -# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 - -// #define INIT_EE_HANDS_LEFT -// #define INIT_EE_HANDS_RIGHT -#endif - -#if defined(AUDIO_ENABLE) && !defined(CONVERT_TO_PROTON_C) -# define AUDIO_PIN B6 -# define NO_MUSIC_MODE -#endif - -#if defined(HAPTIC_ENABLE) -# if defined(CONVERT_TO_PROTON_C) -# define A13 PAL_LINE(GPIOA, 13) -# define SOLENOID_PIN A13 -# else -# define SOLENOID_PIN B7 -# endif -#endif - -#undef PRODUCT -#ifdef CONVERT_TO_PROTON_C -# define PRODUCT "Drashna Hacked ARM Corne Keyboard" -#else -# define PRODUCT "Drashna Hacked Corne Keyboard" -#endif - -#define TAPPING_TERM_PER_KEY -#ifdef TAPPING_TERM -# undef TAPPING_TERM -#endif -#define TAPPING_TERM 200 diff --git a/layouts/community/split_3x6_3/drashna/glcdfont.c b/layouts/community/split_3x6_3/drashna/glcdfont.c deleted file mode 100644 index 10ce3b3457..0000000000 --- a/layouts/community/split_3x6_3/drashna/glcdfont.c +++ /dev/null @@ -1,232 +0,0 @@ -#include "progmem.h" - -// Corne 8x6 font with QMK Firmware Logo -// Online editor: https://helixfonteditor.netlify.com/ - -// clang-format off -const unsigned char font[] PROGMEM = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, -0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, -0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, -0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, -0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, -0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, -0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, -0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, -0x00, 0x18, 0x24, 0x18, 0x00, 0x00, -0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, -0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, -0x26, 0x29, 0x79, 0x29, 0x26, 0x00, -0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, -0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, -0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, -0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, -0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, -0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, -0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, -0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, -0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, -0x60, 0x60, 0x60, 0x60, 0x60, 0x00, -0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, -0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, -0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, -0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, -0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, -0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, -0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, -0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, -0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, -0x00, 0x07, 0x00, 0x07, 0x00, 0x00, -0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, -0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, -0x23, 0x13, 0x08, 0x64, 0x62, 0x00, -0x36, 0x49, 0x56, 0x20, 0x50, 0x00, -0x00, 0x08, 0x07, 0x03, 0x00, 0x00, -0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, -0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, -0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, -0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, -0x00, 0x80, 0x70, 0x30, 0x00, 0x00, -0x08, 0x08, 0x08, 0x08, 0x08, 0x00, -0x00, 0x00, 0x60, 0x60, 0x00, 0x00, -0x20, 0x10, 0x08, 0x04, 0x02, 0x00, -0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, -0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, -0x72, 0x49, 0x49, 0x49, 0x46, 0x00, -0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, -0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, -0x27, 0x45, 0x45, 0x45, 0x39, 0x00, -0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, -0x41, 0x21, 0x11, 0x09, 0x07, 0x00, -0x36, 0x49, 0x49, 0x49, 0x36, 0x00, -0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, -0x00, 0x00, 0x14, 0x00, 0x00, 0x00, -0x00, 0x40, 0x34, 0x00, 0x00, 0x00, -0x00, 0x08, 0x14, 0x22, 0x41, 0x00, -0x14, 0x14, 0x14, 0x14, 0x14, 0x00, -0x00, 0x41, 0x22, 0x14, 0x08, 0x00, -0x02, 0x01, 0x59, 0x09, 0x06, 0x00, -0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, -0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, -0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, -0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, -0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, -0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, -0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, -0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, -0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, -0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, -0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, -0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, -0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, -0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, -0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, -0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, -0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, -0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, -0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, -0x26, 0x49, 0x49, 0x49, 0x32, 0x00, -0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, -0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, -0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, -0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, -0x63, 0x14, 0x08, 0x14, 0x63, 0x00, -0x03, 0x04, 0x78, 0x04, 0x03, 0x00, -0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, -0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, -0x02, 0x04, 0x08, 0x10, 0x20, 0x00, -0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, -0x04, 0x02, 0x01, 0x02, 0x04, 0x00, -0x40, 0x40, 0x40, 0x40, 0x40, 0x00, -0x00, 0x03, 0x07, 0x08, 0x00, 0x00, -0x20, 0x54, 0x54, 0x78, 0x40, 0x00, -0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, -0x38, 0x44, 0x44, 0x44, 0x28, 0x00, -0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, -0x38, 0x54, 0x54, 0x54, 0x18, 0x00, -0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, -0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, -0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, -0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, -0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, -0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, -0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, -0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, -0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, -0x38, 0x44, 0x44, 0x44, 0x38, 0x00, -0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, -0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, -0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, -0x48, 0x54, 0x54, 0x54, 0x24, 0x00, -0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, -0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, -0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, -0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, -0x44, 0x28, 0x10, 0x28, 0x44, 0x00, -0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, -0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, -0x00, 0x08, 0x36, 0x41, 0x00, 0x00, -0x00, 0x00, 0x77, 0x00, 0x00, 0x00, -0x00, 0x41, 0x36, 0x08, 0x00, 0x00, -0x02, 0x01, 0x02, 0x04, 0x02, 0x00, -0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, -0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0, -0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, -0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, -0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, -0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, -0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, -0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, -0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0, -0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, -0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0, -0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, -0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, -0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, -0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, -0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, -0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, -0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, -0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, -0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, -0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, -0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE, -0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, -0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, -0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, -0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x81, -0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF, -0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, -0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, -0x01, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, -0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, -0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, -0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, -0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, -0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, -0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, -0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, -0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, -0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, -0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, -0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, -0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, -0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F, -0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, -0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C, -0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x01, 0x03, 0x07, 0x07, -0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -0x03, 0x01, 0x00, 0x00, 0x00, 0x00, -0x01, 0x03, 0x07, 0x07, 0x07, 0x07, -0x07, 0x07, 0x07, 0x07, 0x03, 0x01, -0x00, 0x00, 0x00, 0x07, 0x07, 0x07, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x07, 0x07, 0x07, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x07, 0x07, -0x07, 0x00, 0x00, 0x00, 0x01, 0x03, -0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -0x07, 0x07, 0x03, 0x01, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/layouts/community/split_3x6_3/drashna/halconf.h b/layouts/community/split_3x6_3/drashna/halconf.h deleted file mode 100644 index 7cc1306598..0000000000 --- a/layouts/community/split_3x6_3/drashna/halconf.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2020 Nick Brassel (tzarc) - * - * 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 3 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 . - */ -#pragma once - -#if defined(KEYBOARD_crkbd) -# define HAL_USE_PWM TRUE -# define HAL_USE_SERIAL TRUE -#endif - -#include_next diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c deleted file mode 100644 index 257e033f22..0000000000 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) - * - * 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 . - */ - -#include "drashna.h" - -enum crkbd_keycodes { - RGBRST = USER_SAFE_RANGE, -}; - -/* - * The `LAYOUT_crkbd_base` macro is a template to allow the use of identical - * modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so - * that there is no need to set them up for each layout, and modify all of - * them if I want to change them. This helps to keep consistency and ease - * of use. K## is a placeholder to pass through the individual keycodes - */ - -#ifdef CONVERT_TO_PROTON_C -# define MID_TMB ET_RAIS -#else -# define MID_TMB KC_ENT -#endif - -// clang-format off -#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__) -#define LAYOUT_split_3x6_3_base( \ - K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ - K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ - ) \ - LAYOUT_split_3x6_3_wrapper( \ - KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ - ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ - OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ - OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, MID_TMB, OS_RGUI \ - ) -#define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper( - _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, - _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, - _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ - ), - - [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper( - ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, - ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, - ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ - ), - - [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper( - _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, - _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, - _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ - ), - - [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper( - _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, - _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, - _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ - ), - - [_LOWER] = LAYOUT_split_3x6_3_wrapper( - KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11, - KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, - _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, - _______, _______, _______, _______, _______, _______ - ), - - [_RAISE] = LAYOUT_split_3x6_3_wrapper( - _______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, - _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, - _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, - _______, _______, _______, _______, _______, _______ - ), - - [_ADJUST] = LAYOUT_split_3x6_3_wrapper( - QK_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, QK_BOOT, - VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EE_CLR, - KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL, - QK_RBT, KC_NUKE, _______, _______, TG_MODS, AUTO_CTN - ) -}; -// clang-format on - -#ifdef OLED_ENABLE -oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { - return OLED_ROTATION_270; -} - -# ifdef CONVERT_TO_PROTON_C -// WPM-responsive animation stuff here -# define SLEEP_FRAMES 2 -# define SLEEP_SPEED 10 // below this wpm value your animation will idle - -# define WAKE_FRAMES 2 // uncomment if >1 - -# define KAKI_FRAMES 3 -# define KAKI_SPEED 40 // above this wpm value typing animation to triggere - -# define RTOGI_FRAMES 2 -// #define LTOGI_FRAMES 2 - -// #define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms -// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing -# define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024 - -uint32_t anim_timer = 0; -uint32_t anim_frame_duration = 500; -uint8_t current_sleep_frame = 0; -uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1 -uint8_t current_kaki_frame = 0; -# ifdef SWAP_HANDS_ENABLE -uint8_t current_rtogi_frame = 0; -# endif -// uint8_t current_ltogi_frame = 0; -// clang-format off -void render_small_kitty(void) { - // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach. - static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{ - // 'sleep1', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, - }, - {// 'sleep2', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00 - }}; - static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{ - // 'mati2', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 - }, - {// 'mati3', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 - }}; - static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{ - // 'jare2', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00 - }, - { - // 'kaki1', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08 - }, - {// 'kaki2', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, - }}; -#ifdef SWAP_HANDS_ENABLE - static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{ - // 'rtogi1', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, - 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }, - {// 'rtogi2', 32x32px - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, - 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }}; -#endif - // assumes 1 frame prep stage -#ifdef SWAP_HANDS_ENABLE - extern bool swap_hands; -#endif - void animation_phase(void) { -#ifdef SWAP_HANDS_ENABLE - if (swap_hands) { - anim_frame_duration = 300; - current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES; - oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE); - } else -#endif - { - if (get_current_wpm() <= SLEEP_SPEED) { - anim_frame_duration = 500; - current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES; - oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE); - } - // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() SLEEP_SPEED) { - anim_frame_duration = 800; - current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES; - oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE); - // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1 - } - if (get_current_wpm() >= KAKI_SPEED) { - anim_frame_duration = 500; - current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES; - oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE); - } - } - } - if (get_current_wpm() != 000) { - // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { - if (timer_elapsed32(anim_timer) > anim_frame_duration) { - anim_timer = timer_read32(); - animation_phase(); - } - } else { - // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { - if (timer_elapsed32(anim_timer) > anim_frame_duration) { - anim_timer = timer_read32(); - animation_phase(); - } - } -} - -void oled_driver_render_logo_right(void) { - render_small_kitty(); - - render_default_layer_state(0, 4); -} -# endif -#endif - -#ifdef TAPPING_TERM_PER_KEY -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case ALT_T(KC_A): - return TAPPING_TERM + 100; - default: - return TAPPING_TERM; - } -} -#endif - -#ifdef RGB_MATRIX_ENABLE -void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { - switch (get_highest_layer(default_layer_state)) { - case _QWERTY: - rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); - break; - case _COLEMAK_DH: - rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); - break; - case _COLEMAK: - rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); - break; - case _DVORAK: - rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); - break; - } -} - -bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { - if (userspace_config.rgb_layer_change) { - switch (get_highest_layer(layer_state)) { - case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - default: - { - check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max); - break; - } - } - check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max); - } - return false; -} -#endif diff --git a/layouts/community/split_3x6_3/drashna/mcuconf.h b/layouts/community/split_3x6_3/drashna/mcuconf.h deleted file mode 100644 index 920261476c..0000000000 --- a/layouts/community/split_3x6_3/drashna/mcuconf.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2020 Nick Brassel (tzarc) - * - * 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 3 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 . - */ -#pragma once - -#include_next - -#if defined(KEYBOARD_crkbd) - -# undef STM32_PWM_USE_TIM2 -# define STM32_PWM_USE_TIM2 TRUE -# undef STM32_PWM_USE_TIM3 -# define STM32_PWM_USE_TIM3 FALSE - -# undef STM32_SERIAL_USE_USART1 -# define STM32_SERIAL_USE_USART1 TRUE - -# undef STM32_ST_USE_TIMER -# define STM32_ST_USE_TIMER 3 -#endif diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk deleted file mode 100644 index 2d07ad5a77..0000000000 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ /dev/null @@ -1,57 +0,0 @@ -# Build Options -# change to "no" to disable the options -# - -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -AUDIO_ENABLE = no # Audio output -UNICODE_ENABLE = no # Unicode -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. -SWAP_HANDS_ENABLE = no # Enable one-hand typing -OS_DETECTION_ENABLE = no -CUSTOM_UNICODE_ENABLE = no -CUSTOM_POINTING_DEVICE = no -CUSTOM_SPLIT_TRANSPORT_SYNC = no - -USE_ARM_CONFIG ?= no -ifeq ($(strip $(CONVERT_TO)), proton_c) - USE_ARM_CONFIG = yes -endif -ifeq ($(strip $(MCU)), STM32F303) - USE_ARM_CONFIG = yes -endif -ifeq ($(strip $(MCU)), STM32F401) - USE_ARM_CONFIG = yes -endif -ifeq ($(strip $(MCU)), STM32F411) - USE_ARM_CONFIG = yes -endif - -ifeq ($(strip $(MCU)), atmega32u4) - BOOTLOADER = qmk-hid - BOOTLOADER_SIZE = 512 -endif - -ifeq ($(strip $(USE_ARM_CONFIG)), yes) - HAPTIC_ENABLE = no - WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file - SERIAL_DRIVER = usart - WPM_ENABLE = yes - AUTOCORRECT_ENABLE = yes - CAPS_WORD_ENABLE = yes - OS_DETECTION_ENABLE = yes - CUSTOM_UNICODE_ENABLE = no - CUSTOM_POINTING_DEVICE = no - CUSTOM_SPLIT_TRANSPORT_SYNC = no -endif - -ifeq ($(strip $(KEYBOARD)), crkbd/rev1) - OLED_ENABLE = yes - RGB_MATRIX_ENABLE = yes - HAPTIC_ENABLE = no -endif diff --git a/quantum/rgb_matrix/animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h deleted file mode 100644 index 59b8381d69..0000000000 --- a/quantum/rgb_matrix/animations/alpha_mods_anim.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_ALPHAS_MODS -RGB_MATRIX_EFFECT(ALPHAS_MODS) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -// alphas = color1, mods = color2 -bool ALPHAS_MODS(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - HSV hsv = rgb_matrix_config.hsv; - RGB rgb1 = rgb_matrix_hsv_to_rgb(hsv); - hsv.h += rgb_matrix_config.speed; - RGB rgb2 = rgb_matrix_hsv_to_rgb(hsv); - - for (uint8_t i = led_min; i < led_max; i++) { - RGB_MATRIX_TEST_LED_FLAGS(); - if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { - rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b); - } else { - rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b); - } - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_ALPHAS_MODS diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h deleted file mode 100644 index e9a3c96e1b..0000000000 --- a/quantum/rgb_matrix/animations/breathing_anim.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BREATHING -RGB_MATRIX_EFFECT(BREATHING) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -bool BREATHING(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 rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BREATHING diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h deleted file mode 100644 index 06aa8b5ed5..0000000000 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { - hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); - return hsv; -} - -bool BAND_PINWHEEL_SAT(effect_params_t* params) { - return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h deleted file mode 100644 index bcbc319498..0000000000 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { - hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); - return hsv; -} - -bool BAND_PINWHEEL_VAL(effect_params_t* params) { - return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL diff --git a/quantum/rgb_matrix/animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h deleted file mode 100644 index cb0897ad3e..0000000000 --- a/quantum/rgb_matrix/animations/colorband_sat_anim.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_SAT -RGB_MATRIX_EFFECT(BAND_SAT) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) { - int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; - hsv.s = scale8(s < 0 ? 0 : s, hsv.s); - return hsv; -} - -bool BAND_SAT(effect_params_t* params) { - return effect_runner_i(params, &BAND_SAT_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SAT diff --git a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h deleted file mode 100644 index d26eb37855..0000000000 --- a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { - hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); - return hsv; -} - -bool BAND_SPIRAL_SAT(effect_params_t* params) { - return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT diff --git a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h deleted file mode 100644 index 3ae34bb6f0..0000000000 --- a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { - hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); - return hsv; -} - -bool BAND_SPIRAL_VAL(effect_params_t* params) { - return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL diff --git a/quantum/rgb_matrix/animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h deleted file mode 100644 index 69c29f53a3..0000000000 --- a/quantum/rgb_matrix/animations/colorband_val_anim.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_BAND_VAL -RGB_MATRIX_EFFECT(BAND_VAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV BAND_VAL_math(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; -} - -bool BAND_VAL(effect_params_t* params) { - return effect_runner_i(params, &BAND_VAL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_VAL diff --git a/quantum/rgb_matrix/animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h deleted file mode 100644 index d8c7220d95..0000000000 --- a/quantum/rgb_matrix/animations/cycle_all_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_ALL -RGB_MATRIX_EFFECT(CYCLE_ALL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) { - hsv.h = time; - return hsv; -} - -bool CYCLE_ALL(effect_params_t* params) { - return effect_runner_i(params, &CYCLE_ALL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_ALL diff --git a/quantum/rgb_matrix/animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h deleted file mode 100644 index 84c2127aff..0000000000 --- a/quantum/rgb_matrix/animations/cycle_left_right_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) { - hsv.h = g_led_config.point[i].x - time; - return hsv; -} - -bool CYCLE_LEFT_RIGHT(effect_params_t* params) { - return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT diff --git a/quantum/rgb_matrix/animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h deleted file mode 100644 index 9513fe9593..0000000000 --- a/quantum/rgb_matrix/animations/cycle_out_in_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN -RGB_MATRIX_EFFECT(CYCLE_OUT_IN) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { - hsv.h = 3 * dist / 2 + time; - return hsv; -} - -bool CYCLE_OUT_IN(effect_params_t* params) { - return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN diff --git a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h deleted file mode 100644 index 3cca45f27a..0000000000 --- a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_OUT_IN_DUAL_math(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; -} - -bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { - return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL diff --git a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h deleted file mode 100644 index de5993992c..0000000000 --- a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { - hsv.h = atan2_8(dy, dx) + time; - return hsv; -} - -bool CYCLE_PINWHEEL(effect_params_t* params) { - return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_PINWHEEL diff --git a/quantum/rgb_matrix/animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h deleted file mode 100644 index 904450179e..0000000000 --- a/quantum/rgb_matrix/animations/cycle_spiral_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_SPIRAL -RGB_MATRIX_EFFECT(CYCLE_SPIRAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { - hsv.h = dist - time - atan2_8(dy, dx); - return hsv; -} - -bool CYCLE_SPIRAL(effect_params_t* params) { - return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_SPIRAL diff --git a/quantum/rgb_matrix/animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h deleted file mode 100644 index dce05fecff..0000000000 --- a/quantum/rgb_matrix/animations/cycle_up_down_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) { - hsv.h = g_led_config.point[i].y - time; - return hsv; -} - -bool CYCLE_UP_DOWN(effect_params_t* params) { - return effect_runner_i(params, &CYCLE_UP_DOWN_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_UP_DOWN diff --git a/quantum/rgb_matrix/animations/digital_rain_anim.h b/quantum/rgb_matrix/animations/digital_rain_anim.h deleted file mode 100644 index 7d3b22f697..0000000000 --- a/quantum/rgb_matrix/animations/digital_rain_anim.h +++ /dev/null @@ -1,83 +0,0 @@ -#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN) -RGB_MATRIX_EFFECT(DIGITAL_RAIN) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -# ifndef RGB_DIGITAL_RAIN_DROPS -// lower the number for denser effect/wider keyboard -# define RGB_DIGITAL_RAIN_DROPS 24 -# endif - -bool DIGITAL_RAIN(effect_params_t* params) { - // algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain - const uint8_t drop_ticks = 28; - const uint8_t pure_green_intensity = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2; - const uint8_t max_brightness_boost = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2; - const uint8_t max_intensity = rgb_matrix_config.hsv.v; - const uint8_t decay_ticks = 0xff / max_intensity; - - static uint8_t drop = 0; - static uint8_t decay = 0; - - if (params->init) { - rgb_matrix_set_color_all(0, 0, 0); - memset(g_rgb_frame_buffer, 0, sizeof(g_rgb_frame_buffer)); - drop = 0; - } - - decay++; - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) { - // top row, pixels have just fallen and we're - // making a new rain drop in this column - g_rgb_frame_buffer[row][col] = max_intensity; - } else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) { - // neither fully bright nor dark, decay it - if (decay == decay_ticks) { - g_rgb_frame_buffer[row][col]--; - } - } - // set the pixel colour - uint8_t led[LED_HITS_TO_REMEMBER]; - uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led); - - // TODO: multiple leds are supported mapped to the same row/column - if (led_count > 0) { - if (g_rgb_frame_buffer[row][col] > pure_green_intensity) { - const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (g_rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity)); - rgb_matrix_set_color(led[0], boost, max_intensity, boost); - } else { - const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity); - rgb_matrix_set_color(led[0], 0, green, 0); - } - } - } - } - if (decay == decay_ticks) { - decay = 0; - } - - if (++drop > drop_ticks) { - // reset drop timer - drop = 0; - for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - // if ths is on the bottom row and bright allow decay - if (row == MATRIX_ROWS - 1 && g_rgb_frame_buffer[row][col] == max_intensity) { - g_rgb_frame_buffer[row][col]--; - } - // check if the pixel above is bright - if (g_rgb_frame_buffer[row - 1][col] >= max_intensity) { // Note: can be larger than max_intensity if val was recently decreased - // allow old bright pixel to decay - g_rgb_frame_buffer[row - 1][col] = max_intensity - 1; - // make this pixel bright - g_rgb_frame_buffer[row][col] = max_intensity; - } - } - } - } - return false; -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN) diff --git a/quantum/rgb_matrix/animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h deleted file mode 100644 index 5585015b86..0000000000 --- a/quantum/rgb_matrix/animations/dual_beacon_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_DUAL_BEACON -RGB_MATRIX_EFFECT(DUAL_BEACON) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV DUAL_BEACON_math(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) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128; - return hsv; -} - -bool DUAL_BEACON(effect_params_t* params) { - return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_DUAL_BEACON diff --git a/quantum/rgb_matrix/animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h deleted file mode 100644 index ebb06f59f2..0000000000 --- a/quantum/rgb_matrix/animations/gradient_left_right_anim.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -bool GRADIENT_LEFT_RIGHT(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - HSV hsv = rgb_matrix_config.hsv; - uint8_t scale = scale8(64, rgb_matrix_config.speed); - for (uint8_t i = led_min; i < led_max; i++) { - RGB_MATRIX_TEST_LED_FLAGS(); - // The x range will be 0..224, map this to 0..7 - // Relies on hue being 8-bit and wrapping - hsv.h = rgb_matrix_config.hsv.h + (scale * g_led_config.point[i].x >> 5); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT diff --git a/quantum/rgb_matrix/animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h deleted file mode 100644 index febc3919a8..0000000000 --- a/quantum/rgb_matrix/animations/gradient_up_down_anim.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -bool GRADIENT_UP_DOWN(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - HSV hsv = rgb_matrix_config.hsv; - uint8_t scale = scale8(64, rgb_matrix_config.speed); - for (uint8_t i = led_min; i < led_max; i++) { - RGB_MATRIX_TEST_LED_FLAGS(); - // The y range will be 0..64, map this to 0..4 - // Relies on hue being 8-bit and wrapping - hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN diff --git a/quantum/rgb_matrix/animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h deleted file mode 100644 index 8537762832..0000000000 --- a/quantum/rgb_matrix/animations/hue_breathing_anim.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_HUE_BREATHING -RGB_MATRIX_EFFECT(HUE_BREATHING) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -// Change huedelta to adjust range of hue change. 0-255. -// Hue Breathing - All LED's light up -bool HUE_BREATHING(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - uint8_t huedelta = 12; - HSV hsv = rgb_matrix_config.hsv; - uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); - hsv.h = hsv.h + scale8(abs8(sin8(time) - 128) * 2, huedelta); - RGB rgb = 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 rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_BREATHING diff --git a/quantum/rgb_matrix/animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h deleted file mode 100644 index 7d8cbcdfb2..0000000000 --- a/quantum/rgb_matrix/animations/hue_pendulum_anim.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_HUE_PENDULUM -RGB_MATRIX_EFFECT(HUE_PENDULUM) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -// Change huedelta to adjust range of hue change. 0-255. -// Looks better with a low value and slow speed for subtle change. -// Hue Pendulum - color changes in a wave to the right before reversing direction -static HSV HUE_PENDULUM_math(HSV hsv, uint8_t i, uint8_t time) { - uint8_t huedelta = 12; - hsv.h = hsv.h + scale8(abs8(sin8(time) + (g_led_config.point[i].x) - 128) * 2, huedelta); - return hsv; -} - -bool HUE_PENDULUM(effect_params_t* params) { - return effect_runner_i(params, &HUE_PENDULUM_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_PENDULUM diff --git a/quantum/rgb_matrix/animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h deleted file mode 100644 index 81aa7e139e..0000000000 --- a/quantum/rgb_matrix/animations/hue_wave_anim.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_HUE_WAVE -RGB_MATRIX_EFFECT(HUE_WAVE) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -// Change huedelta to adjust range of hue change. 0-255. -// Looks better with a low value and slow speed for subtle change. -// Hue Wave - color changes in a wave to the right -static HSV HUE_WAVE_math(HSV hsv, uint8_t i, uint8_t time) { - uint8_t huedelta = 24; - hsv.h = hsv.h + scale8(abs8(g_led_config.point[i].x - time), huedelta); - return hsv; -} - -bool HUE_WAVE(effect_params_t* params) { - return effect_runner_i(params, &HUE_WAVE_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_WAVE diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h deleted file mode 100644 index 5d3df1059e..0000000000 --- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static void jellybean_raindrops_set_color(int i, effect_params_t* params) { - if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); -} - -bool JELLYBEAN_RAINDROPS(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - 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)) % 5 == 0) { - jellybean_raindrops_set_color(random8_max(RGB_MATRIX_LED_COUNT), params); - } - } else { - for (int i = led_min; i < led_max; i++) { - jellybean_raindrops_set_color(i, params); - } - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS diff --git a/quantum/rgb_matrix/animations/pixel_flow_anim.h b/quantum/rgb_matrix/animations/pixel_flow_anim.h deleted file mode 100644 index 27567b4f3a..0000000000 --- a/quantum/rgb_matrix/animations/pixel_flow_anim.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2022 @filterpaper -// SPDX-License-Identifier: GPL-2.0+ - -#ifdef ENABLE_RGB_MATRIX_PIXEL_FLOW -RGB_MATRIX_EFFECT(PIXEL_FLOW) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static bool PIXEL_FLOW(effect_params_t* params) { - // LED state array - static RGB led[RGB_MATRIX_LED_COUNT]; - - static uint32_t wait_timer = 0; - if (wait_timer > g_rgb_timer) { - return false; - } - - inline uint32_t interval(void) { - return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); - } - - if (params->init) { - // Clear LEDs and fill the state array - rgb_matrix_set_color_all(0, 0, 0); - for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) { - led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); - } - } - - RGB_MATRIX_USE_LIMITS(led_min, led_max); - // Light LEDs based on state array - for (uint8_t i = led_min; i < led_max; ++i) { - RGB_MATRIX_TEST_LED_FLAGS(); - rgb_matrix_set_color(i, led[i].r, led[i].g, led[i].b); - } - - if (!rgb_matrix_check_finished_leds(led_max)) { - // Shift LED state forward - for (uint8_t j = 0; j < led_max - 1; ++j) { - led[j] = led[j + 1]; - } - // Fill last LED - led[led_max - 1] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); - // Set pulse timer - wait_timer = g_rgb_timer + interval(); - } - - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_FLOW diff --git a/quantum/rgb_matrix/animations/pixel_fractal_anim.h b/quantum/rgb_matrix/animations/pixel_fractal_anim.h deleted file mode 100644 index 4cd1d9b861..0000000000 --- a/quantum/rgb_matrix/animations/pixel_fractal_anim.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2022 @filterpaper -// SPDX-License-Identifier: GPL-2.0-or-later -// Inspired by 4x12 fractal from @GEIGEIGEIST - -#ifdef ENABLE_RGB_MATRIX_PIXEL_FRACTAL -RGB_MATRIX_EFFECT(PIXEL_FRACTAL) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static bool PIXEL_FRACTAL(effect_params_t* params) { -# if MATRIX_COLS < 2 -# define MID_COL 1 -# else -# define MID_COL MATRIX_COLS / 2 -# endif - static bool led[MATRIX_ROWS][MID_COL]; - static uint32_t wait_timer = 0; - - inline uint32_t interval(void) { - return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); - } - - if (params->init) { - rgb_matrix_set_color_all(0, 0, 0); - } - - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - if (g_rgb_timer > wait_timer) { - RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); - for (uint8_t h = 0; h < MATRIX_ROWS; ++h) { - // Light and copy columns outward - for (uint8_t l = 0; l < MID_COL - 1; ++l) { - if (led[h][l]) { - rgb_matrix_set_color(g_led_config.matrix_co[h][l], rgb.r, rgb.g, rgb.b); - rgb_matrix_set_color(g_led_config.matrix_co[h][MATRIX_COLS - 1 - l], rgb.r, rgb.g, rgb.b); - } else { - rgb_matrix_set_color(g_led_config.matrix_co[h][l], 0, 0, 0); - rgb_matrix_set_color(g_led_config.matrix_co[h][MATRIX_COLS - 1 - l], 0, 0, 0); - } - led[h][l] = led[h][l + 1]; - } - - // Light both middle columns - if (led[h][MID_COL - 1]) { - rgb_matrix_set_color(g_led_config.matrix_co[h][MID_COL - 1], rgb.r, rgb.g, rgb.b); - rgb_matrix_set_color(g_led_config.matrix_co[h][MATRIX_COLS - MID_COL], rgb.r, rgb.g, rgb.b); - } else { - rgb_matrix_set_color(g_led_config.matrix_co[h][MID_COL - 1], 0, 0, 0); - rgb_matrix_set_color(g_led_config.matrix_co[h][MATRIX_COLS - MID_COL], 0, 0, 0); - } - - // Generate new random fractal column - led[h][MID_COL - 1] = (random8() & 3) ? false : true; - } - - wait_timer = g_rgb_timer + interval(); - } - - return rgb_matrix_check_finished_leds(led_max); -} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_FRACTAL diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h deleted file mode 100644 index 26cd73b578..0000000000 --- a/quantum/rgb_matrix/animations/pixel_rain_anim.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 @filterpaper -// SPDX-License-Identifier: GPL-2.0+ - -#ifdef ENABLE_RGB_MATRIX_PIXEL_RAIN -RGB_MATRIX_EFFECT(PIXEL_RAIN) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static bool PIXEL_RAIN(effect_params_t* params) { - static uint32_t wait_timer = 0; - - inline uint32_t interval(void) { - return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); - } - - inline void rain_pixel(uint8_t led_index) { - if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) { - return; - } - HSV hsv = (random8() & 2) ? (HSV){0, 0, 0} : (HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b); - wait_timer = g_rgb_timer + interval(); - } - - RGB_MATRIX_USE_LIMITS(led_min, led_max); - if (g_rgb_timer > wait_timer) { - rain_pixel(random8_max(RGB_MATRIX_LED_COUNT)); - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN diff --git a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h deleted file mode 100644 index bdcca5530f..0000000000 --- a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_RAINBOW_BEACON -RGB_MATRIX_EFFECT(RAINBOW_BEACON) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV RAINBOW_BEACON_math(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; -} - -bool RAINBOW_BEACON(effect_params_t* params) { - return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_BEACON diff --git a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h deleted file mode 100644 index f7b8f6c2f3..0000000000 --- a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV RAINBOW_MOVING_CHEVRON_math(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; -} - -bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { - return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON diff --git a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h deleted file mode 100644 index 91e31ea8cc..0000000000 --- a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV RAINBOW_PINWHEELS_math(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) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128; - return hsv; -} - -bool RAINBOW_PINWHEELS(effect_params_t* params) { - return effect_runner_sin_cos_i(params, &RAINBOW_PINWHEELS_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h deleted file mode 100644 index e8e1f6de04..0000000000 --- a/quantum/rgb_matrix/animations/raindrops_anim.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifdef ENABLE_RGB_MATRIX_RAINDROPS -RGB_MATRIX_EFFECT(RAINDROPS) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static void raindrops_set_color(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 * (random8() & 0x03)); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); -} - -bool RAINDROPS(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - 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(random8_max(RGB_MATRIX_LED_COUNT), params); - } - } else { - for (int i = led_min; i < led_max; i++) { - raindrops_set_color(i, params); - } - } - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINDROPS diff --git a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc deleted file mode 100644 index ac7bac428d..0000000000 --- a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc +++ /dev/null @@ -1,40 +0,0 @@ -// Add your new core rgb matrix effect here, order determines enum order -#include "solid_color_anim.h" -#include "alpha_mods_anim.h" -#include "gradient_up_down_anim.h" -#include "gradient_left_right_anim.h" -#include "breathing_anim.h" -#include "colorband_sat_anim.h" -#include "colorband_val_anim.h" -#include "colorband_pinwheel_sat_anim.h" -#include "colorband_pinwheel_val_anim.h" -#include "colorband_spiral_sat_anim.h" -#include "colorband_spiral_val_anim.h" -#include "cycle_all_anim.h" -#include "cycle_left_right_anim.h" -#include "cycle_up_down_anim.h" -#include "rainbow_moving_chevron_anim.h" -#include "cycle_out_in_anim.h" -#include "cycle_out_in_dual_anim.h" -#include "cycle_pinwheel_anim.h" -#include "cycle_spiral_anim.h" -#include "dual_beacon_anim.h" -#include "rainbow_beacon_anim.h" -#include "rainbow_pinwheels_anim.h" -#include "raindrops_anim.h" -#include "jellybean_raindrops_anim.h" -#include "hue_breathing_anim.h" -#include "hue_pendulum_anim.h" -#include "hue_wave_anim.h" -#include "pixel_rain_anim.h" -#include "pixel_flow_anim.h" -#include "pixel_fractal_anim.h" -#include "typing_heatmap_anim.h" -#include "digital_rain_anim.h" -#include "solid_reactive_simple_anim.h" -#include "solid_reactive_anim.h" -#include "solid_reactive_wide.h" -#include "solid_reactive_cross.h" -#include "solid_reactive_nexus.h" -#include "splash_anim.h" -#include "solid_splash_anim.h" diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h deleted file mode 100644 index 2ad0f22c28..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time); - -bool effect_runner_dx_dy(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 rgb_matrix_check_finished_leds(led_max); -} diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h deleted file mode 100644 index bcae7c79b6..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); - -bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_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; - uint8_t dist = sqrt16(dx * dx + dy * dy); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time)); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - return rgb_matrix_check_finished_leds(led_max); -} diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_i.h deleted file mode 100644 index b4de2992b6..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_i.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time); - -bool effect_runner_i(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 rgb_matrix_check_finished_leds(led_max); -} diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h deleted file mode 100644 index f9584d7071..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - -typedef HSV (*reactive_f)(HSV hsv, uint16_t offset); - -bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - uint16_t max_tick = 65535 / qadd8(rgb_matrix_config.speed, 1); - for (uint8_t i = led_min; i < led_max; i++) { - RGB_MATRIX_TEST_LED_FLAGS(); - uint16_t tick = max_tick; - // Reverse search to find most recent key hit - for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) { - if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) { - tick = g_last_hit_tracker.tick[j]; - break; - } - } - - uint16_t offset = scale16by8(tick, qadd8(rgb_matrix_config.speed, 1)); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset)); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - return rgb_matrix_check_finished_leds(led_max); -} - -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h deleted file mode 100644 index 41020eb47f..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - -typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); - -bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - uint8_t count = g_last_hit_tracker.count; - for (uint8_t i = led_min; i < led_max; i++) { - RGB_MATRIX_TEST_LED_FLAGS(); - HSV hsv = rgb_matrix_config.hsv; - hsv.v = 0; - for (uint8_t j = start; j < count; j++) { - int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; - int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; - uint8_t dist = sqrt16(dx * dx + dy * dy); - uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], qadd8(rgb_matrix_config.speed, 1)); - hsv = effect_func(hsv, dx, dy, dist, tick); - } - hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - return rgb_matrix_check_finished_leds(led_max); -} - -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h deleted file mode 100644 index 7776491d51..0000000000 --- a/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); - -bool effect_runner_sin_cos_i(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 rgb_matrix_check_finished_leds(led_max); -} diff --git a/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc b/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc deleted file mode 100644 index c09022bb0f..0000000000 --- a/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc +++ /dev/null @@ -1,6 +0,0 @@ -#include "effect_runner_dx_dy_dist.h" -#include "effect_runner_dx_dy.h" -#include "effect_runner_i.h" -#include "effect_runner_sin_cos_i.h" -#include "effect_runner_reactive.h" -#include "effect_runner_reactive_splash.h" diff --git a/quantum/rgb_matrix/animations/solid_color_anim.h b/quantum/rgb_matrix/animations/solid_color_anim.h deleted file mode 100644 index c8762dcbc2..0000000000 --- a/quantum/rgb_matrix/animations/solid_color_anim.h +++ /dev/null @@ -1,15 +0,0 @@ -RGB_MATRIX_EFFECT(SOLID_COLOR) -#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -bool SOLID_COLOR(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.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 rgb_matrix_check_finished_leds(led_max); -} - -#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h deleted file mode 100644 index edf6041350..0000000000 --- a/quantum/rgb_matrix/animations/solid_reactive_anim.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE -RGB_MATRIX_EFFECT(SOLID_REACTIVE) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { -# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); -# endif - hsv.h += qsub8(130, offset); - return hsv; -} - -bool SOLID_REACTIVE(effect_params_t* params) { - return effect_runner_reactive(params, &SOLID_REACTIVE_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h deleted file mode 100644 index a18d6b03dd..0000000000 --- a/quantum/rgb_matrix/animations/solid_reactive_cross.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# if defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) -# endif - -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { - uint16_t effect = tick + dist; - dx = dx < 0 ? dx * -1 : dx; - dy = dy < 0 ? dy * -1 : dy; - dx = dx * 16 > 255 ? 255 : dx * 16; - dy = dy * 16 > 255 ? 255 : dy * 16; - effect += dx > dy ? dy : dx; - if (effect > 255) effect = 255; -# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); -# endif - hsv.v = qadd8(hsv.v, 255 - effect); - return hsv; -} - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -bool SOLID_REACTIVE_CROSS(effect_params_t* params) { - return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); -} -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { - return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); -} -# endif - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h deleted file mode 100644 index 53cc008616..0000000000 --- a/quantum/rgb_matrix/animations/solid_reactive_nexus.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# if defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) -# endif - -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { - uint16_t effect = tick - dist; - if (effect > 255) effect = 255; - if (dist > 72) effect = 255; - if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255; -# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4) + dy / 4; -# else - hsv.h = rgb_matrix_config.hsv.h + dy / 4; -# endif - hsv.v = qadd8(hsv.v, 255 - effect); - return hsv; -} - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { - return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); -} -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { - return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); -} -# endif - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h deleted file mode 100644 index 7f4e48747a..0000000000 --- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { -# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); -# endif - hsv.v = scale8(255 - offset, hsv.v); - return hsv; -} - -bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { - return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h deleted file mode 100644 index feca126648..0000000000 --- a/quantum/rgb_matrix/animations/solid_reactive_wide.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# if defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) -# endif - -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { - uint16_t effect = tick + dist * 5; - if (effect > 255) effect = 255; -# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE - hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); -# endif - hsv.v = qadd8(hsv.v, 255 - effect); - return hsv; -} - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -bool SOLID_REACTIVE_WIDE(effect_params_t* params) { - return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); -} -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { - return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); -} -# endif - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_splash_anim.h b/quantum/rgb_matrix/animations/solid_splash_anim.h deleted file mode 100644 index 77d6f8c5eb..0000000000 --- a/quantum/rgb_matrix/animations/solid_splash_anim.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# if defined(ENABLE_RGB_MATRIX_SOLID_SPLASH) || defined(ENABLE_RGB_MATRIX_SOLID_MULTISPLASH) - -# ifdef ENABLE_RGB_MATRIX_SOLID_SPLASH -RGB_MATRIX_EFFECT(SOLID_SPLASH) -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -RGB_MATRIX_EFFECT(SOLID_MULTISPLASH) -# endif - -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { - uint16_t effect = tick - dist; - if (effect > 255) effect = 255; - hsv.v = qadd8(hsv.v, 255 - effect); - return hsv; -} - -# ifdef ENABLE_RGB_MATRIX_SOLID_SPLASH -bool SOLID_SPLASH(effect_params_t* params) { - return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); -} -# endif - -# ifdef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -bool SOLID_MULTISPLASH(effect_params_t* params) { - return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); -} -# endif - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) && !defined(ENABLE_RGB_MATRIX_MULTISPLASH) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/splash_anim.h b/quantum/rgb_matrix/animations/splash_anim.h deleted file mode 100644 index 06459e1b0a..0000000000 --- a/quantum/rgb_matrix/animations/splash_anim.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -# if defined(ENABLE_RGB_MATRIX_SPLASH) || defined(ENABLE_RGB_MATRIX_MULTISPLASH) - -# ifdef ENABLE_RGB_MATRIX_SPLASH -RGB_MATRIX_EFFECT(SPLASH) -# endif - -# ifdef ENABLE_RGB_MATRIX_MULTISPLASH -RGB_MATRIX_EFFECT(MULTISPLASH) -# endif - -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { - uint16_t effect = tick - dist; - if (effect > 255) effect = 255; - hsv.h += effect; - hsv.v = qadd8(hsv.v, 255 - effect); - return hsv; -} - -# ifdef ENABLE_RGB_MATRIX_SPLASH -bool SPLASH(effect_params_t* params) { - return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); -} -# endif - -# ifdef ENABLE_RGB_MATRIX_MULTISPLASH -bool MULTISPLASH(effect_params_t* params) { - return effect_runner_reactive_splash(0, params, &SPLASH_math); -} -# endif - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) || !defined(ENABLE_RGB_MATRIX_MULTISPLASH) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h deleted file mode 100644 index d09bdc4631..0000000000 --- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h +++ /dev/null @@ -1,100 +0,0 @@ -#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) -RGB_MATRIX_EFFECT(TYPING_HEATMAP) -# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# ifndef RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP -# define RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP 32 -# endif - -# ifndef RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS -# define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25 -# endif - -# ifndef RGB_MATRIX_TYPING_HEATMAP_SPREAD -# define RGB_MATRIX_TYPING_HEATMAP_SPREAD 40 -# endif - -# ifndef RGB_MATRIX_TYPING_HEATMAP_AREA_LIMIT -# define RGB_MATRIX_TYPING_HEATMAP_AREA_LIMIT 16 -# endif -void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) { -# ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM - // Limit effect to pressed keys - g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP); -# else - if (g_led_config.matrix_co[row][col] == NO_LED) { // skip as pressed key doesn't have an led position - return; - } - for (uint8_t i_row = 0; i_row < MATRIX_ROWS; i_row++) { - for (uint8_t i_col = 0; i_col < MATRIX_COLS; i_col++) { - if (g_led_config.matrix_co[i_row][i_col] == NO_LED) { // skip as target key doesn't have an led position - continue; - } - if (i_row == row && i_col == col) { - g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP); - } else { -# define LED_DISTANCE(led_a, led_b) sqrt16(((int16_t)(led_a.x - led_b.x) * (int16_t)(led_a.x - led_b.x)) + ((int16_t)(led_a.y - led_b.y) * (int16_t)(led_a.y - led_b.y))) - uint8_t distance = LED_DISTANCE(g_led_config.point[g_led_config.matrix_co[row][col]], g_led_config.point[g_led_config.matrix_co[i_row][i_col]]); -# undef LED_DISTANCE - if (distance <= RGB_MATRIX_TYPING_HEATMAP_SPREAD) { - uint8_t amount = qsub8(RGB_MATRIX_TYPING_HEATMAP_SPREAD, distance); - if (amount > RGB_MATRIX_TYPING_HEATMAP_AREA_LIMIT) { - amount = RGB_MATRIX_TYPING_HEATMAP_AREA_LIMIT; - } - g_rgb_frame_buffer[i_row][i_col] = qadd8(g_rgb_frame_buffer[i_row][i_col], amount); - } - } - } - } -# endif -} - -// A timer to track the last time we decremented all heatmap values. -static uint16_t heatmap_decrease_timer; -// Whether we should decrement the heatmap values during the next update. -static bool decrease_heatmap_values; - -bool TYPING_HEATMAP(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - - if (params->init) { - rgb_matrix_set_color_all(0, 0, 0); - memset(g_rgb_frame_buffer, 0, sizeof g_rgb_frame_buffer); - } - - // The heatmap animation might run in several iterations depending on - // `RGB_MATRIX_LED_PROCESS_LIMIT`, therefore we only want to update the - // timer when the animation starts. - if (params->iter == 0) { - decrease_heatmap_values = timer_elapsed(heatmap_decrease_timer) >= RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS; - - // Restart the timer if we are going to decrease the heatmap this frame. - if (decrease_heatmap_values) { - heatmap_decrease_timer = timer_read(); - } - } - - // Render heatmap & decrease - uint8_t count = 0; - for (uint8_t row = 0; row < MATRIX_ROWS && count < RGB_MATRIX_LED_PROCESS_LIMIT; row++) { - for (uint8_t col = 0; col < MATRIX_COLS && RGB_MATRIX_LED_PROCESS_LIMIT; col++) { - if (g_led_config.matrix_co[row][col] >= led_min && g_led_config.matrix_co[row][col] < led_max) { - count++; - uint8_t val = g_rgb_frame_buffer[row][col]; - if (!HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[row][col]], params->flags)) continue; - - HSV hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); - rgb_matrix_set_color(g_led_config.matrix_co[row][col], rgb.r, rgb.g, rgb.b); - - if (decrease_heatmap_values) { - g_rgb_frame_buffer[row][col] = qsub8(val, 1); - } - } - } - } - - return rgb_matrix_check_finished_leds(led_max); -} - -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) diff --git a/quantum/rgb_matrix/post_config.h b/quantum/rgb_matrix/post_config.h deleted file mode 100644 index 7162c8679b..0000000000 --- a/quantum/rgb_matrix/post_config.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2023 QMK -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -// clang-format off - -// framebuffer -#if defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) || \ - defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN) -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#endif - -// reactive -#if defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) || \ - defined(ENABLE_RGB_MATRIX_SPLASH) || \ - defined(ENABLE_RGB_MATRIX_MULTISPLASH) || \ - defined(ENABLE_RGB_MATRIX_SOLID_SPLASH) || \ - defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || \ - defined(ENABLE_RGB_MATRIX_SOLID_MULTISPLASH) -# define RGB_MATRIX_KEYPRESSES -#endif diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c deleted file mode 100644 index 96be615162..0000000000 --- a/quantum/rgb_matrix/rgb_matrix.c +++ /dev/null @@ -1,752 +0,0 @@ -/* Copyright 2017 Jason Williams - * Copyright 2017 Jack Humbert - * Copyright 2018 Yiancar - * - * 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 . - */ - -#include "rgb_matrix.h" -#include "progmem.h" -#include "eeprom.h" -#include "eeconfig.h" -#include "keyboard.h" -#include "sync_timer.h" -#include "debug.h" -#include -#include -#include - -#include - -#ifndef RGB_MATRIX_CENTER -const led_point_t k_rgb_matrix_center = {112, 32}; -#else -const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; -#endif - -__attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { - return hsv_to_rgb(hsv); -} - -// Generic effect runners -#include "rgb_matrix_runners.inc" - -// ------------------------------------------ -// -----Begin rgb effect includes macros----- -#define RGB_MATRIX_EFFECT(name) -#define RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -#include "rgb_matrix_effects.inc" -#ifdef RGB_MATRIX_CUSTOM_KB -# include "rgb_matrix_kb.inc" -#endif -#ifdef RGB_MATRIX_CUSTOM_USER -# include "rgb_matrix_user.inc" -#endif - -#undef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#undef RGB_MATRIX_EFFECT -// -----End rgb effect includes macros------- -// ------------------------------------------ - -#ifndef RGB_MATRIX_TIMEOUT -# define RGB_MATRIX_TIMEOUT 0 -#endif - -#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX -# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX -#endif - -#if !defined(RGB_MATRIX_HUE_STEP) -# define RGB_MATRIX_HUE_STEP 8 -#endif - -#if !defined(RGB_MATRIX_SAT_STEP) -# define RGB_MATRIX_SAT_STEP 16 -#endif - -#if !defined(RGB_MATRIX_VAL_STEP) -# define RGB_MATRIX_VAL_STEP 16 -#endif - -#if !defined(RGB_MATRIX_SPD_STEP) -# define RGB_MATRIX_SPD_STEP 16 -#endif - -#if !defined(RGB_MATRIX_DEFAULT_MODE) -# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT -# else -// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace -# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR -# endif -#endif - -#if !defined(RGB_MATRIX_DEFAULT_HUE) -# define RGB_MATRIX_DEFAULT_HUE 0 -#endif - -#if !defined(RGB_MATRIX_DEFAULT_SAT) -# define RGB_MATRIX_DEFAULT_SAT UINT8_MAX -#endif - -#if !defined(RGB_MATRIX_DEFAULT_VAL) -# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS -#endif - -#if !defined(RGB_MATRIX_DEFAULT_SPD) -# define RGB_MATRIX_DEFAULT_SPD UINT8_MAX / 2 -#endif - -// globals -rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr -uint32_t g_rgb_timer; -#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS -uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; -#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -last_hit_t g_last_hit_tracker; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - -// internals -static bool suspend_state = false; -static uint8_t rgb_last_enable = UINT8_MAX; -static uint8_t rgb_last_effect = UINT8_MAX; -static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false}; -static rgb_task_states rgb_task_state = SYNCING; -#if RGB_MATRIX_TIMEOUT > 0 -static uint32_t rgb_anykey_timer; -#endif // RGB_MATRIX_TIMEOUT > 0 - -// double buffers -static uint32_t rgb_timer_buffer; -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -static last_hit_t last_hit_buffer; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - -// split rgb matrix -#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) -const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; -#endif - -EECONFIG_DEBOUNCE_HELPER(rgb_matrix, EECONFIG_RGB_MATRIX, rgb_matrix_config); - -void eeconfig_update_rgb_matrix(void) { - eeconfig_flush_rgb_matrix(true); -} - -void eeconfig_update_rgb_matrix_default(void) { - dprintf("eeconfig_update_rgb_matrix_default\n"); - rgb_matrix_config.enable = 1; - rgb_matrix_config.mode = RGB_MATRIX_DEFAULT_MODE; - rgb_matrix_config.hsv = (HSV){RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL}; - rgb_matrix_config.speed = RGB_MATRIX_DEFAULT_SPD; - rgb_matrix_config.flags = LED_FLAG_ALL; - eeconfig_flush_rgb_matrix(true); -} - -void eeconfig_debug_rgb_matrix(void) { - dprintf("rgb_matrix_config EEPROM\n"); - dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable); - dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode); - dprintf("rgb_matrix_config.hsv.h = %d\n", rgb_matrix_config.hsv.h); - dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); - dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); - dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); - dprintf("rgb_matrix_config.flags = %d\n", rgb_matrix_config.flags); -} - -void rgb_matrix_reload_from_eeprom(void) { - rgb_matrix_disable_noeeprom(); - /* Reset back to what we have in eeprom */ - eeconfig_init_rgb_matrix(); - eeconfig_debug_rgb_matrix(); // display current eeprom values - if (rgb_matrix_config.enable) { - rgb_matrix_mode_noeeprom(rgb_matrix_config.mode); - } -} - -__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { - return 0; -} - -uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { - uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); - uint8_t led_index = g_led_config.matrix_co[row][column]; - if (led_index != NO_LED) { - led_i[led_count] = led_index; - led_count++; - } - return led_count; -} - -void rgb_matrix_update_pwm_buffers(void) { - rgb_matrix_driver.flush(); -} - -void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { - rgb_matrix_driver.set_color(index, red, green, blue); -} - -void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { -#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) - rgb_matrix_set_color(i, red, green, blue); -#else - rgb_matrix_driver.set_color_all(red, green, blue); -#endif -} - -void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { -#ifndef RGB_MATRIX_SPLIT - if (!is_keyboard_master()) return; -#endif -#if RGB_MATRIX_TIMEOUT > 0 - rgb_anykey_timer = 0; -#endif // RGB_MATRIX_TIMEOUT > 0 - -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - uint8_t led[LED_HITS_TO_REMEMBER]; - uint8_t led_count = 0; - -# if defined(RGB_MATRIX_KEYRELEASES) - if (!pressed) -# elif defined(RGB_MATRIX_KEYPRESSES) - if (pressed) -# endif // defined(RGB_MATRIX_KEYRELEASES) - { - led_count = rgb_matrix_map_row_column_to_led(row, col, led); - } - - if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { - memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count); - memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count); - memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit - memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count); - last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count; - } - - for (uint8_t i = 0; i < led_count; i++) { - uint8_t index = last_hit_buffer.count; - last_hit_buffer.x[index] = g_led_config.point[led[i]].x; - last_hit_buffer.y[index] = g_led_config.point[led[i]].y; - last_hit_buffer.index[index] = led[i]; - last_hit_buffer.tick[index] = 0; - last_hit_buffer.count++; - } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - -#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) -# if defined(RGB_MATRIX_KEYRELEASES) - if (!pressed) -# else - if (pressed) -# endif // defined(RGB_MATRIX_KEYRELEASES) - { - if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { - process_rgb_matrix_typing_heatmap(row, col); - } - } -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) -} - -void rgb_matrix_test(void) { - // Mask out bits 4 and 5 - // Increase the factor to make the test animation slower (and reduce to make it faster) - uint8_t factor = 10; - switch ((g_rgb_timer & (0b11 << factor)) >> factor) { - case 0: { - rgb_matrix_set_color_all(20, 0, 0); - break; - } - case 1: { - rgb_matrix_set_color_all(0, 20, 0); - break; - } - case 2: { - rgb_matrix_set_color_all(0, 0, 20); - break; - } - case 3: { - rgb_matrix_set_color_all(20, 20, 20); - break; - } - } -} - -static bool rgb_matrix_none(effect_params_t *params) { - if (!params->init) { - return false; - } - - rgb_matrix_set_color_all(0, 0, 0); - return false; -} - -static void rgb_task_timers(void) { -#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0 - uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer); -#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0 - rgb_timer_buffer = sync_timer_read32(); - - // Update double buffer timers -#if RGB_MATRIX_TIMEOUT > 0 - if (rgb_anykey_timer + deltaTime <= UINT32_MAX) { - rgb_anykey_timer += deltaTime; - } -#endif // RGB_MATRIX_TIMEOUT > 0 - - // Update double buffer last hit timers -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - uint8_t count = last_hit_buffer.count; - for (uint8_t i = 0; i < count; ++i) { - if (UINT16_MAX - deltaTime < last_hit_buffer.tick[i]) { - last_hit_buffer.count--; - continue; - } - last_hit_buffer.tick[i] += deltaTime; - } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED -} - -static void rgb_task_sync(void) { - eeconfig_flush_rgb_matrix(false); - // next task - if (sync_timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; -} - -static void rgb_task_start(void) { - // reset iter - rgb_effect_params.iter = 0; - - // update double buffers - g_rgb_timer = rgb_timer_buffer; -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - g_last_hit_tracker = last_hit_buffer; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - - // next task - rgb_task_state = RENDERING; -} - -static void rgb_task_render(uint8_t effect) { - bool rendering = false; - rgb_effect_params.init = (effect != rgb_last_effect) || (rgb_matrix_config.enable != rgb_last_enable); - if (rgb_effect_params.flags != rgb_matrix_config.flags) { - rgb_effect_params.flags = rgb_matrix_config.flags; - rgb_matrix_set_color_all(0, 0, 0); - } - - // each effect can opt to do calculations - // and/or request PWM buffer updates. - switch (effect) { - case RGB_MATRIX_NONE: - rendering = rgb_matrix_none(&rgb_effect_params); - break; - -// --------------------------------------------- -// -----Begin rgb effect switch case macros----- -#define RGB_MATRIX_EFFECT(name, ...) \ - case RGB_MATRIX_##name: \ - rendering = name(&rgb_effect_params); \ - break; -#include "rgb_matrix_effects.inc" -#undef RGB_MATRIX_EFFECT - -#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) -# define RGB_MATRIX_EFFECT(name, ...) \ - case RGB_MATRIX_CUSTOM_##name: \ - rendering = name(&rgb_effect_params); \ - break; -# ifdef RGB_MATRIX_CUSTOM_KB -# include "rgb_matrix_kb.inc" -# endif -# ifdef RGB_MATRIX_CUSTOM_USER -# include "rgb_matrix_user.inc" -# endif -# undef RGB_MATRIX_EFFECT -#endif - // -----End rgb effect switch case macros------- - // --------------------------------------------- - - // Factory default magic value - case UINT8_MAX: { - rgb_matrix_test(); - rgb_task_state = FLUSHING; - } - return; - } - - rgb_effect_params.iter++; - - // next task - if (!rendering) { - rgb_task_state = FLUSHING; - if (!rgb_effect_params.init && effect == RGB_MATRIX_NONE) { - // We only need to flush once if we are RGB_MATRIX_NONE - rgb_task_state = SYNCING; - } - } -} - -static void rgb_task_flush(uint8_t effect) { - // update last trackers after the first full render so we can init over several frames - rgb_last_effect = effect; - rgb_last_enable = rgb_matrix_config.enable; - - // update pwm buffers - rgb_matrix_update_pwm_buffers(); - - // next task - rgb_task_state = SYNCING; -} - -void rgb_matrix_task(void) { - rgb_task_timers(); - - // Ideally we would also stop sending zeros to the LED driver PWM buffers - // while suspended and just do a software shutdown. This is a cheap hack for now. - bool suspend_backlight = suspend_state || -#if RGB_MATRIX_TIMEOUT > 0 - (rgb_anykey_timer > (uint32_t)RGB_MATRIX_TIMEOUT) || -#endif // RGB_MATRIX_TIMEOUT > 0 - false; - - uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode; - - switch (rgb_task_state) { - case STARTING: - rgb_task_start(); - break; - case RENDERING: - rgb_task_render(effect); - if (effect) { - // Only run the basic indicators in the last render iteration (default there are 5 iterations) - if (rgb_effect_params.iter == RGB_MATRIX_LED_PROCESS_MAX_ITERATIONS) { - rgb_matrix_indicators(); - } - rgb_matrix_indicators_advanced(&rgb_effect_params); - } - break; - case FLUSHING: - rgb_task_flush(effect); - break; - case SYNCING: - rgb_task_sync(); - break; - } -} - -void rgb_matrix_indicators(void) { - rgb_matrix_indicators_kb(); -} - -__attribute__((weak)) bool rgb_matrix_indicators_kb(void) { - return rgb_matrix_indicators_user(); -} - -__attribute__((weak)) bool rgb_matrix_indicators_user(void) { - return true; -} - -void rgb_matrix_indicators_advanced(effect_params_t *params) { - /* special handling is needed for "params->iter", since it's already been incremented. - * Could move the invocations to rgb_task_render, but then it's missing a few checks - * and not sure which would be better. Otherwise, this should be called from - * rgb_task_render, right before the iter++ line. - */ - RGB_MATRIX_USE_LIMITS_ITER(min, max, params->iter - 1); - rgb_matrix_indicators_advanced_kb(min, max); -} - -__attribute__((weak)) bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { - return rgb_matrix_indicators_advanced_user(led_min, led_max); -} - -__attribute__((weak)) bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - return true; -} - -void rgb_matrix_init(void) { - rgb_matrix_driver.init(); - -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED - g_last_hit_tracker.count = 0; - for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { - g_last_hit_tracker.tick[i] = UINT16_MAX; - } - - last_hit_buffer.count = 0; - for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { - last_hit_buffer.tick[i] = UINT16_MAX; - } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - - if (!eeconfig_is_enabled()) { - dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n"); - eeconfig_init(); - eeconfig_update_rgb_matrix_default(); - } - - eeconfig_init_rgb_matrix(); - if (!rgb_matrix_config.mode) { - dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n"); - eeconfig_update_rgb_matrix_default(); - } - eeconfig_debug_rgb_matrix(); // display current eeprom values -} - -void rgb_matrix_set_suspend_state(bool state) { -#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - if (state && !suspend_state) { // only run if turning off, and only once - rgb_task_render(0); // turn off all LEDs when suspending - rgb_task_flush(0); // and actually flash led state to LEDs - } - suspend_state = state; -#endif -} - -bool rgb_matrix_get_suspend_state(void) { - return suspend_state; -} - -void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) { - rgb_matrix_config.enable ^= 1; - rgb_task_state = STARTING; - eeconfig_flag_rgb_matrix(write_to_eeprom); - dprintf("rgb matrix toggle [%s]: rgb_matrix_config.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.enable); -} -void rgb_matrix_toggle_noeeprom(void) { - rgb_matrix_toggle_eeprom_helper(false); -} -void rgb_matrix_toggle(void) { - rgb_matrix_toggle_eeprom_helper(true); -} - -void rgb_matrix_enable(void) { - rgb_matrix_enable_noeeprom(); - eeconfig_flag_rgb_matrix(true); -} - -void rgb_matrix_enable_noeeprom(void) { - if (!rgb_matrix_config.enable) rgb_task_state = STARTING; - rgb_matrix_config.enable = 1; -} - -void rgb_matrix_disable(void) { - rgb_matrix_disable_noeeprom(); - eeconfig_flag_rgb_matrix(true); -} - -void rgb_matrix_disable_noeeprom(void) { - if (rgb_matrix_config.enable) rgb_task_state = STARTING; - rgb_matrix_config.enable = 0; -} - -uint8_t rgb_matrix_is_enabled(void) { - return rgb_matrix_config.enable; -} - -void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { - if (!rgb_matrix_config.enable) { - return; - } - if (mode < 1) { - rgb_matrix_config.mode = 1; - } else if (mode >= RGB_MATRIX_EFFECT_MAX) { - rgb_matrix_config.mode = RGB_MATRIX_EFFECT_MAX - 1; - } else { - rgb_matrix_config.mode = mode; - } - rgb_task_state = STARTING; - eeconfig_flag_rgb_matrix(write_to_eeprom); - dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode); -} -void rgb_matrix_mode_noeeprom(uint8_t mode) { - rgb_matrix_mode_eeprom_helper(mode, false); -} -void rgb_matrix_mode(uint8_t mode) { - rgb_matrix_mode_eeprom_helper(mode, true); -} - -uint8_t rgb_matrix_get_mode(void) { - return rgb_matrix_config.mode; -} - -void rgb_matrix_step_helper(bool write_to_eeprom) { - uint8_t mode = rgb_matrix_config.mode + 1; - rgb_matrix_mode_eeprom_helper((mode < RGB_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom); -} -void rgb_matrix_step_noeeprom(void) { - rgb_matrix_step_helper(false); -} -void rgb_matrix_step(void) { - rgb_matrix_step_helper(true); -} - -void rgb_matrix_step_reverse_helper(bool write_to_eeprom) { - uint8_t mode = rgb_matrix_config.mode - 1; - rgb_matrix_mode_eeprom_helper((mode < 1) ? RGB_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom); -} -void rgb_matrix_step_reverse_noeeprom(void) { - rgb_matrix_step_reverse_helper(false); -} -void rgb_matrix_step_reverse(void) { - rgb_matrix_step_reverse_helper(true); -} - -void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { - if (!rgb_matrix_config.enable) { - return; - } - rgb_matrix_config.hsv.h = hue; - rgb_matrix_config.hsv.s = sat; - rgb_matrix_config.hsv.v = (val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) ? RGB_MATRIX_MAXIMUM_BRIGHTNESS : val; - eeconfig_flag_rgb_matrix(write_to_eeprom); - dprintf("rgb matrix set hsv [%s]: %u,%u,%u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); -} -void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { - rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false); -} -void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { - rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); -} - -HSV rgb_matrix_get_hsv(void) { - return rgb_matrix_config.hsv; -} -uint8_t rgb_matrix_get_hue(void) { - return rgb_matrix_config.hsv.h; -} -uint8_t rgb_matrix_get_sat(void) { - return rgb_matrix_config.hsv.s; -} -uint8_t rgb_matrix_get_val(void) { - return rgb_matrix_config.hsv.v; -} - -void rgb_matrix_increase_hue_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h + RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); -} -void rgb_matrix_increase_hue_noeeprom(void) { - rgb_matrix_increase_hue_helper(false); -} -void rgb_matrix_increase_hue(void) { - rgb_matrix_increase_hue_helper(true); -} - -void rgb_matrix_decrease_hue_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h - RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); -} -void rgb_matrix_decrease_hue_noeeprom(void) { - rgb_matrix_decrease_hue_helper(false); -} -void rgb_matrix_decrease_hue(void) { - rgb_matrix_decrease_hue_helper(true); -} - -void rgb_matrix_increase_sat_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); -} -void rgb_matrix_increase_sat_noeeprom(void) { - rgb_matrix_increase_sat_helper(false); -} -void rgb_matrix_increase_sat(void) { - rgb_matrix_increase_sat_helper(true); -} - -void rgb_matrix_decrease_sat_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); -} -void rgb_matrix_decrease_sat_noeeprom(void) { - rgb_matrix_decrease_sat_helper(false); -} -void rgb_matrix_decrease_sat(void) { - rgb_matrix_decrease_sat_helper(true); -} - -void rgb_matrix_increase_val_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); -} -void rgb_matrix_increase_val_noeeprom(void) { - rgb_matrix_increase_val_helper(false); -} -void rgb_matrix_increase_val(void) { - rgb_matrix_increase_val_helper(true); -} - -void rgb_matrix_decrease_val_helper(bool write_to_eeprom) { - rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); -} -void rgb_matrix_decrease_val_noeeprom(void) { - rgb_matrix_decrease_val_helper(false); -} -void rgb_matrix_decrease_val(void) { - rgb_matrix_decrease_val_helper(true); -} - -void rgb_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { - rgb_matrix_config.speed = speed; - eeconfig_flag_rgb_matrix(write_to_eeprom); - dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.speed); -} -void rgb_matrix_set_speed_noeeprom(uint8_t speed) { - rgb_matrix_set_speed_eeprom_helper(speed, false); -} -void rgb_matrix_set_speed(uint8_t speed) { - rgb_matrix_set_speed_eeprom_helper(speed, true); -} - -uint8_t rgb_matrix_get_speed(void) { - return rgb_matrix_config.speed; -} - -void rgb_matrix_increase_speed_helper(bool write_to_eeprom) { - rgb_matrix_set_speed_eeprom_helper(qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); -} -void rgb_matrix_increase_speed_noeeprom(void) { - rgb_matrix_increase_speed_helper(false); -} -void rgb_matrix_increase_speed(void) { - rgb_matrix_increase_speed_helper(true); -} - -void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { - rgb_matrix_set_speed_eeprom_helper(qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); -} -void rgb_matrix_decrease_speed_noeeprom(void) { - rgb_matrix_decrease_speed_helper(false); -} -void rgb_matrix_decrease_speed(void) { - rgb_matrix_decrease_speed_helper(true); -} - -void rgb_matrix_set_flags_eeprom_helper(led_flags_t flags, bool write_to_eeprom) { - rgb_matrix_config.flags = flags; - eeconfig_flag_rgb_matrix(write_to_eeprom); - dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.flags); -} - -led_flags_t rgb_matrix_get_flags(void) { - return rgb_matrix_config.flags; -} - -void rgb_matrix_set_flags(led_flags_t flags) { - rgb_matrix_set_flags_eeprom_helper(flags, true); -} - -void rgb_matrix_set_flags_noeeprom(led_flags_t flags) { - rgb_matrix_set_flags_eeprom_helper(flags, false); -} diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h deleted file mode 100644 index 38040fb0cc..0000000000 --- a/quantum/rgb_matrix/rgb_matrix.h +++ /dev/null @@ -1,271 +0,0 @@ -/* Copyright 2017 Jason Williams - * Copyright 2017 Jack Humbert - * Copyright 2018 Yiancar - * - * 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 . - */ - -#pragma once - -#include -#include -#include "rgb_matrix_types.h" -#include "color.h" -#include "keyboard.h" - -#ifdef IS31FL3731 -# include "is31fl3731.h" -#elif defined(IS31FL3733) -# include "is31fl3733.h" -#elif defined(IS31FL3736) -# include "is31fl3736.h" -#elif defined(IS31FL3737) -# include "is31fl3737.h" -#elif defined(IS31FL3741) -# include "is31fl3741.h" -#elif defined(IS31FLCOMMON) -# include "is31flcommon.h" -#elif defined(CKLED2001) -# include "ckled2001.h" -#elif defined(AW20216) -# include "aw20216.h" -#elif defined(WS2812) -# include "ws2812.h" -#endif - -#ifndef RGB_MATRIX_LED_FLUSH_LIMIT -# define RGB_MATRIX_LED_FLUSH_LIMIT 16 -#endif - -#ifndef RGB_MATRIX_LED_PROCESS_LIMIT -# define RGB_MATRIX_LED_PROCESS_LIMIT ((RGB_MATRIX_LED_COUNT + 4) / 5) -#endif -#define RGB_MATRIX_LED_PROCESS_MAX_ITERATIONS ((RGB_MATRIX_LED_COUNT + RGB_MATRIX_LED_PROCESS_LIMIT - 1) / RGB_MATRIX_LED_PROCESS_LIMIT) - -#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < RGB_MATRIX_LED_COUNT -# if defined(RGB_MATRIX_SPLIT) -# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \ - uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (iter); \ - uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ - if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT; \ - uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ - if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ - if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; -# else -# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \ - uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (iter); \ - uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ - if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT; -# endif -#else -# if defined(RGB_MATRIX_SPLIT) -# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \ - uint8_t min = 0; \ - uint8_t max = RGB_MATRIX_LED_COUNT; \ - const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ - if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ - if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; -# else -# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \ - uint8_t min = 0; \ - uint8_t max = RGB_MATRIX_LED_COUNT; -# endif -#endif - -#define RGB_MATRIX_USE_LIMITS(min, max) RGB_MATRIX_USE_LIMITS_ITER(min, max, params->iter) - -#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ - if (i >= led_min && i < led_max) { \ - rgb_matrix_set_color(i, r, g, b); \ - } - -#define RGB_MATRIX_TEST_LED_FLAGS() \ - if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue - -enum rgb_matrix_effects { - RGB_MATRIX_NONE = 0, - -// -------------------------------------- -// -----Begin rgb effect enum macros----- -#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_##name, -#include "rgb_matrix_effects.inc" -#undef RGB_MATRIX_EFFECT - -#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) -# define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_CUSTOM_##name, -# ifdef RGB_MATRIX_CUSTOM_KB -# include "rgb_matrix_kb.inc" -# endif -# ifdef RGB_MATRIX_CUSTOM_USER -# include "rgb_matrix_user.inc" -# endif -# undef RGB_MATRIX_EFFECT -#endif - // -------------------------------------- - // -----End rgb effect enum macros------- - - RGB_MATRIX_EFFECT_MAX -}; - -void eeconfig_update_rgb_matrix_default(void); -void eeconfig_update_rgb_matrix(void); - -uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i); -uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i); - -void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); -void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); - -void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed); - -void rgb_matrix_task(void); - -// This runs after another backlight effect and replaces -// colors already set -void rgb_matrix_indicators(void); -bool rgb_matrix_indicators_kb(void); -bool rgb_matrix_indicators_user(void); - -void rgb_matrix_indicators_advanced(effect_params_t *params); -bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max); -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max); - -void rgb_matrix_init(void); - -void rgb_matrix_reload_from_eeprom(void); - -void rgb_matrix_set_suspend_state(bool state); -bool rgb_matrix_get_suspend_state(void); -void rgb_matrix_toggle(void); -void rgb_matrix_toggle_noeeprom(void); -void rgb_matrix_enable(void); -void rgb_matrix_enable_noeeprom(void); -void rgb_matrix_disable(void); -void rgb_matrix_disable_noeeprom(void); -uint8_t rgb_matrix_is_enabled(void); -void rgb_matrix_mode(uint8_t mode); -void rgb_matrix_mode_noeeprom(uint8_t mode); -uint8_t rgb_matrix_get_mode(void); -void rgb_matrix_step(void); -void rgb_matrix_step_noeeprom(void); -void rgb_matrix_step_reverse(void); -void rgb_matrix_step_reverse_noeeprom(void); -void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val); -void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); -HSV rgb_matrix_get_hsv(void); -uint8_t rgb_matrix_get_hue(void); -uint8_t rgb_matrix_get_sat(void); -uint8_t rgb_matrix_get_val(void); -void rgb_matrix_increase_hue(void); -void rgb_matrix_increase_hue_noeeprom(void); -void rgb_matrix_decrease_hue(void); -void rgb_matrix_decrease_hue_noeeprom(void); -void rgb_matrix_increase_sat(void); -void rgb_matrix_increase_sat_noeeprom(void); -void rgb_matrix_decrease_sat(void); -void rgb_matrix_decrease_sat_noeeprom(void); -void rgb_matrix_increase_val(void); -void rgb_matrix_increase_val_noeeprom(void); -void rgb_matrix_decrease_val(void); -void rgb_matrix_decrease_val_noeeprom(void); -void rgb_matrix_set_speed(uint8_t speed); -void rgb_matrix_set_speed_noeeprom(uint8_t speed); -uint8_t rgb_matrix_get_speed(void); -void rgb_matrix_increase_speed(void); -void rgb_matrix_increase_speed_noeeprom(void); -void rgb_matrix_decrease_speed(void); -void rgb_matrix_decrease_speed_noeeprom(void); -led_flags_t rgb_matrix_get_flags(void); -void rgb_matrix_set_flags(led_flags_t flags); -void rgb_matrix_set_flags_noeeprom(led_flags_t flags); - -#ifndef RGBLIGHT_ENABLE -# define eeconfig_update_rgblight_current eeconfig_update_rgb_matrix -# define rgblight_reload_from_eeprom rgb_matrix_reload_from_eeprom -# define rgblight_toggle rgb_matrix_toggle -# define rgblight_toggle_noeeprom rgb_matrix_toggle_noeeprom -# define rgblight_enable rgb_matrix_enable -# define rgblight_enable_noeeprom rgb_matrix_enable_noeeprom -# define rgblight_disable rgb_matrix_disable -# define rgblight_disable_noeeprom rgb_matrix_disable_noeeprom -# define rgblight_is_enabled rgb_matrix_is_enabled -# define rgblight_mode rgb_matrix_mode -# define rgblight_mode_noeeprom rgb_matrix_mode_noeeprom -# define rgblight_get_mode rgb_matrix_get_mode -# define rgblight_get_hue rgb_matrix_get_hue -# define rgblight_get_sat rgb_matrix_get_sat -# define rgblight_get_val rgb_matrix_get_val -# define rgblight_get_hsv rgb_matrix_get_hsv -# define rgblight_step rgb_matrix_step -# define rgblight_step_noeeprom rgb_matrix_step_noeeprom -# define rgblight_step_reverse rgb_matrix_step_reverse -# define rgblight_step_reverse_noeeprom rgb_matrix_step_reverse_noeeprom -# define rgblight_sethsv rgb_matrix_sethsv -# define rgblight_sethsv_noeeprom rgb_matrix_sethsv_noeeprom -# define rgblight_increase_hue rgb_matrix_increase_hue -# define rgblight_increase_hue_noeeprom rgb_matrix_increase_hue_noeeprom -# define rgblight_decrease_hue rgb_matrix_decrease_hue -# define rgblight_decrease_hue_noeeprom rgb_matrix_decrease_hue_noeeprom -# define rgblight_increase_sat rgb_matrix_increase_sat -# define rgblight_increase_sat_noeeprom rgb_matrix_increase_sat_noeeprom -# define rgblight_decrease_sat rgb_matrix_decrease_sat -# define rgblight_decrease_sat_noeeprom rgb_matrix_decrease_sat_noeeprom -# define rgblight_increase_val rgb_matrix_increase_val -# define rgblight_increase_val_noeeprom rgb_matrix_increase_val_noeeprom -# define rgblight_decrease_val rgb_matrix_decrease_val -# define rgblight_decrease_val_noeeprom rgb_matrix_decrease_val_noeeprom -# define rgblight_set_speed rgb_matrix_set_speed -# define rgblight_set_speed_noeeprom rgb_matrix_set_speed_noeeprom -# define rgblight_get_speed rgb_matrix_get_speed -# define rgblight_increase_speed rgb_matrix_increase_speed -# define rgblight_increase_speed_noeeprom rgb_matrix_increase_speed_noeeprom -# define rgblight_decrease_speed rgb_matrix_decrease_speed -# define rgblight_decrease_speed_noeeprom rgb_matrix_decrease_speed_noeeprom -#endif - -typedef struct { - /* Perform any initialisation required for the other driver functions to work. */ - void (*init)(void); - /* Set the colour of a single LED in the buffer. */ - void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b); - /* Set the colour of all LEDS on the keyboard in the buffer. */ - void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b); - /* Flush any buffered changes to the hardware. */ - void (*flush)(void); -} rgb_matrix_driver_t; - -static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { -#if defined(RGB_MATRIX_SPLIT) - if (is_keyboard_left()) { - uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; - return led_idx < k_rgb_matrix_split[0]; - } else - return led_idx < RGB_MATRIX_LED_COUNT; -#else - return led_idx < RGB_MATRIX_LED_COUNT; -#endif -} - -extern const rgb_matrix_driver_t rgb_matrix_driver; - -extern rgb_config_t rgb_matrix_config; - -extern uint32_t g_rgb_timer; -extern led_config_t g_led_config; -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -extern last_hit_t g_last_hit_tracker; -#endif -#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS -extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS]; -#endif diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c deleted file mode 100644 index 695ecc78a4..0000000000 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ /dev/null @@ -1,483 +0,0 @@ -/* Copyright 2018 James Laird-Wah - * - * 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 . - */ - -#include "rgb_matrix.h" -#include "util.h" - -/* Each driver needs to define the struct - * const rgb_matrix_driver_t rgb_matrix_driver; - * All members must be provided. - * Keyboard custom drivers can define this in their own files, it should only - * be here if shared between boards. - */ - -#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3736) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001) -# include "i2c_master.h" - -// TODO: Remove this at some later date -# if defined(DRIVER_ADDR_1) && defined(DRIVER_ADDR_2) -# if DRIVER_ADDR_1 == DRIVER_ADDR_2 -# error "Setting DRIVER_ADDR_2 == DRIVER_ADDR_1 is obsolete. If you are only using one ISSI driver, set DRIVER_COUNT to 1 and remove DRIVER_ADDR_2" -# endif -# endif - -static void init(void) { - i2c_init(); - -# if defined(IS31FL3731) - is31fl3731_init(DRIVER_ADDR_1); -# if defined(DRIVER_ADDR_2) - is31fl3731_init(DRIVER_ADDR_2); -# if defined(DRIVER_ADDR_3) - is31fl3731_init(DRIVER_ADDR_3); -# if defined(DRIVER_ADDR_4) - is31fl3731_init(DRIVER_ADDR_4); -# endif -# endif -# endif - -# elif defined(IS31FL3733) -# if !defined(DRIVER_SYNC_1) -# define DRIVER_SYNC_1 0 -# endif - is31fl3733_init(DRIVER_ADDR_1, DRIVER_SYNC_1); -# if defined(DRIVER_ADDR_2) -# if !defined(DRIVER_SYNC_2) -# define DRIVER_SYNC_2 0 -# endif - is31fl3733_init(DRIVER_ADDR_2, DRIVER_SYNC_2); -# if defined(DRIVER_ADDR_3) -# if !defined(DRIVER_SYNC_3) -# define DRIVER_SYNC_3 0 -# endif - is31fl3733_init(DRIVER_ADDR_3, DRIVER_SYNC_3); -# if defined(DRIVER_ADDR_4) -# if !defined(DRIVER_SYNC_4) -# define DRIVER_SYNC_4 0 -# endif - is31fl3733_init(DRIVER_ADDR_4, DRIVER_SYNC_4); -# endif -# endif -# endif - -# elif defined(IS31FL3736) - is31fl3736_init(DRIVER_ADDR_1); -# if defined(DRIVER_ADDR_2) - is31fl3736_init(DRIVER_ADDR_2); -# if defined(DRIVER_ADDR_3) - is31fl3736_init(DRIVER_ADDR_3); -# if defined(DRIVER_ADDR_4) - is31fl3736_init(DRIVER_ADDR_4); -# endif -# endif -# endif - -# elif defined(IS31FL3737) - is31fl3737_init(DRIVER_ADDR_1); -# if defined(DRIVER_ADDR_2) - is31fl3737_init(DRIVER_ADDR_2); -# if defined(DRIVER_ADDR_3) - is31fl3737_init(DRIVER_ADDR_3); -# if defined(DRIVER_ADDR_4) - is31fl3737_init(DRIVER_ADDR_4); -# endif -# endif -# endif - -# elif defined(IS31FL3741) - is31fl3741_init(DRIVER_ADDR_1); -# if defined(DRIVER_ADDR_2) - is31fl3741_init(DRIVER_ADDR_2); -# if defined(DRIVER_ADDR_3) - is31fl3741_init(DRIVER_ADDR_3); -# if defined(DRIVER_ADDR_4) - is31fl3741_init(DRIVER_ADDR_4); -# endif -# endif -# endif - -# elif defined(IS31FLCOMMON) - IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); -# if defined(DRIVER_ADDR_2) - IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); -# if defined(DRIVER_ADDR_3) - IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); -# if defined(DRIVER_ADDR_4) - IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); -# endif -# endif -# endif - -# elif defined(CKLED2001) - ckled2001_init(DRIVER_ADDR_1); -# if defined(DRIVER_ADDR_2) - ckled2001_init(DRIVER_ADDR_2); -# if defined(DRIVER_ADDR_3) - ckled2001_init(DRIVER_ADDR_3); -# if defined(DRIVER_ADDR_4) - ckled2001_init(DRIVER_ADDR_4); -# endif -# endif -# endif -# endif - - for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) { - bool enabled = true; - - // This only caches it for later -# if defined(IS31FL3731) - is31fl3731_set_led_control_register(index, enabled, enabled, enabled); -# elif defined(IS31FL3733) - is31fl3733_set_led_control_register(index, enabled, enabled, enabled); -# elif defined(IS31FL3736) - is31fl3736_set_led_control_register(index, enabled, enabled, enabled); -# elif defined(IS31FL3737) - is31fl3737_set_led_control_register(index, enabled, enabled, enabled); -# elif defined(IS31FL3741) - is31fl3741_set_led_control_register(index, enabled, enabled, enabled); -# elif defined(IS31FLCOMMON) - IS31FL_RGB_set_scaling_buffer(index, enabled, enabled, enabled); -# elif defined(CKLED2001) - ckled2001_set_led_control_register(index, enabled, enabled, enabled); -# endif - } - - // This actually updates the LED drivers -# if defined(IS31FL3731) - is31fl3731_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3731_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3731_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3731_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(IS31FL3733) - is31fl3733_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3733_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3733_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3733_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(IS31FL3736) - is31fl3736_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3736_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3736_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3736_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(IS31FL3737) - is31fl3737_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3737_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3737_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3737_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(IS31FL3741) - is31fl3741_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3741_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3741_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3741_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(IS31FLCOMMON) -# ifdef ISSI_MANUAL_SCALING - IS31FL_set_manual_scaling_buffer(); -# endif - IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); -# endif -# endif -# endif - -# elif defined(CKLED2001) - ckled2001_update_led_control_registers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - ckled2001_update_led_control_registers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - ckled2001_update_led_control_registers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - ckled2001_update_led_control_registers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -# endif -} - -# if defined(IS31FL3731) -static void flush(void) { - is31fl3731_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3731_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3731_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3731_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3731_set_color, - .set_color_all = is31fl3731_set_color_all, -}; - -# elif defined(IS31FL3733) -static void flush(void) { - is31fl3733_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3733_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3733_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3733_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3733_set_color, - .set_color_all = is31fl3733_set_color_all, -}; - -# elif defined(IS31FL3736) -static void flush(void) { - is31fl3736_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3736_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3736_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3736_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3736_set_color, - .set_color_all = is31fl3736_set_color_all, -}; - -# elif defined(IS31FL3737) -static void flush(void) { - is31fl3737_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3737_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3737_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3737_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3737_set_color, - .set_color_all = is31fl3737_set_color_all, -}; - -# elif defined(IS31FL3741) -static void flush(void) { - is31fl3741_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - is31fl3741_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - is31fl3741_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - is31fl3741_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3741_set_color, - .set_color_all = is31fl3741_set_color_all, -}; - -# elif defined(IS31FLCOMMON) -static void flush(void) { - IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = IS31FL_RGB_set_color, - .set_color_all = IS31FL_RGB_set_color_all, -}; - -# elif defined(CKLED2001) -static void flush(void) { - ckled2001_update_pwm_buffers(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - ckled2001_update_pwm_buffers(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - ckled2001_update_pwm_buffers(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - ckled2001_update_pwm_buffers(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = ckled2001_set_color, - .set_color_all = ckled2001_set_color_all, -}; -# endif - -#elif defined(AW20216) -# include "spi_master.h" - -static void init(void) { - spi_init(); - - aw20216_init(DRIVER_1_CS, DRIVER_1_EN); -# if defined(DRIVER_2_CS) - aw20216_init(DRIVER_2_CS, DRIVER_2_EN); -# endif -} - -static void flush(void) { - aw20216_update_pwm_buffers(DRIVER_1_CS, 0); -# if defined(DRIVER_2_CS) - aw20216_update_pwm_buffers(DRIVER_2_CS, 1); -# endif -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = aw20216_set_color, - .set_color_all = aw20216_set_color_all, -}; - -#elif defined(WS2812) -# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_CUSTOM_DRIVER) -# pragma message "Cannot use RGBLIGHT and RGB Matrix using WS2812 at the same time." -# pragma message "You need to use a custom driver, or re-implement the WS2812 driver to use a different configuration." -# endif - -// LED color buffer -LED_TYPE rgb_matrix_ws2812_array[RGB_MATRIX_LED_COUNT]; -bool ws2812_dirty = false; - -static void init(void) { - ws2812_dirty = false; -} - -static void flush(void) { - if (ws2812_dirty) { - ws2812_setleds(rgb_matrix_ws2812_array, RGB_MATRIX_LED_COUNT); - ws2812_dirty = false; - } -} - -// Set an led in the buffer to a color -static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) { -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; - if (!is_keyboard_left()) { - if (i >= k_rgb_matrix_split[0]) { - i -= k_rgb_matrix_split[0]; - } else { - return; - } - } else if (i >= k_rgb_matrix_split[0]) { - return; - } -# endif - - if (rgb_matrix_ws2812_array[i].r == r && rgb_matrix_ws2812_array[i].g == g && rgb_matrix_ws2812_array[i].b == b) { - return; - } - - ws2812_dirty = true; - rgb_matrix_ws2812_array[i].r = r; - rgb_matrix_ws2812_array[i].g = g; - rgb_matrix_ws2812_array[i].b = b; -# ifdef RGBW - convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]); -# endif -} - -static void setled_all(uint8_t r, uint8_t g, uint8_t b) { - for (int i = 0; i < ARRAY_SIZE(rgb_matrix_ws2812_array); i++) { - setled(i, r, g, b); - } -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = setled, - .set_color_all = setled_all, -}; -#endif diff --git a/quantum/rgb_matrix/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h deleted file mode 100644 index 53ff7321b8..0000000000 --- a/quantum/rgb_matrix/rgb_matrix_types.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2021 - * - * 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 . - */ - -#pragma once - -#include -#include -#include "color.h" - -#if defined(__GNUC__) -# define PACKED __attribute__((__packed__)) -#else -# define PACKED -#endif - -#if defined(_MSC_VER) -# pragma pack(push, 1) -#endif - -#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES) -# define RGB_MATRIX_KEYREACTIVE_ENABLED -#endif - -// Last led hit -#ifndef LED_HITS_TO_REMEMBER -# define LED_HITS_TO_REMEMBER 8 -#endif // LED_HITS_TO_REMEMBER - -#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED -typedef struct PACKED { - uint8_t count; - uint8_t x[LED_HITS_TO_REMEMBER]; - uint8_t y[LED_HITS_TO_REMEMBER]; - uint8_t index[LED_HITS_TO_REMEMBER]; - uint16_t tick[LED_HITS_TO_REMEMBER]; -} last_hit_t; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED - -typedef enum rgb_task_states { STARTING, RENDERING, FLUSHING, SYNCING } rgb_task_states; - -typedef uint8_t led_flags_t; - -typedef struct PACKED { - uint8_t iter; - led_flags_t flags; - bool init; -} effect_params_t; - -typedef struct PACKED { - uint8_t x; - uint8_t y; -} led_point_t; - -#define HAS_FLAGS(bits, flags) ((bits & flags) == flags) -#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00) - -#define LED_FLAG_ALL 0xFF -#define LED_FLAG_NONE 0x00 -#define LED_FLAG_MODIFIER 0x01 -#define LED_FLAG_UNDERGLOW 0x02 -#define LED_FLAG_KEYLIGHT 0x04 -#define LED_FLAG_INDICATOR 0x08 - -#define NO_LED 255 - -typedef struct PACKED { - uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS]; - led_point_t point[RGB_MATRIX_LED_COUNT]; - uint8_t flags[RGB_MATRIX_LED_COUNT]; -} led_config_t; - -typedef union { - uint64_t raw; - struct PACKED { - uint8_t enable : 2; - uint8_t mode : 6; - HSV hsv; - uint8_t speed; - led_flags_t flags; - }; -} rgb_config_t; - -_Static_assert(sizeof(rgb_config_t) == sizeof(uint64_t), "RGB Matrix EECONFIG out of spec."); - -#if defined(_MSC_VER) -# pragma pack(pop) -#endif diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c deleted file mode 100644 index 158112f31d..0000000000 --- a/quantum/rgblight/rgblight.c +++ /dev/null @@ -1,1521 +0,0 @@ -/* Copyright 2016-2017 Yang Liu - * - * 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 . - */ -#include -#include -#include -#include "progmem.h" -#include "sync_timer.h" -#include "rgblight.h" -#include "color.h" -#include "debug.h" -#include "util.h" -#include "led_tables.h" -#include -#ifdef EEPROM_ENABLE -# include "eeprom.h" -#endif -#ifdef VELOCIKEY_ENABLE -# include "velocikey.h" -#endif - -#ifdef RGBLIGHT_SPLIT -/* for split keyboard */ -# define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE -# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS -# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS rgblight_status.change_flags |= (RGBLIGHT_STATUS_CHANGE_MODE | RGBLIGHT_STATUS_CHANGE_HSVS) -# define RGBLIGHT_SPLIT_SET_CHANGE_LAYERS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_LAYERS -# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER -# define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK -#else -# define RGBLIGHT_SPLIT_SET_CHANGE_MODE -# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS -# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS -# define RGBLIGHT_SPLIT_SET_CHANGE_LAYERS -# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE -# define RGBLIGHT_SPLIT_ANIMATION_TICK -#endif - -#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_SINGLE_DYNAMIC(sym) -#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_MULTI_DYNAMIC(sym) -#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##sym, -#define _RGBM_TMP_DYNAMIC(sym, msym) -static uint8_t static_effect_table[] = { -#include "rgblight_modes.h" -}; - -#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##msym, -#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##msym, -static uint8_t mode_base_table[] = { - 0, // RGBLIGHT_MODE_zero -#include "rgblight_modes.h" -}; - -#if !defined(RGBLIGHT_DEFAULT_MODE) -# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT -#endif - -#if !defined(RGBLIGHT_DEFAULT_HUE) -# define RGBLIGHT_DEFAULT_HUE 0 -#endif - -#if !defined(RGBLIGHT_DEFAULT_SAT) -# define RGBLIGHT_DEFAULT_SAT UINT8_MAX -#endif - -#if !defined(RGBLIGHT_DEFAULT_VAL) -# define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL -#endif - -#if !defined(RGBLIGHT_DEFAULT_SPD) -# define RGBLIGHT_DEFAULT_SPD 0 -#endif - -static inline int is_static_effect(uint8_t mode) { - return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; -} - -#ifdef RGBLIGHT_LED_MAP -const uint8_t led_map[] PROGMEM = RGBLIGHT_LED_MAP; -#endif - -#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT -__attribute__((weak)) const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64}; -#endif - -rgblight_config_t rgblight_config; -rgblight_status_t rgblight_status = {.timer_enabled = false}; -bool is_rgblight_initialized = false; - -#ifdef RGBLIGHT_SLEEP -static bool is_suspended; -static bool pre_suspend_enabled; -#endif - -#ifdef RGBLIGHT_USE_TIMER -animation_status_t animation_status = {}; -#endif - -#ifndef LED_ARRAY -LED_TYPE led[RGBLED_NUM]; -# define LED_ARRAY led -#endif - -#ifdef RGBLIGHT_LAYERS -rgblight_segment_t const *const *rgblight_layers = NULL; - -static bool deferred_set_layer_state = false; -#endif - -rgblight_ranges_t rgblight_ranges = {0, RGBLED_NUM, 0, RGBLED_NUM, RGBLED_NUM}; - -void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) { - rgblight_ranges.clipping_start_pos = start_pos; - rgblight_ranges.clipping_num_leds = num_leds; -} - -void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) { - if (start_pos >= RGBLED_NUM) return; - if (start_pos + num_leds > RGBLED_NUM) return; - rgblight_ranges.effect_start_pos = start_pos; - rgblight_ranges.effect_end_pos = start_pos + num_leds; - rgblight_ranges.effect_num_leds = num_leds; -} - -__attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) { - return hsv_to_rgb(hsv); -} - -void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { - HSV hsv = {hue, sat, val}; - RGB rgb = rgblight_hsv_to_rgb(hsv); - setrgb(rgb.r, rgb.g, rgb.b, led1); -} - -void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { - sethsv_raw(hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val, led1); -} - -void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) { - led1->r = r; - led1->g = g; - led1->b = b; -#ifdef RGBW - led1->w = 0; -#endif -} - -void rgblight_check_config(void) { - /* Add some out of bound checks for RGB light config */ - - if (rgblight_config.mode < RGBLIGHT_MODE_STATIC_LIGHT) { - rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; - } else if (rgblight_config.mode > RGBLIGHT_MODES) { - rgblight_config.mode = RGBLIGHT_MODES; - } - - if (rgblight_config.val > RGBLIGHT_LIMIT_VAL) { - rgblight_config.val = RGBLIGHT_LIMIT_VAL; - } -} - -uint64_t eeconfig_read_rgblight(void) { -#ifdef EEPROM_ENABLE - return (uint64_t)((eeprom_read_dword(EECONFIG_RGBLIGHT)) | ((uint64_t)eeprom_read_byte(EECONFIG_RGBLIGHT_EXTENDED) << 32)); -#else - return 0; -#endif -} - -void eeconfig_update_rgblight(uint64_t val) { -#ifdef EEPROM_ENABLE - rgblight_check_config(); - eeprom_update_dword(EECONFIG_RGBLIGHT, val & 0xFFFFFFFF); - eeprom_update_byte(EECONFIG_RGBLIGHT_EXTENDED, (val >> 32) & 0xFF); -#endif -} - -void eeconfig_update_rgblight_current(void) { - eeconfig_update_rgblight(rgblight_config.raw); -} - -void eeconfig_update_rgblight_default(void) { - rgblight_config.enable = 1; - rgblight_config.mode = RGBLIGHT_DEFAULT_MODE; - rgblight_config.hue = RGBLIGHT_DEFAULT_HUE; - rgblight_config.sat = RGBLIGHT_DEFAULT_SAT; - rgblight_config.val = RGBLIGHT_DEFAULT_VAL; - rgblight_config.speed = RGBLIGHT_DEFAULT_SPD; - RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; - eeconfig_update_rgblight(rgblight_config.raw); -} - -void eeconfig_debug_rgblight(void) { - dprintf("rgblight_config EEPROM:\n"); - dprintf("rgblight_config.enable = %d\n", rgblight_config.enable); - dprintf("rghlight_config.mode = %d\n", rgblight_config.mode); - dprintf("rgblight_config.hue = %d\n", rgblight_config.hue); - dprintf("rgblight_config.sat = %d\n", rgblight_config.sat); - dprintf("rgblight_config.val = %d\n", rgblight_config.val); - dprintf("rgblight_config.speed = %d\n", rgblight_config.speed); -} - -void rgblight_init(void) { - /* if already initialized, don't do it again. - If you must do it again, extern this and set to false, first. - This is a dirty, dirty hack until proper hooks can be added for keyboard startup. */ - if (is_rgblight_initialized) { - return; - } - - dprintf("rgblight_init called.\n"); - dprintf("rgblight_init start!\n"); - if (!eeconfig_is_enabled()) { - dprintf("rgblight_init eeconfig is not enabled.\n"); - eeconfig_init(); - eeconfig_update_rgblight_default(); - } - rgblight_config.raw = eeconfig_read_rgblight(); - RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; - if (!rgblight_config.mode) { - dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); - eeconfig_update_rgblight_default(); - rgblight_config.raw = eeconfig_read_rgblight(); - } - rgblight_check_config(); - - eeconfig_debug_rgblight(); // display current eeprom values - - rgblight_timer_init(); // setup the timer - - if (rgblight_config.enable) { - rgblight_mode_noeeprom(rgblight_config.mode); - } - - is_rgblight_initialized = true; -} - -void rgblight_reload_from_eeprom(void) { - /* Reset back to what we have in eeprom */ - rgblight_config.raw = eeconfig_read_rgblight(); - RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; - rgblight_check_config(); - eeconfig_debug_rgblight(); // display current eeprom values - if (rgblight_config.enable) { - rgblight_mode_noeeprom(rgblight_config.mode); - } -} - -uint64_t rgblight_read_qword(void) { - return rgblight_config.raw; -} - -void rgblight_update_qword(uint64_t qword) { - RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; - rgblight_config.raw = qword; - if (rgblight_config.enable) - rgblight_mode_noeeprom(rgblight_config.mode); - else { - rgblight_timer_disable(); - rgblight_set(); - } -} - -void rgblight_increase(void) { - uint8_t mode = 0; - if (rgblight_config.mode < RGBLIGHT_MODES) { - mode = rgblight_config.mode + 1; - } - rgblight_mode(mode); -} -void rgblight_decrease(void) { - uint8_t mode = 0; - // Mode will never be < 1. If it ever is, eeprom needs to be initialized. - if (rgblight_config.mode > RGBLIGHT_MODE_STATIC_LIGHT) { - mode = rgblight_config.mode - 1; - } - rgblight_mode(mode); -} -void rgblight_step_helper(bool write_to_eeprom) { - uint8_t mode = 0; - mode = rgblight_config.mode + 1; - if (mode > RGBLIGHT_MODES) { - mode = 1; - } - rgblight_mode_eeprom_helper(mode, write_to_eeprom); -} -void rgblight_step_noeeprom(void) { - rgblight_step_helper(false); -} -void rgblight_step(void) { - rgblight_step_helper(true); -} -void rgblight_step_reverse_helper(bool write_to_eeprom) { - uint8_t mode = 0; - mode = rgblight_config.mode - 1; - if (mode < 1) { - mode = RGBLIGHT_MODES; - } - rgblight_mode_eeprom_helper(mode, write_to_eeprom); -} -void rgblight_step_reverse_noeeprom(void) { - rgblight_step_reverse_helper(false); -} -void rgblight_step_reverse(void) { - rgblight_step_reverse_helper(true); -} - -uint8_t rgblight_get_mode(void) { - if (!rgblight_config.enable) { - return false; - } - - return rgblight_config.mode; -} - -void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { - if (!rgblight_config.enable) { - return; - } - if (mode < RGBLIGHT_MODE_STATIC_LIGHT) { - rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; - } else if (mode > RGBLIGHT_MODES) { - rgblight_config.mode = RGBLIGHT_MODES; - } else { - rgblight_config.mode = mode; - } - RGBLIGHT_SPLIT_SET_CHANGE_MODE; - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - dprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); - } else { - dprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); - } - if (is_static_effect(rgblight_config.mode)) { - rgblight_timer_disable(); - } else { - rgblight_timer_enable(); - } -#ifdef RGBLIGHT_USE_TIMER - animation_status.restart = true; -#endif - rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); -} - -void rgblight_mode(uint8_t mode) { - rgblight_mode_eeprom_helper(mode, true); -} - -void rgblight_mode_noeeprom(uint8_t mode) { - rgblight_mode_eeprom_helper(mode, false); -} - -void rgblight_toggle(void) { - dprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); - if (rgblight_config.enable) { - rgblight_disable(); - } else { - rgblight_enable(); - } -} - -void rgblight_toggle_noeeprom(void) { - dprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); - if (rgblight_config.enable) { - rgblight_disable_noeeprom(); - } else { - rgblight_enable_noeeprom(); - } -} - -void rgblight_enable(void) { - rgblight_config.enable = 1; - // No need to update EEPROM here. rgblight_mode() will do that, actually - // eeconfig_update_rgblight(rgblight_config.raw); - dprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_mode(rgblight_config.mode); -} - -void rgblight_enable_noeeprom(void) { - rgblight_config.enable = 1; - dprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_mode_noeeprom(rgblight_config.mode); -} - -void rgblight_disable(void) { - rgblight_config.enable = 0; - eeconfig_update_rgblight(rgblight_config.raw); - dprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_timer_disable(); - RGBLIGHT_SPLIT_SET_CHANGE_MODE; - rgblight_set(); -} - -void rgblight_disable_noeeprom(void) { - rgblight_config.enable = 0; - dprintf("rgblight disable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_timer_disable(); - RGBLIGHT_SPLIT_SET_CHANGE_MODE; - rgblight_set(); -} - -void rgblight_enabled_noeeprom(bool state) { - state ? rgblight_enable_noeeprom() : rgblight_disable_noeeprom(); -} - -bool rgblight_is_enabled(void) { - return rgblight_config.enable; -} - -void rgblight_increase_hue_helper(bool write_to_eeprom) { - uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP; - rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); -} -void rgblight_increase_hue_noeeprom(void) { - rgblight_increase_hue_helper(false); -} -void rgblight_increase_hue(void) { - rgblight_increase_hue_helper(true); -} -void rgblight_decrease_hue_helper(bool write_to_eeprom) { - uint8_t hue = rgblight_config.hue - RGBLIGHT_HUE_STEP; - rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); -} -void rgblight_decrease_hue_noeeprom(void) { - rgblight_decrease_hue_helper(false); -} -void rgblight_decrease_hue(void) { - rgblight_decrease_hue_helper(true); -} -void rgblight_increase_sat_helper(bool write_to_eeprom) { - uint8_t sat = qadd8(rgblight_config.sat, RGBLIGHT_SAT_STEP); - rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); -} -void rgblight_increase_sat_noeeprom(void) { - rgblight_increase_sat_helper(false); -} -void rgblight_increase_sat(void) { - rgblight_increase_sat_helper(true); -} -void rgblight_decrease_sat_helper(bool write_to_eeprom) { - uint8_t sat = qsub8(rgblight_config.sat, RGBLIGHT_SAT_STEP); - rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); -} -void rgblight_decrease_sat_noeeprom(void) { - rgblight_decrease_sat_helper(false); -} -void rgblight_decrease_sat(void) { - rgblight_decrease_sat_helper(true); -} -void rgblight_increase_val_helper(bool write_to_eeprom) { - uint8_t val = qadd8(rgblight_config.val, RGBLIGHT_VAL_STEP); - rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); -} -void rgblight_increase_val_noeeprom(void) { - rgblight_increase_val_helper(false); -} -void rgblight_increase_val(void) { - rgblight_increase_val_helper(true); -} -void rgblight_decrease_val_helper(bool write_to_eeprom) { - uint8_t val = qsub8(rgblight_config.val, RGBLIGHT_VAL_STEP); - rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); -} -void rgblight_decrease_val_noeeprom(void) { - rgblight_decrease_val_helper(false); -} -void rgblight_decrease_val(void) { - rgblight_decrease_val_helper(true); -} - -void rgblight_increase_speed_helper(bool write_to_eeprom) { - if (rgblight_config.speed < 3) rgblight_config.speed++; - // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - } -} -void rgblight_increase_speed(void) { - rgblight_increase_speed_helper(true); -} -void rgblight_increase_speed_noeeprom(void) { - rgblight_increase_speed_helper(false); -} - -void rgblight_decrease_speed_helper(bool write_to_eeprom) { - if (rgblight_config.speed > 0) rgblight_config.speed--; - // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?? - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - } -} -void rgblight_decrease_speed(void) { - rgblight_decrease_speed_helper(true); -} -void rgblight_decrease_speed_noeeprom(void) { - rgblight_decrease_speed_helper(false); -} - -void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { - if (rgblight_config.enable) { - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); - } -} - -void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { - if (rgblight_config.enable) { -#ifdef RGBLIGHT_SPLIT - if (rgblight_config.hue != hue || rgblight_config.sat != sat || rgblight_config.val != val) { - RGBLIGHT_SPLIT_SET_CHANGE_HSVS; - } -#endif - rgblight_status.base_mode = mode_base_table[rgblight_config.mode]; - if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { - // same static color - LED_TYPE tmp_led; -#ifdef RGBLIGHT_LAYERS_RETAIN_VAL - // needed for rgblight_layers_write() to get the new val, since it reads rgblight_config.val - rgblight_config.val = val; -#endif - sethsv(hue, sat, val, &tmp_led); - rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); - } else { - // all LEDs in same color - if (1 == 0) { // dummy - } -#ifdef RGBLIGHT_EFFECT_BREATHING - else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { - // breathing mode, ignore the change of val, use in memory value instead - val = rgblight_config.val; - } -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { - // rainbow mood, ignore the change of hue - hue = rgblight_config.hue; - } -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { - // rainbow swirl, ignore the change of hue - hue = rgblight_config.hue; - } -#endif -#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT - else if (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) { - // static gradient - uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; - bool direction = (delta % 2) == 0; - - uint8_t range = pgm_read_byte(&RGBLED_GRADIENT_RANGES[delta / 2]); - for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { - uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds; - if (direction) { - _hue = hue + _hue; - } else { - _hue = hue - _hue; - } - dprintf("rgblight rainbow set hsv: %d,%d,%d,%u\n", i, _hue, direction, range); - sethsv(_hue, sat, val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]); - } -# ifdef RGBLIGHT_LAYERS_RETAIN_VAL - // needed for rgblight_layers_write() to get the new val, since it reads rgblight_config.val - rgblight_config.val = val; -# endif - rgblight_set(); - } -#endif - } - rgblight_config.hue = hue; - rgblight_config.sat = sat; - rgblight_config.val = val; - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); - } else { - dprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); - } - } -} - -void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_eeprom_helper(hue, sat, val, true); -} - -void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_eeprom_helper(hue, sat, val, false); -} - -uint8_t rgblight_get_speed(void) { - return rgblight_config.speed; -} - -void rgblight_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { - rgblight_config.speed = speed; - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - dprintf("rgblight set speed [EEPROM]: %u\n", rgblight_config.speed); - } else { - dprintf("rgblight set speed [NOEEPROM]: %u\n", rgblight_config.speed); - } -} - -void rgblight_set_speed(uint8_t speed) { - rgblight_set_speed_eeprom_helper(speed, true); -} - -void rgblight_set_speed_noeeprom(uint8_t speed) { - rgblight_set_speed_eeprom_helper(speed, false); -} - -uint8_t rgblight_get_hue(void) { - return rgblight_config.hue; -} - -uint8_t rgblight_get_sat(void) { - return rgblight_config.sat; -} - -uint8_t rgblight_get_val(void) { - return rgblight_config.val; -} - -HSV rgblight_get_hsv(void) { - return (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; -} - -void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { - if (!rgblight_config.enable) { - return; - } - - for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) { - led[i].r = r; - led[i].g = g; - led[i].b = b; -#ifdef RGBW - led[i].w = 0; -#endif - } - rgblight_set(); -} - -void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { - if (!rgblight_config.enable || index >= RGBLED_NUM) { - return; - } - - led[index].r = r; - led[index].g = g; - led[index].b = b; -#ifdef RGBW - led[index].w = 0; -#endif - rgblight_set(); -} - -void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index) { - if (!rgblight_config.enable) { - return; - } - - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index); -} - -#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) || defined(RGBLIGHT_EFFECT_TWINKLE) - -static uint8_t get_interval_time(const uint8_t *default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) { - return -# ifdef VELOCIKEY_ENABLE - velocikey_enabled() ? velocikey_match_speed(velocikey_min, velocikey_max) : -# endif - pgm_read_byte(default_interval_address); -} - -#endif - -void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end) { - if (!rgblight_config.enable || start < 0 || start >= end || end > RGBLED_NUM) { - return; - } - - for (uint8_t i = start; i < end; i++) { - led[i].r = r; - led[i].g = g; - led[i].b = b; -#ifdef RGBW - led[i].w = 0; -#endif - } - rgblight_set(); -} - -void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end) { - if (!rgblight_config.enable) { - return; - } - - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - rgblight_setrgb_range(tmp_led.r, tmp_led.g, tmp_led.b, start, end); -} - -#ifndef RGBLIGHT_SPLIT -void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) { - rgblight_setrgb_range(r, g, b, 0, (uint8_t)RGBLED_NUM / 2); -} - -void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) { - rgblight_setrgb_range(r, g, b, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); -} - -void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_range(hue, sat, val, 0, (uint8_t)RGBLED_NUM / 2); -} - -void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_range(hue, sat, val, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); -} -#endif // ifndef RGBLIGHT_SPLIT - -#ifdef RGBLIGHT_LAYERS -void rgblight_set_layer_state(uint8_t layer, bool enabled) { - rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer; - if (enabled) { - rgblight_status.enabled_layer_mask |= mask; - } else { - rgblight_status.enabled_layer_mask &= ~mask; - } - RGBLIGHT_SPLIT_SET_CHANGE_LAYERS; - - // Calling rgblight_set() here (directly or indirectly) could - // potentially cause timing issues when there are multiple - // successive calls to rgblight_set_layer_state(). Instead, - // set a flag and do it the next time rgblight_task() runs. - - deferred_set_layer_state = true; -} - -bool rgblight_get_layer_state(uint8_t layer) { - rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer; - return (rgblight_status.enabled_layer_mask & mask) != 0; -} - -// Write any enabled LED layers into the buffer -static void rgblight_layers_write(void) { -# ifdef RGBLIGHT_LAYERS_RETAIN_VAL - uint8_t current_val = rgblight_get_val(); -# endif - uint8_t i = 0; - // For each layer - for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) { - if (!rgblight_get_layer_state(i)) { - continue; // Layer is disabled - } - const rgblight_segment_t *segment_ptr = pgm_read_ptr(layer_ptr); - if (segment_ptr == NULL) { - break; // No more layers - } - // For each segment - while (1) { - rgblight_segment_t segment; - memcpy_P(&segment, segment_ptr, sizeof(rgblight_segment_t)); - if (segment.index == RGBLIGHT_END_SEGMENT_INDEX) { - break; // No more segments - } - // Write segment.count LEDs - LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)]; - for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) { -# ifdef RGBLIGHT_LAYERS_RETAIN_VAL - sethsv(segment.hue, segment.sat, current_val, led_ptr); -# else - sethsv(segment.hue, segment.sat, segment.val, led_ptr); -# endif - } - segment_ptr++; - } - } -} - -# ifdef RGBLIGHT_LAYER_BLINK -rgblight_layer_mask_t _blinking_layer_mask = 0; -static uint16_t _repeat_timer; -static uint8_t _times_remaining; -static uint16_t _dur; - -void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { - rgblight_blink_layer_repeat(layer, duration_ms, 1); -} - -void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times) { - if (times > UINT8_MAX / 2) { - times = UINT8_MAX / 2; - } - - _times_remaining = times * 2; - _dur = duration_ms; - - rgblight_set_layer_state(layer, true); - _times_remaining--; - _blinking_layer_mask |= (rgblight_layer_mask_t)1 << layer; - _repeat_timer = sync_timer_read() + duration_ms; -} - -void rgblight_unblink_layer(uint8_t layer) { - rgblight_set_layer_state(layer, false); - _blinking_layer_mask &= ~((rgblight_layer_mask_t)1 << layer); -} - -void rgblight_unblink_all_but_layer(uint8_t layer) { - for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) { - if (i != layer) { - if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << i) != 0) { - rgblight_unblink_layer(i); - } - } - } -} - -void rgblight_blink_layer_repeat_helper(void) { - if (_blinking_layer_mask != 0 && timer_expired(sync_timer_read(), _repeat_timer)) { - for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { - if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0) { - if (_times_remaining % 2 == 1) { - rgblight_set_layer_state(layer, false); - } else { - rgblight_set_layer_state(layer, true); - } - } - } - _times_remaining--; - if (_times_remaining <= 0) { - _blinking_layer_mask = 0; - } else { - _repeat_timer = sync_timer_read() + _dur; - } - } -} -# endif - -#endif - -#ifdef RGBLIGHT_SLEEP - -void rgblight_suspend(void) { - rgblight_timer_disable(); - if (!is_suspended) { - is_suspended = true; - pre_suspend_enabled = rgblight_config.enable; - -# ifdef RGBLIGHT_LAYER_BLINK - // make sure any layer blinks don't come back after suspend - rgblight_status.enabled_layer_mask &= ~_blinking_layer_mask; - _blinking_layer_mask = 0; -# endif - - rgblight_disable_noeeprom(); - } -} - -void rgblight_wakeup(void) { - is_suspended = false; - - if (pre_suspend_enabled) { - rgblight_enable_noeeprom(); - } -# ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF - // Need this or else the LEDs won't be set - else if (rgblight_status.enabled_layer_mask != 0) { - rgblight_set(); - } -# endif - - rgblight_timer_enable(); -} - -#endif - -__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { - ws2812_setleds(start_led, num_leds); -} - -#ifndef RGBLIGHT_CUSTOM_DRIVER - -void rgblight_set(void) { - LED_TYPE *start_led; - uint8_t num_leds = rgblight_ranges.clipping_num_leds; - - if (!rgblight_config.enable) { - for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; -# ifdef RGBW - led[i].w = 0; -# endif - } - } - -# ifdef RGBLIGHT_LAYERS - if (rgblight_layers != NULL -# if !defined(RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF) - && rgblight_config.enable -# elif defined(RGBLIGHT_SLEEP) - && !is_suspended -# endif - ) { - rgblight_layers_write(); - } -# endif - -# ifdef RGBLIGHT_LED_MAP - LED_TYPE led0[RGBLED_NUM]; - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led0[i] = led[pgm_read_byte(&led_map[i])]; - } - start_led = led0 + rgblight_ranges.clipping_start_pos; -# else - start_led = led + rgblight_ranges.clipping_start_pos; -# endif - -# ifdef RGBW - for (uint8_t i = 0; i < num_leds; i++) { - convert_rgb_to_rgbw(&start_led[i]); - } -# endif - rgblight_call_driver(start_led, num_leds); -} -#endif - -#ifdef RGBLIGHT_SPLIT -/* for split keyboard master side */ -uint8_t rgblight_get_change_flags(void) { - return rgblight_status.change_flags; -} - -void rgblight_clear_change_flags(void) { - rgblight_status.change_flags = 0; -} - -void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo) { - syncinfo->config = rgblight_config; - syncinfo->status = rgblight_status; -} - -/* for split keyboard slave side */ -void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { -# ifdef RGBLIGHT_LAYERS - if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_LAYERS) { - rgblight_status.enabled_layer_mask = syncinfo->status.enabled_layer_mask; - } -# endif - if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) { - if (syncinfo->config.enable) { - rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); - rgblight_mode_eeprom_helper(syncinfo->config.mode, write_to_eeprom); - } else { - rgblight_disable_noeeprom(); - } - } - if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_HSVS) { - rgblight_sethsv_eeprom_helper(syncinfo->config.hue, syncinfo->config.sat, syncinfo->config.val, write_to_eeprom); - // rgblight_config.speed = config->speed; // NEED??? - } -# ifdef RGBLIGHT_USE_TIMER - if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_TIMER) { - if (syncinfo->status.timer_enabled) { - rgblight_timer_enable(); - } else { - rgblight_timer_disable(); - } - } -# ifndef RGBLIGHT_SPLIT_NO_ANIMATION_SYNC - if (syncinfo->status.change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) { - animation_status.restart = true; - } -# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ -# endif /* RGBLIGHT_USE_TIMER */ -} -#endif /* RGBLIGHT_SPLIT */ - -#ifdef RGBLIGHT_USE_TIMER - -typedef void (*effect_func_t)(animation_status_t *anim); - -// Animation timer -- use system timer (AVR Timer0) -void rgblight_timer_init(void) { - rgblight_status.timer_enabled = false; - RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; -} -void rgblight_timer_enable(void) { - if (!is_static_effect(rgblight_config.mode)) { - rgblight_status.timer_enabled = true; - } - animation_status.last_timer = sync_timer_read(); - RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; - dprintf("rgblight timer enabled.\n"); -} -void rgblight_timer_disable(void) { - rgblight_status.timer_enabled = false; - RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; - dprintf("rgblight timer disable.\n"); -} -void rgblight_timer_toggle(void) { - dprintf("rgblight timer toggle.\n"); - if (rgblight_status.timer_enabled) { - rgblight_timer_disable(); - } else { - rgblight_timer_enable(); - } -} - -void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { - rgblight_enable(); - rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_setrgb(r, g, b); -} - -static void rgblight_effect_dummy(animation_status_t *anim) { - // do nothing - /******** - dprintf("rgblight_task() what happened?\n"); - dprintf("is_static_effect %d\n", is_static_effect(rgblight_config.mode)); - dprintf("mode = %d, base_mode = %d, timer_enabled %d, ", - rgblight_config.mode, rgblight_status.base_mode, - rgblight_status.timer_enabled); - dprintf("last_timer = %d\n",anim->last_timer); - **/ -} - -void rgblight_task(void) { - if (rgblight_status.timer_enabled) { - effect_func_t effect_func = rgblight_effect_dummy; - uint16_t interval_time = 2000; // dummy interval - uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; - animation_status.delta = delta; - - // static light mode, do nothing here - if (1 == 0) { // dummy - } -# ifdef RGBLIGHT_EFFECT_BREATHING - else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { - // breathing mode - interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[delta], 1, 100); - effect_func = rgblight_effect_breathing; - } -# endif -# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { - // rainbow mood mode - interval_time = get_interval_time(&RGBLED_RAINBOW_MOOD_INTERVALS[delta], 5, 100); - effect_func = rgblight_effect_rainbow_mood; - } -# endif -# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { - // rainbow swirl mode - interval_time = get_interval_time(&RGBLED_RAINBOW_SWIRL_INTERVALS[delta / 2], 1, 100); - effect_func = rgblight_effect_rainbow_swirl; - } -# endif -# ifdef RGBLIGHT_EFFECT_SNAKE - else if (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE) { - // snake mode - interval_time = get_interval_time(&RGBLED_SNAKE_INTERVALS[delta / 2], 1, 200); - effect_func = rgblight_effect_snake; - } -# endif -# ifdef RGBLIGHT_EFFECT_KNIGHT - else if (rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT) { - // knight mode - interval_time = get_interval_time(&RGBLED_KNIGHT_INTERVALS[delta], 5, 100); - effect_func = rgblight_effect_knight; - } -# endif -# ifdef RGBLIGHT_EFFECT_CHRISTMAS - else if (rgblight_status.base_mode == RGBLIGHT_MODE_CHRISTMAS) { - // christmas mode - interval_time = RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL; - effect_func = (effect_func_t)rgblight_effect_christmas; - } -# endif -# ifdef RGBLIGHT_EFFECT_RGB_TEST - else if (rgblight_status.base_mode == RGBLIGHT_MODE_RGB_TEST) { - // RGB test mode - interval_time = pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0]); - effect_func = (effect_func_t)rgblight_effect_rgbtest; - } -# endif -# ifdef RGBLIGHT_EFFECT_ALTERNATING - else if (rgblight_status.base_mode == RGBLIGHT_MODE_ALTERNATING) { - interval_time = 500; - effect_func = (effect_func_t)rgblight_effect_alternating; - } -# endif -# ifdef RGBLIGHT_EFFECT_TWINKLE - else if (rgblight_status.base_mode == RGBLIGHT_MODE_TWINKLE) { - interval_time = get_interval_time(&RGBLED_TWINKLE_INTERVALS[delta % 3], 5, 30); - effect_func = (effect_func_t)rgblight_effect_twinkle; - } -# endif - if (animation_status.restart) { - animation_status.restart = false; - animation_status.last_timer = sync_timer_read(); - animation_status.pos16 = 0; // restart signal to local each effect - } - uint16_t now = sync_timer_read(); - if (timer_expired(now, animation_status.last_timer)) { -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - static uint16_t report_last_timer = 0; - static bool tick_flag = false; - uint16_t oldpos16; - if (tick_flag) { - tick_flag = false; - if (timer_expired(now, report_last_timer)) { - report_last_timer += 30000; - dprintf("rgblight animation tick report to slave\n"); - RGBLIGHT_SPLIT_ANIMATION_TICK; - } - } - oldpos16 = animation_status.pos16; -# endif - animation_status.last_timer += interval_time; - effect_func(&animation_status); -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (animation_status.pos16 == 0 && oldpos16 != 0) { - tick_flag = true; - } -# endif - } - } - -# ifdef RGBLIGHT_LAYERS -# ifdef RGBLIGHT_LAYER_BLINK - rgblight_blink_layer_repeat_helper(); -# endif - - if (deferred_set_layer_state) { - deferred_set_layer_state = false; - - // Static modes don't have a ticker running to update the LEDs - if (rgblight_status.timer_enabled == false) { - rgblight_mode_noeeprom(rgblight_config.mode); - } - -# ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF - // If not enabled, then nothing else will actually set the LEDs... - if (!rgblight_config.enable) { - rgblight_set(); - } -# endif - } -# endif -} - -#endif /* RGBLIGHT_USE_TIMER */ - -#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_TWINKLE) - -# ifndef RGBLIGHT_EFFECT_BREATHE_CENTER -# ifndef RGBLIGHT_BREATHE_TABLE_SIZE -# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256 or 128 or 64 -# endif -# include -# endif - -static uint8_t breathe_calc(uint8_t pos) { - // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ -# ifdef RGBLIGHT_EFFECT_BREATHE_TABLE - return pgm_read_byte(&rgblight_effect_breathe_table[pos / table_scale]); -# else - return (exp(sin((pos / 255.0) * M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER / M_E) * (RGBLIGHT_EFFECT_BREATHE_MAX / (M_E - 1 / M_E)); -# endif -} - -#endif - -// Effects -#ifdef RGBLIGHT_EFFECT_BREATHING - -__attribute__((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; - -void rgblight_effect_breathing(animation_status_t *anim) { - uint8_t val = breathe_calc(anim->pos); - rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); - anim->pos = (anim->pos + 1); -} -#endif - -#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD -__attribute__((weak)) const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30}; - -void rgblight_effect_rainbow_mood(animation_status_t *anim) { - rgblight_sethsv_noeeprom_old(anim->current_hue, rgblight_config.sat, rgblight_config.val); - anim->current_hue++; -} -#endif - -#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL -# ifndef RGBLIGHT_RAINBOW_SWIRL_RANGE -# define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 -# endif - -__attribute__((weak)) const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; - -void rgblight_effect_rainbow_swirl(animation_status_t *anim) { - uint8_t hue; - uint8_t i; - - for (i = 0; i < rgblight_ranges.effect_num_leds; i++) { - hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / rgblight_ranges.effect_num_leds * i + anim->current_hue); - sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]); - } - rgblight_set(); - - if (anim->delta % 2) { - anim->current_hue++; - } else { - anim->current_hue--; - } -} -#endif - -#ifdef RGBLIGHT_EFFECT_SNAKE -__attribute__((weak)) const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; - -void rgblight_effect_snake(animation_status_t *anim) { - static uint8_t pos = 0; - uint8_t i, j; - int8_t k; - int8_t increment = 1; - - if (anim->delta % 2) { - increment = -1; - } - -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (anim->pos == 0) { // restart signal - if (increment == 1) { - pos = rgblight_ranges.effect_num_leds - 1; - } else { - pos = 0; - } - anim->pos = 1; - } -# endif - - for (i = 0; i < rgblight_ranges.effect_num_leds; i++) { - LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos; - ledp->r = 0; - ledp->g = 0; - ledp->b = 0; -# ifdef RGBW - ledp->w = 0; -# endif - for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) { - k = pos + j * increment; - if (k > RGBLED_NUM) { - k = k % (RGBLED_NUM); - } - if (k < 0) { - k = k + rgblight_ranges.effect_num_leds; - } - if (i == k) { - sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val * (RGBLIGHT_EFFECT_SNAKE_LENGTH - j) / RGBLIGHT_EFFECT_SNAKE_LENGTH), ledp); - } - } - } - rgblight_set(); - if (increment == 1) { - if (pos - RGBLIGHT_EFFECT_SNAKE_INCREMENT < 0) { - pos = rgblight_ranges.effect_num_leds - 1; -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - anim->pos = 0; -# endif - } else { - pos -= RGBLIGHT_EFFECT_SNAKE_INCREMENT; -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - anim->pos = 1; -# endif - } - } else { - pos = (pos + RGBLIGHT_EFFECT_SNAKE_INCREMENT) % rgblight_ranges.effect_num_leds; -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - anim->pos = pos; -# endif - } -} -#endif - -#ifdef RGBLIGHT_EFFECT_KNIGHT -__attribute__((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; - -void rgblight_effect_knight(animation_status_t *anim) { - static int8_t low_bound = 0; - static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; - static int8_t increment = RGBLIGHT_EFFECT_KNIGHT_INCREMENT; - uint8_t i, cur; - -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (anim->pos == 0) { // restart signal - anim->pos = 1; - low_bound = 0; - high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; - increment = 1; - } -# endif - // Set all the LEDs to 0 - for (i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; -# ifdef RGBW - led[i].w = 0; -# endif - } - // Determine which LEDs should be lit up - for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) { - cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % rgblight_ranges.effect_num_leds + rgblight_ranges.effect_start_pos; - - if (i >= low_bound && i <= high_bound) { - sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]); - } else { - led[cur].r = 0; - led[cur].g = 0; - led[cur].b = 0; -# ifdef RGBW - led[cur].w = 0; -# endif - } - } - rgblight_set(); - - // Move from low_bound to high_bound changing the direction we increment each - // time a boundary is hit. - low_bound += increment; - high_bound += increment; - - if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) { - increment = -increment; -# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (increment == 1) { - anim->pos = 0; - } -# endif - } -} -#endif - -#ifdef RGBLIGHT_EFFECT_CHRISTMAS -# define CUBED(x) ((x) * (x) * (x)) - -/** - * Christmas lights effect, with a smooth animation between red & green. - */ -void rgblight_effect_christmas(animation_status_t *anim) { - static int8_t increment = 1; - const uint8_t max_pos = 32; - const uint8_t hue_green = 85; - - uint32_t xa; - uint8_t hue, val; - uint8_t i; - - // The effect works by animating anim->pos from 0 to 32 and back to 0. - // The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible. - xa = CUBED((uint32_t)anim->pos); - hue = ((uint32_t)hue_green) * xa / (xa + CUBED((uint32_t)(max_pos - anim->pos))); - // Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors. - val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2); - - for (i = 0; i < rgblight_ranges.effect_num_leds; i++) { - uint8_t local_hue = (i / RGBLIGHT_EFFECT_CHRISTMAS_STEP) % 2 ? hue : hue_green - hue; - sethsv(local_hue, rgblight_config.sat, val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]); - } - rgblight_set(); - - if (anim->pos == 0) { - increment = 1; - } else if (anim->pos == max_pos) { - increment = -1; - } - anim->pos += increment; -} -#endif - -#ifdef RGBLIGHT_EFFECT_RGB_TEST -__attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; - -void rgblight_effect_rgbtest(animation_status_t *anim) { - static uint8_t maxval = 0; - uint8_t g; - uint8_t r; - uint8_t b; - - if (maxval == 0) { - LED_TYPE tmp_led; - sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); - maxval = tmp_led.r; - } - g = r = b = 0; - switch (anim->pos) { - case 0: - r = maxval; - break; - case 1: - g = maxval; - break; - case 2: - b = maxval; - break; - } - rgblight_setrgb(r, g, b); - anim->pos = (anim->pos + 1) % 3; -} -#endif - -#ifdef RGBLIGHT_EFFECT_ALTERNATING -void rgblight_effect_alternating(animation_status_t *anim) { - for (int i = 0; i < rgblight_ranges.effect_num_leds; i++) { - LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos; - if (i < rgblight_ranges.effect_num_leds / 2 && anim->pos) { - sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp); - } else if (i >= rgblight_ranges.effect_num_leds / 2 && !anim->pos) { - sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp); - } else { - sethsv(rgblight_config.hue, rgblight_config.sat, 0, ledp); - } - } - rgblight_set(); - anim->pos = (anim->pos + 1) % 2; -} -#endif - -#ifdef RGBLIGHT_EFFECT_TWINKLE -__attribute__((weak)) const uint8_t RGBLED_TWINKLE_INTERVALS[] PROGMEM = {30, 15, 5}; - -typedef struct PACKED { - HSV hsv; - uint8_t life; - uint8_t max_life; -} TwinkleState; - -static TwinkleState led_twinkle_state[RGBLED_NUM]; - -void rgblight_effect_twinkle(animation_status_t *anim) { - const bool random_color = anim->delta / 3; - const bool restart = anim->pos == 0; - anim->pos = 1; - - const uint8_t bottom = breathe_calc(0); - const uint8_t top = breathe_calc(127); - - uint8_t frac(uint8_t n, uint8_t d) { - return (uint16_t)255 * n / d; - } - uint8_t scale(uint16_t v, uint8_t scale) { - return (v * scale) >> 8; - } - - const uint8_t trigger = scale((uint16_t)0xFF * RGBLIGHT_EFFECT_TWINKLE_PROBABILITY, 127 + rgblight_config.val / 2); - - for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { - TwinkleState *t = &(led_twinkle_state[i]); - HSV * c = &(t->hsv); - - if (!random_color) { - c->h = rgblight_config.hue; - c->s = rgblight_config.sat; - } - - if (restart) { - // Restart - t->life = 0; - c->v = 0; - } else if (t->life) { - // This LED is already on, either brightening or dimming - t->life--; - uint8_t unscaled = frac(breathe_calc(frac(t->life, t->max_life)) - bottom, top - bottom); - c->v = scale(rgblight_config.val, unscaled); - } else if ((rand() % 0xFF) < trigger) { - // This LED is off, but was randomly selected to start brightening - if (random_color) { - c->h = rand() % 0xFF; - c->s = (rand() % (rgblight_config.sat / 2)) + (rgblight_config.sat / 2); - } - c->v = 0; - t->max_life = MAX(20, MIN(RGBLIGHT_EFFECT_TWINKLE_LIFE, rgblight_config.val)); - t->life = t->max_life; - } else { - // This LED is off, and was NOT selected to start brightening - } - - LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos; - sethsv(c->h, c->s, c->v, ledp); - } - - rgblight_set(); -} -#endif diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h deleted file mode 100644 index 001058f962..0000000000 --- a/quantum/rgblight/rgblight.h +++ /dev/null @@ -1,448 +0,0 @@ -/* Copyright 2017 Yang Liu - * - * 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 . - */ - -#pragma once - -/***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) **** - - old mode number (before 0.6.117) to new mode name table - -|-----------------|-----------------------------------| -| old mode number | new mode name | -|-----------------|-----------------------------------| -| 1 | RGBLIGHT_MODE_STATIC_LIGHT | -| 2 | RGBLIGHT_MODE_BREATHING | -| 3 | RGBLIGHT_MODE_BREATHING + 1 | -| 4 | RGBLIGHT_MODE_BREATHING + 2 | -| 5 | RGBLIGHT_MODE_BREATHING + 3 | -| 6 | RGBLIGHT_MODE_RAINBOW_MOOD | -| 7 | RGBLIGHT_MODE_RAINBOW_MOOD + 1 | -| 8 | RGBLIGHT_MODE_RAINBOW_MOOD + 2 | -| 9 | RGBLIGHT_MODE_RAINBOW_SWIRL | -| 10 | RGBLIGHT_MODE_RAINBOW_SWIRL + 1 | -| 11 | RGBLIGHT_MODE_RAINBOW_SWIRL + 2 | -| 12 | RGBLIGHT_MODE_RAINBOW_SWIRL + 3 | -| 13 | RGBLIGHT_MODE_RAINBOW_SWIRL + 4 | -| 14 | RGBLIGHT_MODE_RAINBOW_SWIRL + 5 | -| 15 | RGBLIGHT_MODE_SNAKE | -| 16 | RGBLIGHT_MODE_SNAKE + 1 | -| 17 | RGBLIGHT_MODE_SNAKE + 2 | -| 18 | RGBLIGHT_MODE_SNAKE + 3 | -| 19 | RGBLIGHT_MODE_SNAKE + 4 | -| 20 | RGBLIGHT_MODE_SNAKE + 5 | -| 21 | RGBLIGHT_MODE_KNIGHT | -| 22 | RGBLIGHT_MODE_KNIGHT + 1 | -| 23 | RGBLIGHT_MODE_KNIGHT + 2 | -| 24 | RGBLIGHT_MODE_CHRISTMAS | -| 25 | RGBLIGHT_MODE_STATIC_GRADIENT | -| 26 | RGBLIGHT_MODE_STATIC_GRADIENT + 1 | -| 27 | RGBLIGHT_MODE_STATIC_GRADIENT + 2 | -| 28 | RGBLIGHT_MODE_STATIC_GRADIENT + 3 | -| 29 | RGBLIGHT_MODE_STATIC_GRADIENT + 4 | -| 30 | RGBLIGHT_MODE_STATIC_GRADIENT + 5 | -| 31 | RGBLIGHT_MODE_STATIC_GRADIENT + 6 | -| 32 | RGBLIGHT_MODE_STATIC_GRADIENT + 7 | -| 33 | RGBLIGHT_MODE_STATIC_GRADIENT + 8 | -| 34 | RGBLIGHT_MODE_STATIC_GRADIENT + 9 | -| 35 | RGBLIGHT_MODE_RGB_TEST | -| 36 | RGBLIGHT_MODE_ALTERNATING | -| 37 | RGBLIGHT_MODE_TWINKLE | -| 38 | RGBLIGHT_MODE_TWINKLE + 1 | -| 39 | RGBLIGHT_MODE_TWINKLE + 2 | -| 40 | RGBLIGHT_MODE_TWINKLE + 3 | -| 41 | RGBLIGHT_MODE_TWINKLE + 4 | -| 42 | RGBLIGHT_MODE_TWINKLE + 5 | -|-----------------|-----------------------------------| - *****/ - -// clang-format off - -// check dynamic animation effects chose ? -#if defined(RGBLIGHT_EFFECT_BREATHING) \ - || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) \ - || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) \ - || defined(RGBLIGHT_EFFECT_SNAKE) \ - || defined(RGBLIGHT_EFFECT_KNIGHT) \ - || defined(RGBLIGHT_EFFECT_CHRISTMAS) \ - || defined(RGBLIGHT_EFFECT_RGB_TEST) \ - || defined(RGBLIGHT_EFFECT_ALTERNATING) \ - || defined(RGBLIGHT_EFFECT_TWINKLE) -# define RGBLIGHT_USE_TIMER -#endif - -// clang-format on - -#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_##sym, -#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##sym, -#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##sym, -enum RGBLIGHT_EFFECT_MODE { - RGBLIGHT_MODE_zero = 0, -#include "rgblight_modes.h" - RGBLIGHT_MODE_last -}; - -#define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) - -// sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 - -#ifndef RGBLIGHT_EFFECT_BREATHE_MAX -# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 -#endif - -#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH -# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 -#endif - -#ifndef RGBLIGHT_EFFECT_SNAKE_INCREMENT -# define RGBLIGHT_EFFECT_SNAKE_INCREMENT 1 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH -# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_INCREMENT -# define RGBLIGHT_EFFECT_KNIGHT_INCREMENT 1 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET -# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM -# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds) -#endif - -#ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL -# define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 40 -#endif - -#ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP -# define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 -#endif - -#ifndef RGBLIGHT_EFFECT_TWINKLE_LIFE -# define RGBLIGHT_EFFECT_TWINKLE_LIFE 200 -#endif - -#ifndef RGBLIGHT_EFFECT_TWINKLE_PROBABILITY -# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 127 -#endif - -#ifndef RGBLIGHT_HUE_STEP -# define RGBLIGHT_HUE_STEP 8 -#endif -#ifndef RGBLIGHT_SAT_STEP -# define RGBLIGHT_SAT_STEP 17 -#endif -#ifndef RGBLIGHT_VAL_STEP -# define RGBLIGHT_VAL_STEP 17 -#endif -#ifndef RGBLIGHT_LIMIT_VAL -# define RGBLIGHT_LIMIT_VAL 255 -#endif - -#include -#include -#include "progmem.h" -#include "eeconfig.h" -#include "ws2812.h" -#include "color.h" - -#ifdef RGBLIGHT_LAYERS -typedef struct { - uint8_t index; // The first LED to light - uint8_t count; // The number of LEDs to light - uint8_t hue; - uint8_t sat; - uint8_t val; -} rgblight_segment_t; - -// rgblight_set_layer_state doesn't take effect until the next time -// rgblight_task runs, so timers must be enabled for layers to work. -# define RGBLIGHT_USE_TIMER - -# define RGBLIGHT_END_SEGMENT_INDEX (255) -# define RGBLIGHT_END_SEGMENTS \ - { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } -# ifndef RGBLIGHT_MAX_LAYERS -# define RGBLIGHT_MAX_LAYERS 8 -# endif -# if RGBLIGHT_MAX_LAYERS <= 0 -# error invalid RGBLIGHT_MAX_LAYERS value (must be >= 1) -# elif RGBLIGHT_MAX_LAYERS <= 8 -typedef uint8_t rgblight_layer_mask_t; -# elif RGBLIGHT_MAX_LAYERS <= 16 -typedef uint16_t rgblight_layer_mask_t; -# elif RGBLIGHT_MAX_LAYERS <= 32 -typedef uint32_t rgblight_layer_mask_t; -# else -# error invalid RGBLIGHT_MAX_LAYERS value (must be <= 32) -# endif -# define RGBLIGHT_LAYER_SEGMENTS(...) \ - { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } -# define RGBLIGHT_LAYERS_LIST(...) \ - { __VA_ARGS__, NULL } - -// Get/set enabled rgblight layers -void rgblight_set_layer_state(uint8_t layer, bool enabled); -bool rgblight_get_layer_state(uint8_t layer); - -// Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers -extern const rgblight_segment_t *const *rgblight_layers; - -# ifdef RGBLIGHT_LAYER_BLINK -# define RGBLIGHT_USE_TIMER -void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms); -void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times); -/** - * \brief Stop blinking on one layer. - * - * Stop a layer that is blinking. If the layer is not blinking it will - * be unaffected. - * - * \param layer Layer number to stop blinking. - */ -void rgblight_unblink_layer(uint8_t layer); -/** - * \brief Stop blinking all layers except one. - * - * Stop all layers that are blinking except for one specific layer. - * Layers that are not blinking are unaffected. - * - * \param layer Layer number to keep blinking. - */ -void rgblight_unblink_all_but_layer(uint8_t layer); -# endif - -#endif - -extern LED_TYPE led[RGBLED_NUM]; - -extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; -extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; -extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM; -extern const uint8_t RGBLED_TWINKLE_INTERVALS[3] PROGMEM; -extern bool is_rgblight_initialized; - -typedef union { - uint64_t raw; - struct { - bool enable : 1; - uint8_t mode : 7; - uint8_t hue : 8; - uint8_t sat : 8; - uint8_t val : 8; - uint8_t speed : 8; - }; -} rgblight_config_t; - -_Static_assert(sizeof(rgblight_config_t) == sizeof(uint64_t), "RGB Light EECONFIG out of spec."); - -typedef struct _rgblight_status_t { - uint8_t base_mode; - bool timer_enabled; -#ifdef RGBLIGHT_SPLIT - uint8_t change_flags; -#endif -#ifdef RGBLIGHT_LAYERS - rgblight_layer_mask_t enabled_layer_mask; -#endif -} rgblight_status_t; - -/* - * Structure for RGB Light clipping ranges - */ -typedef struct _rgblight_ranges_t { - uint8_t clipping_start_pos; - uint8_t clipping_num_leds; - uint8_t effect_start_pos; - uint8_t effect_end_pos; - uint8_t effect_num_leds; -} rgblight_ranges_t; - -extern rgblight_ranges_t rgblight_ranges; - -/* === Utility Functions ===*/ -void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); -void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check -void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); - -/* === Low level Functions === */ -void rgblight_set(void); -void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); - -/* === Effects and Animations Functions === */ -/* effect range setting */ -void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds); - -/* direct operation */ -void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); -void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index); -void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end); -void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); -void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); - -#ifndef RGBLIGHT_SPLIT -void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); -void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); -void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); -void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); -#endif - -/* effect mode change */ -void rgblight_mode(uint8_t mode); -void rgblight_mode_noeeprom(uint8_t mode); -void rgblight_increase(void); -void rgblight_decrease(void); -void rgblight_step(void); -void rgblight_step_noeeprom(void); -void rgblight_step_reverse(void); -void rgblight_step_reverse_noeeprom(void); - -/* effects mode disable/enable */ -void rgblight_toggle(void); -void rgblight_toggle_noeeprom(void); -void rgblight_enable(void); -void rgblight_enable_noeeprom(void); -void rgblight_disable(void); -void rgblight_disable_noeeprom(void); -void rgblight_enabled_noeeprom(bool state); - -/* hue, sat, val change */ -void rgblight_increase_hue(void); -void rgblight_increase_hue_noeeprom(void); -void rgblight_decrease_hue(void); -void rgblight_decrease_hue_noeeprom(void); -void rgblight_increase_sat(void); -void rgblight_increase_sat_noeeprom(void); -void rgblight_decrease_sat(void); -void rgblight_decrease_sat_noeeprom(void); -void rgblight_increase_val(void); -void rgblight_increase_val_noeeprom(void); -void rgblight_decrease_val(void); -void rgblight_decrease_val_noeeprom(void); -void rgblight_increase_speed(void); -void rgblight_increase_speed_noeeprom(void); -void rgblight_decrease_speed(void); -void rgblight_decrease_speed_noeeprom(void); -void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val); -void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val); - -/* effect speed */ -uint8_t rgblight_get_speed(void); -void rgblight_set_speed(uint8_t speed); -void rgblight_set_speed_noeeprom(uint8_t speed); - -/* reset */ -void rgblight_reload_from_eeprom(void); - -/* query */ -uint8_t rgblight_get_mode(void); -uint8_t rgblight_get_hue(void); -uint8_t rgblight_get_sat(void); -uint8_t rgblight_get_val(void); -bool rgblight_is_enabled(void); -HSV rgblight_get_hsv(void); - -/* === qmk_firmware (core)internal Functions === */ -void rgblight_init(void); -void rgblight_suspend(void); -void rgblight_wakeup(void); -uint64_t rgblight_read_qword(void); -void rgblight_update_qword(uint64_t qword); -uint64_t eeconfig_read_rgblight(void); -void eeconfig_update_rgblight(uint64_t val); -void eeconfig_update_rgblight_current(void); -void eeconfig_update_rgblight_default(void); -void eeconfig_debug_rgblight(void); - -void rgb_matrix_increase(void); -void rgb_matrix_decrease(void); - -void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); -void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); - -#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) -void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); - -#ifdef RGBLIGHT_USE_TIMER -void rgblight_task(void); -void rgblight_timer_init(void); -void rgblight_timer_enable(void); -void rgblight_timer_disable(void); -void rgblight_timer_toggle(void); -#else -# define rgblight_task() -# define rgblight_timer_init() -# define rgblight_timer_enable() -# define rgblight_timer_disable() -# define rgblight_timer_toggle() -#endif - -#ifdef RGBLIGHT_SPLIT -# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) -# define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) -# define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) -# define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) -# define RGBLIGHT_STATUS_CHANGE_LAYERS (1 << 4) - -typedef struct _rgblight_syncinfo_t { - rgblight_config_t config; - rgblight_status_t status; -} rgblight_syncinfo_t; - -/* for split keyboard master side */ -uint8_t rgblight_get_change_flags(void); -void rgblight_clear_change_flags(void); -void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); -/* for split keyboard slave side */ -void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); -#endif - -#ifdef RGBLIGHT_USE_TIMER - -typedef struct _animation_status_t { - uint16_t last_timer; - uint8_t delta; /* mode - base_mode */ - bool restart; - union { - uint16_t pos16; - uint8_t pos; - int8_t current_hue; - uint16_t current_offset; - }; -} animation_status_t; - -extern animation_status_t animation_status; - -void rgblight_effect_breathing(animation_status_t *anim); -void rgblight_effect_rainbow_mood(animation_status_t *anim); -void rgblight_effect_rainbow_swirl(animation_status_t *anim); -void rgblight_effect_snake(animation_status_t *anim); -void rgblight_effect_knight(animation_status_t *anim); -void rgblight_effect_christmas(animation_status_t *anim); -void rgblight_effect_rgbtest(animation_status_t *anim); -void rgblight_effect_alternating(animation_status_t *anim); -void rgblight_effect_twinkle(animation_status_t *anim); - -#endif diff --git a/quantum/rgblight/rgblight_breathe_table.h b/quantum/rgblight/rgblight_breathe_table.h deleted file mode 100644 index 5c7660ab6a..0000000000 --- a/quantum/rgblight/rgblight_breathe_table.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2023 QMK -// SPDX-License-Identifier: GPL-2.0-or-later - -/******************************************************************************* - 88888888888 888 d8b .d888 d8b 888 d8b - 888 888 Y8P d88P" Y8P 888 Y8P - 888 888 888 888 - 888 88888b. 888 .d8888b 888888 888 888 .d88b. 888 .d8888b - 888 888 "88b 888 88K 888 888 888 d8P Y8b 888 88K - 888 888 888 888 "Y8888b. 888 888 888 88888888 888 "Y8888b. - 888 888 888 888 X88 888 888 888 Y8b. 888 X88 - 888 888 888 888 88888P' 888 888 888 "Y8888 888 88888P' - 888 888 - 888 888 - 888 888 - .d88b. .d88b. 88888b. .d88b. 888d888 8888b. 888888 .d88b. .d88888 - d88P"88b d8P Y8b 888 "88b d8P Y8b 888P" "88b 888 d8P Y8b d88" 888 - 888 888 88888888 888 888 88888888 888 .d888888 888 88888888 888 888 - Y88b 888 Y8b. 888 888 Y8b. 888 888 888 Y88b. Y8b. Y88b 888 - "Y88888 "Y8888 888 888 "Y8888 888 "Y888888 "Y888 "Y8888 "Y88888 - 888 - Y8b d88P - "Y88P" -*******************************************************************************/ - -#pragma once -// clang-format off -#define RGBLIGHT_EFFECT_BREATHE_TABLE - -// Breathing center: 1.85 -// Breathing max: 255 - -const uint8_t PROGMEM rgblight_effect_breathe_table[] = { -#if RGBLIGHT_BREATHE_TABLE_SIZE == 256 - 0x22, 0x23, 0x25, 0x26, 0x28, 0x29, 0x2A, 0x2C, - 0x2D, 0x2F, 0x30, 0x32, 0x33, 0x35, 0x36, 0x38, - 0x3A, 0x3B, 0x3D, 0x3E, 0x40, 0x42, 0x43, 0x45, - 0x47, 0x49, 0x4A, 0x4C, 0x4E, 0x50, 0x51, 0x53, - 0x55, 0x57, 0x59, 0x5A, 0x5C, 0x5E, 0x60, 0x62, - 0x64, 0x66, 0x68, 0x69, 0x6B, 0x6D, 0x6F, 0x71, - 0x73, 0x75, 0x77, 0x79, 0x7B, 0x7D, 0x7F, 0x81, - 0x83, 0x85, 0x87, 0x89, 0x8A, 0x8C, 0x8E, 0x90, - 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E, 0x9F, - 0xA1, 0xA3, 0xA5, 0xA7, 0xA8, 0xAA, 0xAC, 0xAE, - 0xAF, 0xB1, 0xB3, 0xB4, 0xB6, 0xB8, 0xB9, 0xBB, - 0xBC, 0xBE, 0xBF, 0xC1, 0xC2, 0xC3, 0xC5, 0xC6, - 0xC7, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xD0, - 0xD1, 0xD2, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, - 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDA, 0xDB, 0xDB, - 0xDB, 0xDC, 0xDC, 0xDC, 0xDC, 0xDC, 0xDD, 0xDD, - 0xDD, 0xDD, 0xDC, 0xDC, 0xDC, 0xDC, 0xDC, 0xDB, - 0xDB, 0xDB, 0xDA, 0xDA, 0xD9, 0xD9, 0xD8, 0xD7, - 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD2, 0xD1, - 0xD0, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC7, - 0xC6, 0xC5, 0xC3, 0xC2, 0xC1, 0xBF, 0xBE, 0xBC, - 0xBB, 0xB9, 0xB8, 0xB6, 0xB4, 0xB3, 0xB1, 0xAF, - 0xAE, 0xAC, 0xAA, 0xA8, 0xA7, 0xA5, 0xA3, 0xA1, - 0x9F, 0x9E, 0x9C, 0x9A, 0x98, 0x96, 0x94, 0x92, - 0x90, 0x8E, 0x8C, 0x8A, 0x89, 0x87, 0x85, 0x83, - 0x81, 0x7F, 0x7D, 0x7B, 0x79, 0x77, 0x75, 0x73, - 0x71, 0x6F, 0x6D, 0x6B, 0x69, 0x68, 0x66, 0x64, - 0x62, 0x60, 0x5E, 0x5C, 0x5A, 0x59, 0x57, 0x55, - 0x53, 0x51, 0x50, 0x4E, 0x4C, 0x4A, 0x49, 0x47, - 0x45, 0x43, 0x42, 0x40, 0x3E, 0x3D, 0x3B, 0x3A, - 0x38, 0x36, 0x35, 0x33, 0x32, 0x30, 0x2F, 0x2D, - 0x2C, 0x2A, 0x29, 0x28, 0x26, 0x25, 0x23, 0x22 -#endif - -#if RGBLIGHT_BREATHE_TABLE_SIZE == 128 - 0x22, 0x25, 0x28, 0x2A, - 0x2D, 0x30, 0x33, 0x36, - 0x3A, 0x3D, 0x40, 0x43, - 0x47, 0x4A, 0x4E, 0x51, - 0x55, 0x59, 0x5C, 0x60, - 0x64, 0x68, 0x6B, 0x6F, - 0x73, 0x77, 0x7B, 0x7F, - 0x83, 0x87, 0x8A, 0x8E, - 0x92, 0x96, 0x9A, 0x9E, - 0xA1, 0xA5, 0xA8, 0xAC, - 0xAF, 0xB3, 0xB6, 0xB9, - 0xBC, 0xBF, 0xC2, 0xC5, - 0xC7, 0xCA, 0xCC, 0xCE, - 0xD1, 0xD2, 0xD4, 0xD6, - 0xD7, 0xD9, 0xDA, 0xDB, - 0xDB, 0xDC, 0xDC, 0xDD, - 0xDD, 0xDC, 0xDC, 0xDC, - 0xDB, 0xDA, 0xD9, 0xD8, - 0xD7, 0xD5, 0xD3, 0xD2, - 0xD0, 0xCD, 0xCB, 0xC9, - 0xC6, 0xC3, 0xC1, 0xBE, - 0xBB, 0xB8, 0xB4, 0xB1, - 0xAE, 0xAA, 0xA7, 0xA3, - 0x9F, 0x9C, 0x98, 0x94, - 0x90, 0x8C, 0x89, 0x85, - 0x81, 0x7D, 0x79, 0x75, - 0x71, 0x6D, 0x69, 0x66, - 0x62, 0x5E, 0x5A, 0x57, - 0x53, 0x50, 0x4C, 0x49, - 0x45, 0x42, 0x3E, 0x3B, - 0x38, 0x35, 0x32, 0x2F, - 0x2C, 0x29, 0x26, 0x23 -#endif - -#if RGBLIGHT_BREATHE_TABLE_SIZE == 64 - 0x22, 0x28, - 0x2D, 0x33, - 0x3A, 0x40, - 0x47, 0x4E, - 0x55, 0x5C, - 0x64, 0x6B, - 0x73, 0x7B, - 0x83, 0x8A, - 0x92, 0x9A, - 0xA1, 0xA8, - 0xAF, 0xB6, - 0xBC, 0xC2, - 0xC7, 0xCC, - 0xD1, 0xD4, - 0xD7, 0xDA, - 0xDB, 0xDC, - 0xDD, 0xDC, - 0xDB, 0xD9, - 0xD7, 0xD3, - 0xD0, 0xCB, - 0xC6, 0xC1, - 0xBB, 0xB4, - 0xAE, 0xA7, - 0x9F, 0x98, - 0x90, 0x89, - 0x81, 0x79, - 0x71, 0x69, - 0x62, 0x5A, - 0x53, 0x4C, - 0x45, 0x3E, - 0x38, 0x32, - 0x2C, 0x26 -#endif -}; - -static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table); - diff --git a/quantum/rgblight/rgblight_modes.h b/quantum/rgblight/rgblight_modes.h deleted file mode 100644 index 7abdb87bc6..0000000000 --- a/quantum/rgblight/rgblight_modes.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifdef _RGBM_SINGLE_STATIC -_RGBM_SINGLE_STATIC(STATIC_LIGHT) -# ifdef RGBLIGHT_EFFECT_BREATHING -_RGBM_MULTI_DYNAMIC(BREATHING) -_RGBM_TMP_DYNAMIC(breathing_3, BREATHING) -_RGBM_TMP_DYNAMIC(breathing_4, BREATHING) -_RGBM_TMP_DYNAMIC(BREATHING_end, BREATHING) -# endif -# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD -_RGBM_MULTI_DYNAMIC(RAINBOW_MOOD) -_RGBM_TMP_DYNAMIC(rainbow_mood_7, RAINBOW_MOOD) -_RGBM_TMP_DYNAMIC(RAINBOW_MOOD_end, RAINBOW_MOOD) -# endif -# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL -_RGBM_MULTI_DYNAMIC(RAINBOW_SWIRL) -_RGBM_TMP_DYNAMIC(rainbow_swirl_10, RAINBOW_SWIRL) -_RGBM_TMP_DYNAMIC(rainbow_swirl_11, RAINBOW_SWIRL) -_RGBM_TMP_DYNAMIC(rainbow_swirl_12, RAINBOW_SWIRL) -_RGBM_TMP_DYNAMIC(rainbow_swirl_13, RAINBOW_SWIRL) -_RGBM_TMP_DYNAMIC(RAINBOW_SWIRL_end, RAINBOW_SWIRL) -# endif -# ifdef RGBLIGHT_EFFECT_SNAKE -_RGBM_MULTI_DYNAMIC(SNAKE) -_RGBM_TMP_DYNAMIC(snake_16, SNAKE) -_RGBM_TMP_DYNAMIC(snake_17, SNAKE) -_RGBM_TMP_DYNAMIC(snake_18, SNAKE) -_RGBM_TMP_DYNAMIC(snake_19, SNAKE) -_RGBM_TMP_DYNAMIC(SNAKE_end, SNAKE) -# endif -# ifdef RGBLIGHT_EFFECT_KNIGHT -_RGBM_MULTI_DYNAMIC(KNIGHT) -_RGBM_TMP_DYNAMIC(knight_22, KNIGHT) -_RGBM_TMP_DYNAMIC(KNIGHT_end, KNIGHT) -# endif -# ifdef RGBLIGHT_EFFECT_CHRISTMAS -_RGBM_SINGLE_DYNAMIC(CHRISTMAS) -# endif -# ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT -_RGBM_MULTI_STATIC(STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_26, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_27, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_28, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_29, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_30, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_31, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_32, STATIC_GRADIENT) -_RGBM_TMP_STATIC(static_gradient_33, STATIC_GRADIENT) -_RGBM_TMP_STATIC(STATIC_GRADIENT_end, STATIC_GRADIENT) -# endif -# ifdef RGBLIGHT_EFFECT_RGB_TEST -_RGBM_SINGLE_DYNAMIC(RGB_TEST) -# endif -# ifdef RGBLIGHT_EFFECT_ALTERNATING -_RGBM_SINGLE_DYNAMIC(ALTERNATING) -# endif -# ifdef RGBLIGHT_EFFECT_TWINKLE -_RGBM_MULTI_DYNAMIC(TWINKLE) -_RGBM_TMP_DYNAMIC(twinkle_38, TWINKLE) -_RGBM_TMP_DYNAMIC(twinkle_39, TWINKLE) -_RGBM_TMP_DYNAMIC(twinkle_40, TWINKLE) -_RGBM_TMP_DYNAMIC(twinkle_41, TWINKLE) -_RGBM_TMP_DYNAMIC(TWINKLE_end, TWINKLE) -# endif -//// Add a new mode here. -// #ifdef RGBLIGHT_EFFECT_ -// _RGBM__( ) -// #endif -#endif - -#undef _RGBM_SINGLE_STATIC -#undef _RGBM_SINGLE_DYNAMIC -#undef _RGBM_MULTI_STATIC -#undef _RGBM_MULTI_DYNAMIC -#undef _RGBM_TMP_STATIC -#undef _RGBM_TMP_DYNAMIC diff --git a/quantum/rgblight/rgblight_post_config.h b/quantum/rgblight/rgblight_post_config.h deleted file mode 100644 index 3c14cb6109..0000000000 --- a/quantum/rgblight/rgblight_post_config.h +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(RGBLED_SPLIT) && !defined(RGBLIGHT_SPLIT) -// When RGBLED_SPLIT is defined, -// it is considered that RGBLIGHT_SPLIT is defined implicitly. -# define RGBLIGHT_SPLIT -#endif