mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
[Keymap] thunderbird2086 layer status with RGB lighting/matrix (#21063)
This commit is contained in:
parent
eee9a53a80
commit
57b23b8d96
|
@ -14,6 +14,7 @@
|
|||
# undef TAPPING_TERM
|
||||
#endif
|
||||
#define TAPPING_TERM 200
|
||||
#define VER_NEWLINE_WAIT 200 // in milliseconds
|
||||
|
||||
#define NO_ACTION_ONESHOT
|
||||
|
||||
|
@ -32,18 +33,28 @@
|
|||
#define RGBLIGHT_SLEEP
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
# define RGBLIGHT_LAYERS
|
||||
# define RGBLIGHT_LIMIT_VAL 150
|
||||
# define RGBLIGHT_HUE_STEP 16
|
||||
# define RGBLIGHT_SAT_STEP 32
|
||||
# define RGBLIGHT_VAL_STEP 32
|
||||
|
||||
# define RGBLIGHT_EFFECT_ALTERING
|
||||
# define RGBLIGHT_EFFECT_BREATHING
|
||||
# define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
# define RGBLIGHT_EFFECT_KNIGHT
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
# define RGBLIGHT_EFFECT_KNIGHT
|
||||
# define RGBLIGHT_EFFECT_RGB_TEST
|
||||
# define RGBLIGHT_EFFECT_SNAKE
|
||||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
# define RGBLIGHT_EFFECT_TWINKLE
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
# define SPLIT_LAYER_STATE_ENABLE
|
||||
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
|
||||
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
|
||||
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150
|
||||
// limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
|
||||
|
@ -55,40 +66,47 @@
|
|||
|
||||
/* Disable the animations you don't want/need. You will need to disable a good number of these *
|
||||
* because they take up a lot of space. Disable until you can successfully compile your firmware. */
|
||||
# undef ENABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
# define ENABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_BREATHING
|
||||
# undef ENABLE_RGB_MATRIX_BREATHING
|
||||
# undef ENABLE_RGB_MATRIX_BAND_SAT
|
||||
# undef ENABLE_RGB_MATRIX_BAND_VAL
|
||||
# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_ALL
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_ALL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
# undef ENABLE_RGB_MATRIX_DUAL_BEACON
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
# undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
# undef ENABLE_RGB_MATRIX_DUAL_BEACON
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
# undef ENABLE_RGB_MATRIX_RAINDROPS
|
||||
# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
# undef ENABLE_RGB_MATRIX_HUE_BREATHING
|
||||
# undef ENABLE_RGB_MATRIX_HUE_PENDULUM
|
||||
# undef ENABLE_RGB_MATRIX_HUE_WAVE
|
||||
# undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL
|
||||
# define ENABLE_RGB_MATRIX_PIXEL_FLOW
|
||||
# undef ENABLE_RGB_MATRIX_PIXEL_RAIN
|
||||
# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP
|
||||
# undef ENABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
# define ENABLE_RGB_MATRIX_SPLASH
|
||||
# undef ENABLE_RGB_MATRIX_MULTISPLASH
|
||||
# undef ENABLE_RGB_MATRIX_SPLASH
|
||||
# define ENABLE_RGB_MATRIX_MULTISPLASH
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
#endif
|
||||
|
|
|
@ -5,12 +5,15 @@
|
|||
|
||||
enum custom_keycodes {
|
||||
// Layer Macros
|
||||
COLEMAK = SAFE_RANGE,
|
||||
COLEMAK = QK_USER,
|
||||
QWERTY,
|
||||
FUNCTION,
|
||||
CODE,
|
||||
ADJUST,
|
||||
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
RGBRST,
|
||||
# endif
|
||||
VRSN,
|
||||
// Secret Macros
|
||||
M_XXX1,
|
||||
M_XXX2,
|
||||
|
|
|
@ -80,6 +80,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
};
|
||||
// clang-format off
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
__attribute__((weak))
|
||||
void set_rgb_by_layer(layer_state_t state) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
# if defined(RGBLIGHT_ENABLE)
|
||||
set_rgb_by_layer(state);
|
||||
# endif
|
||||
return update_tri_layer_state(state, _FUNCTION, _ADJUST, _SECRET);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@
|
|||
|
||||
#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE)
|
||||
# define ________________________ADJUST_L2________________________ RGBRST , XXXXXXX , RGB_SPI , RGB_SAI , RGB_HUI , RGB_VAI
|
||||
# define ________________________ADJUST_L3________________________ EE_CLR , XXXXXXX , RGB_SPD , RGB_SAD , RGB_HUD , RGB_VAD
|
||||
# define ________________________ADJUST_L3________________________ EE_CLR , VRSN , RGB_SPD , RGB_SAD , RGB_HUD , RGB_VAD
|
||||
#else
|
||||
# define ________________________ADJUST_L2________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||
# define ________________________ADJUST_L3________________________ EE_CLR , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||
# define ________________________ADJUST_L3________________________ EE_CLR , VRSN , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "keycodes.h"
|
||||
#include "version.h"
|
||||
|
||||
__attribute__((weak))
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
|
@ -23,18 +24,31 @@ bool process_record_oled(uint16_t keycode, keyrecord_t *record) {
|
|||
#endif
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
|
||||
case COLEMAK:
|
||||
if (record->event.pressed) {
|
||||
switch (keycode) {
|
||||
case COLEMAK:
|
||||
set_single_persistent_default_layer(_COLEMAK);
|
||||
}
|
||||
break;
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_QWERTY);
|
||||
}
|
||||
break;
|
||||
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
case RGBRST:
|
||||
# if defined(RGBLIGHT_ENABLE)
|
||||
eeconfig_update_rgblight_default();
|
||||
rgblight_enable();
|
||||
# else
|
||||
eeconfig_update_rgb_matrix_default();
|
||||
# endif
|
||||
break;
|
||||
# endif
|
||||
case VRSN:
|
||||
send_string(
|
||||
"# qmk " QMK_VERSION "\n" SS_DELAY(VER_NEWLINE_WAIT)
|
||||
"# " QMK_KEYBOARD "/" QMK_KEYMAP "\n" SS_DELAY(VER_NEWLINE_WAIT)
|
||||
"# built on: " QMK_BUILDDATE "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
|
||||
|
|
|
@ -54,7 +54,7 @@ The concept is Mac and **baby finger** friendly keymap.
|
|||
| --- | --- | --- |
|
||||
| ESC | Caps lock | |
|
||||
|
||||
- ADJUST: RGB control, Power control, default layer setting and reset
|
||||
- ADJUST: RGB control, Power control, default layer setting, QMK version and reset
|
||||
![adjust](https://i.imgur.com/uDIhigd.png)
|
||||
- SECRET: hold `ADJUST` and `FUNCTION` to activate
|
||||
|
||||
|
|
61
keyboards/crkbd/keymaps/thunderbird2086/rgb.c
Normal file
61
keyboards/crkbd/keymaps/thunderbird2086/rgb.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2023 Allen Choi (@thunderbird2086)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
# include QMK_KEYBOARD_H
|
||||
|
||||
# include "keycodes.h"
|
||||
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
|
||||
const rgblight_segment_t PROGMEM _rgb_layer_0[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||
{0, 56, HSV_BLUE}
|
||||
);
|
||||
const rgblight_segment_t PROGMEM _rgb_layer_1[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||
{0, 56, HSV_GREEN}
|
||||
);
|
||||
const rgblight_segment_t PROGMEM _rgb_layer_2[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||
{0, 56, HSV_YELLOW}
|
||||
);
|
||||
|
||||
const rgblight_segment_t* const PROGMEM _rgb_layers[] = RGBLIGHT_LAYERS_LIST(
|
||||
_rgb_layer_0,
|
||||
_rgb_layer_1,
|
||||
_rgb_layer_2
|
||||
);
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
// Enable the LED layers
|
||||
rgblight_layers = _rgb_layers;
|
||||
}
|
||||
|
||||
void set_rgb_by_layer(layer_state_t state) {
|
||||
rgblight_set_layer_state(0, layer_state_cmp(state, _CODE));
|
||||
rgblight_set_layer_state(1, layer_state_cmp(state, _FUNCTION));
|
||||
rgblight_set_layer_state(2, layer_state_cmp(state, _ADJUST));
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
switch(get_highest_layer(layer_state|default_layer_state)) {
|
||||
case _CODE:
|
||||
rgb_matrix_set_color(i, RGB_BLUE);
|
||||
break;
|
||||
case _FUNCTION:
|
||||
rgb_matrix_set_color(i, RGB_GREEN);
|
||||
break;
|
||||
case _ADJUST:
|
||||
rgb_matrix_set_color(i, RGB_YELLOW);
|
||||
// RGB_WHITE caused crash
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
# endif
|
||||
#endif
|
|
@ -11,6 +11,7 @@ TAP_DANCE_ENABLE = yes
|
|||
|
||||
SRC += oled.c
|
||||
SRC += process_records.c
|
||||
SRC += rgb.c
|
||||
SRC += tap_dances.c
|
||||
|
||||
ifneq ("$(wildcard keyboards/crkbd/keymaps/thunderbird2086/secrets.c)","")
|
||||
|
|
Loading…
Reference in New Issue
Block a user