summaryrefslogtreecommitdiff
path: root/keyboards/crkbd
diff options
context:
space:
mode:
authorAllen Choi <37539914+Thunderbird2086@users.noreply.github.com>2023-06-11 04:35:15 +0800
committerGitHub <noreply@github.com>2023-06-10 14:35:15 -0600
commit57b23b8d968695e98e7738ab8f563124b87545fb (patch)
tree8227b6949cbff3ad2cd3804891901841cb30ab45 /keyboards/crkbd
parenteee9a53a803dbcd2bc265a082c67afe0324371fc (diff)
[Keymap] thunderbird2086 layer status with RGB lighting/matrix (#21063)
Diffstat (limited to 'keyboards/crkbd')
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/config.h76
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/keycodes.h5
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/keymap.c10
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/layers_block.h4
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/process_records.c36
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/readme.md2
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/rgb.c61
-rw-r--r--keyboards/crkbd/keymaps/thunderbird2086/rules.mk1
8 files changed, 151 insertions, 44 deletions
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/config.h b/keyboards/crkbd/keymaps/thunderbird2086/config.h
index ad2bfcabc7..8251bc9b8f 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/config.h
+++ b/keyboards/crkbd/keymaps/thunderbird2086/config.h
@@ -14,6 +14,7 @@
# undef TAPPING_TERM
#endif
#define TAPPING_TERM 200
+#define VER_NEWLINE_WAIT 200 // in milliseconds
#define NO_ACTION_ONESHOT
@@ -32,63 +33,80 @@
#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 RGB_MATRIX_KEYPRESSES // reacts to keypresses
-# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
-# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150
+# 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.
-# define RGB_MATRIX_HUE_STEP 32
-# define RGB_MATRIX_SAT_STEP 64
-# define RGB_MATRIX_VAL_STEP 64
-# define RGB_MATRIX_SPD_STEP 20
-# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR
+# define RGB_MATRIX_HUE_STEP 32
+# define RGB_MATRIX_SAT_STEP 64
+# define RGB_MATRIX_VAL_STEP 64
+# define RGB_MATRIX_SPD_STEP 20
+# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR
/* 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
-# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
-# 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_MULTINEXUS
-# define ENABLE_RGB_MATRIX_SPLASH
-# undef ENABLE_RGB_MATRIX_MULTISPLASH
-# undef ENABLE_RGB_MATRIX_SOLID_SPLASH
-# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# 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
+# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# undef ENABLE_RGB_MATRIX_SPLASH
+# define ENABLE_RGB_MATRIX_MULTISPLASH
+# undef ENABLE_RGB_MATRIX_SOLID_SPLASH
+# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
#endif
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h b/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h
index cb10a3ac07..90b26b88a4 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h
+++ b/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h
@@ -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,
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/keymap.c b/keyboards/crkbd/keymaps/thunderbird2086/keymap.c
index 7bc23db8aa..69c5d25fd4 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/keymap.c
+++ b/keyboards/crkbd/keymaps/thunderbird2086/keymap.c
@@ -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);
}
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h b/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h
index ba41cd9223..db47ea65ed 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h
+++ b/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h
@@ -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)
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/process_records.c b/keyboards/crkbd/keymaps/thunderbird2086/process_records.c
index 381cf281e5..46b9126677 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/process_records.c
+++ b/keyboards/crkbd/keymaps/thunderbird2086/process_records.c
@@ -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) {
- set_single_persistent_default_layer(_COLEMAK);
- }
- break;
- case QWERTY:
- if (record->event.pressed) {
- set_single_persistent_default_layer(_QWERTY);
+ if (record->event.pressed) {
+ switch (keycode) {
+ case COLEMAK:
+ set_single_persistent_default_layer(_COLEMAK);
+ break;
+ case QWERTY:
+ 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;
}
- break;
}
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/readme.md b/keyboards/crkbd/keymaps/thunderbird2086/readme.md
index 6400309fe8..cb57f20aec 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/readme.md
+++ b/keyboards/crkbd/keymaps/thunderbird2086/readme.md
@@ -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
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/rgb.c b/keyboards/crkbd/keymaps/thunderbird2086/rgb.c
new file mode 100644
index 0000000000..d9b0003c88
--- /dev/null
+++ b/keyboards/crkbd/keymaps/thunderbird2086/rgb.c
@@ -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
diff --git a/keyboards/crkbd/keymaps/thunderbird2086/rules.mk b/keyboards/crkbd/keymaps/thunderbird2086/rules.mk
index 4da48db08e..adc61ea60d 100644
--- a/keyboards/crkbd/keymaps/thunderbird2086/rules.mk
+++ b/keyboards/crkbd/keymaps/thunderbird2086/rules.mk
@@ -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)","")