summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h1
-rw-r--r--keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c42
-rw-r--r--keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk22
-rw-r--r--keyboards/melody96/keymaps/konstantin/keymap.c2
-rw-r--r--keyboards/melody96/keymaps/konstantin/rules.mk21
-rw-r--r--keyboards/wasdat/keymaps/konstantin/rules.mk18
-rw-r--r--keyboards/whitefox/keymaps/konstantin/rules.mk22
-rw-r--r--users/konstantin/config.h6
-rw-r--r--users/konstantin/konstantin.c52
-rw-r--r--users/konstantin/konstantin.h22
-rw-r--r--users/konstantin/rgb.c7
-rw-r--r--users/konstantin/rgb.h12
-rw-r--r--users/konstantin/tap_dance.c2
-rw-r--r--users/konstantin/tap_dance.h4
14 files changed, 151 insertions, 82 deletions
diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h b/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h
index 16387fa2f6..4b511eb848 100644
--- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h
+++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/config.h
@@ -1,4 +1,3 @@
#pragma once
#define LAYER_FN
-#define SEND_STRING_CLEAN
diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c
index b348b0b7bf..c5c8c09636 100644
--- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c
+++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c
@@ -10,7 +10,7 @@ enum layers_keymap {
};
void eeconfig_init_keymap(void) {
- rgblight_sethsv(MODERN_DOLCH_RED.h, MODERN_DOLCH_RED.s, MODERN_DOLCH_RED.v);
+ rgblight_sethsv(MODERN_DOLCH_RED);
rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL);
}
@@ -31,6 +31,46 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
}
+static bool skip_caps = false;
+
+static void fn_light(uint32_t state) {
+ if (IS_LAYER_ON_STATE(state, L_FN)) {
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+ rgblight_sethsv_noeeprom(modern_dolch_red.h, modern_dolch_red.s, rgblight_get_val());
+ skip_caps = true;
+ } else {
+ rgblight_config_t saved = { .raw = eeconfig_read_rgblight() };
+ rgblight_sethsv_noeeprom(saved.hue, saved.sat, saved.val);
+ rgblight_mode_noeeprom(saved.mode);
+ }
+ // caps_light will be called automatically after this
+}
+
+static void caps_light(uint8_t usb_led) {
+ if (skip_caps) {
+ skip_caps = false;
+ return; // Skip calls triggered by the Fn layer turning on
+ }
+ if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+ rgblight_sethsv_noeeprom(modern_dolch_cyan.h, modern_dolch_cyan.s, rgblight_get_val());
+ } else {
+ fn_light(layer_state); // Caps is off, check if Fn light should be on
+ }
+}
+
+uint32_t layer_state_set_keymap(uint32_t state) {
+ static uint32_t prev_state = L_BASE;
+ if (IS_LAYER_ON_STATE(state, L_FN) != IS_LAYER_ON_STATE(prev_state, L_FN)) {
+ fn_light(state); // Fn state changed since last time
+ }
+ return prev_state = state;
+}
+
+void led_set_keymap(uint8_t usb_led) {
+ caps_light(usb_led);
+}
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base layer
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk
index f7cf0758b7..7262c6db66 100644
--- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk
+++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/rules.mk
@@ -1,11 +1,11 @@
-BOOTMAGIC_ENABLE = no
-COMMAND_ENABLE = yes
-CONSOLE_ENABLE = no
-EXTRAKEY_ENABLE = yes
-MOUSEKEY_ENABLE = yes
-NKRO_ENABLE = yes
-TAP_DANCE_ENABLE = yes
-UNICODEMAP_ENABLE = no
-
-BACKLIGHT_ENABLE = yes
-RGBLIGHT_ENABLE = yes
+BACKLIGHT_ENABLE = no
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = yes
+CONSOLE_ENABLE = yes
+EXTRAKEY_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+NKRO_ENABLE = yes
+RGBLIGHT_ENABLE = yes
+SPACE_CADET_ENABLE = no
+TAP_DANCE_ENABLE = yes
+UNICODEMAP_ENABLE = no
diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/melody96/keymaps/konstantin/keymap.c
index c2b0431047..e02ba0f85e 100644
--- a/keyboards/melody96/keymaps/konstantin/keymap.c
+++ b/keyboards/melody96/keymaps/konstantin/keymap.c
@@ -1,7 +1,7 @@
#include QMK_KEYBOARD_H
#include "konstantin.h"
-static const HSV *colors[] = { &GODSPEED_BLUE, &GODSPEED_YELLOW };
+static const HSV *colors[] = { &godspeed_blue, &godspeed_yellow };
static const size_t cnum = sizeof colors / sizeof *colors;
static size_t cidx = 0;
diff --git a/keyboards/melody96/keymaps/konstantin/rules.mk b/keyboards/melody96/keymaps/konstantin/rules.mk
index 47a859d089..995402cb05 100644
--- a/keyboards/melody96/keymaps/konstantin/rules.mk
+++ b/keyboards/melody96/keymaps/konstantin/rules.mk
@@ -1,10 +1,11 @@
-BOOTMAGIC_ENABLE = no
-COMMAND_ENABLE = yes
-CONSOLE_ENABLE = no
-EXTRAKEY_ENABLE = yes
-MOUSEKEY_ENABLE = yes
-NKRO_ENABLE = yes
-TAP_DANCE_ENABLE = yes
-UNICODEMAP_ENABLE = yes
-
-BACKLIGHT_ENABLE = no
+BACKLIGHT_ENABLE = no
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = yes
+CONSOLE_ENABLE = no
+EXTRAKEY_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+NKRO_ENABLE = yes
+RGBLIGHT_ENABLE = yes
+SPACE_CADET_ENABLE = no
+TAP_DANCE_ENABLE = yes
+UNICODEMAP_ENABLE = yes
diff --git a/keyboards/wasdat/keymaps/konstantin/rules.mk b/keyboards/wasdat/keymaps/konstantin/rules.mk
index 4bb1ee6588..041d321145 100644
--- a/keyboards/wasdat/keymaps/konstantin/rules.mk
+++ b/keyboards/wasdat/keymaps/konstantin/rules.mk
@@ -1,8 +1,10 @@
-BOOTMAGIC_ENABLE = no
-COMMAND_ENABLE = yes
-CONSOLE_ENABLE = yes
-EXTRAKEY_ENABLE = yes
-MOUSEKEY_ENABLE = yes
-NKRO_ENABLE = yes
-TAP_DANCE_ENABLE = yes
-UNICODEMAP_ENABLE = yes
+BACKLIGHT_ENABLE = no
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = yes
+CONSOLE_ENABLE = yes
+EXTRAKEY_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+NKRO_ENABLE = yes
+SPACE_CADET_ENABLE = no
+TAP_DANCE_ENABLE = yes
+UNICODEMAP_ENABLE = yes
diff --git a/keyboards/whitefox/keymaps/konstantin/rules.mk b/keyboards/whitefox/keymaps/konstantin/rules.mk
index 625ef346c8..bced6e8a70 100644
--- a/keyboards/whitefox/keymaps/konstantin/rules.mk
+++ b/keyboards/whitefox/keymaps/konstantin/rules.mk
@@ -1,11 +1,11 @@
-BOOTMAGIC_ENABLE = no
-COMMAND_ENABLE = yes
-CONSOLE_ENABLE = yes
-EXTRAKEY_ENABLE = yes
-MOUSEKEY_ENABLE = yes
-NKRO_ENABLE = yes
-TAP_DANCE_ENABLE = yes
-UNICODEMAP_ENABLE = yes
-
-BACKLIGHT_ENABLE = no
-VISUALIZER_ENABLE = no
+BACKLIGHT_ENABLE = no
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = yes
+CONSOLE_ENABLE = yes
+EXTRAKEY_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+NKRO_ENABLE = yes
+SPACE_CADET_ENABLE = no
+TAP_DANCE_ENABLE = yes
+UNICODEMAP_ENABLE = yes
+VISUALIZER_ENABLE = no
diff --git a/users/konstantin/config.h b/users/konstantin/config.h
index 4edab2baab..d712e79d3f 100644
--- a/users/konstantin/config.h
+++ b/users/konstantin/config.h
@@ -13,6 +13,12 @@
#define NO_ACTION_MACRO
#define NO_ACTION_ONESHOT
+#undef RGBLIGHT_ANIMATIONS
+#define RGBLIGHT_EFFECT_BREATHING
+#define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#define RGBLIGHT_EFFECT_SNAKE
+
#define PERMISSIVE_HOLD
#define TAPPING_TERM 200
#define TAPPING_TOGGLE 2
diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c
index 9e3caca414..c56c9490fc 100644
--- a/users/konstantin/konstantin.c
+++ b/users/konstantin/konstantin.c
@@ -32,26 +32,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
switch (keycode) {
- case CLEAR:
- if (record->event.pressed) {
- SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
- }
- return false;
-
- case DST_P_R:
- (record->event.pressed ? register_code16 : unregister_code16)(
- (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV
- );
- return false;
-
- case DST_N_A:
- (record->event.pressed ? register_code16 : unregister_code16)(
- (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT
- );
- return false;
-
+ uint16_t kc;
#ifdef LAYER_FN
- static bool fn_lock;
+ static bool fn_lock = false;
case FN_FNLK:
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
@@ -77,6 +60,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
+ case CLEAR:
+ if (record->event.pressed) {
+ CLEAN_MODS(
+ SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
+ )
+ }
+ return false;
+
+ case DST_P_R:
+ kc = (get_mods() & DST_MOD_MASK) ? DST_REM : DST_PRV;
+ CLEAN_MODS(
+ (record->event.pressed ? register_code16 : unregister_code16)(kc);
+ )
+ return false;
+
+ case DST_N_A:
+ kc = (get_mods() & DST_MOD_MASK) ? DST_ADD : DST_NXT;
+ CLEAN_MODS(
+ (record->event.pressed ? register_code16 : unregister_code16)(kc);
+ )
+ return false;
+
default:
return true;
}
@@ -91,7 +96,7 @@ uint32_t layer_state_set_user(uint32_t state) {
state = layer_state_set_keymap(state);
#ifdef LAYER_NUMPAD
- bool numpad = state & 1UL<<L_NUMPAD;
+ bool numpad = IS_LAYER_ON_STATE(state, L_NUMPAD);
bool num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK);
if (numpad != num_lock) {
tap_code(KC_NLCK); // Toggle Num Lock to match Numpad layer state
@@ -100,3 +105,10 @@ uint32_t layer_state_set_user(uint32_t state) {
return state;
}
+
+__attribute__((weak))
+void led_set_keymap(uint8_t usb_led) {}
+
+void led_set_user(uint8_t usb_led) {
+ led_set_keymap(usb_led);
+}
diff --git a/users/konstantin/konstantin.h b/users/konstantin/konstantin.h
index d43712b965..84d90dda57 100644
--- a/users/konstantin/konstantin.h
+++ b/users/konstantin/konstantin.h
@@ -47,15 +47,16 @@
#define LCT_CPS LCTL_T(KC_CAPS)
-#ifdef SEND_STRING_CLEAN
- #undef SEND_STRING
- #define SEND_STRING(string) { \
- uint8_t ss_mods = get_mods(); \
- clear_mods(); \
- send_string_P(PSTR(string)); \
- set_mods(ss_mods); \
- }
-#endif
+#define IS_LAYER_ON_STATE(state, layer) ( (state) & (1UL << (layer)))
+#define IS_LAYER_OFF_STATE(state, layer) (~(state) & (1UL << (layer)))
+
+// Clear mods, perform action, restore mods
+#define CLEAN_MODS(action) { \
+ uint8_t mods = get_mods(); \
+ clear_mods(); \
+ action; \
+ set_mods(mods); \
+ }
enum keycodes_user {
CLEAR = SAFE_RANGE,
@@ -81,5 +82,6 @@ void keyboard_pre_init_keymap(void);
void eeconfig_init_keymap(void);
void keyboard_post_init_keymap(void);
-bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
uint32_t layer_state_set_keymap(uint32_t state);
+void led_set_keymap(uint8_t usb_led);
diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c
index a96cad019d..fffa250f25 100644
--- a/users/konstantin/rgb.c
+++ b/users/konstantin/rgb.c
@@ -20,6 +20,7 @@ const uint8_t PROGMEM RGBLED_SNAKE_INTERVALS[] = { 20, 50, 100 };
const uint8_t PROGMEM RGBLED_KNIGHT_INTERVALS[] = { 20, 50, 100 };
#endif
-const HSV GODSPEED_BLUE = { .h = 198, .s = 68, .v = 255 };
-const HSV GODSPEED_YELLOW = { .h = 27, .s = 153, .v = 255 };
-const HSV MODERN_DOLCH_RED = { .h = 252, .s = 255, .v = 144 };
+const HSV godspeed_blue = { GODSPEED_BLUE };
+const HSV godspeed_yellow = { GODSPEED_YELLOW };
+const HSV modern_dolch_cyan = { MODERN_DOLCH_CYAN };
+const HSV modern_dolch_red = { MODERN_DOLCH_RED };
diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h
index 36a9d9cd74..cc7d91808a 100644
--- a/users/konstantin/rgb.h
+++ b/users/konstantin/rgb.h
@@ -2,6 +2,12 @@
#include "quantum.h"
-extern const HSV GODSPEED_BLUE;
-extern const HSV GODSPEED_YELLOW;
-extern const HSV MODERN_DOLCH_RED;
+#define GODSPEED_BLUE 198, 68, 255
+#define GODSPEED_YELLOW 27, 153, 255
+#define MODERN_DOLCH_CYAN 110, 255, 108
+#define MODERN_DOLCH_RED 251, 255, 108
+
+extern const HSV godspeed_blue;
+extern const HSV godspeed_yellow;
+extern const HSV modern_dolch_cyan;
+extern const HSV modern_dolch_red;
diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c
index ba1453fc05..b36bc3dcc8 100644
--- a/users/konstantin/tap_dance.c
+++ b/users/konstantin/tap_dance.c
@@ -107,12 +107,12 @@ void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM),
- [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT),
[TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI),
[TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT),
[TD_RSF_RCT] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RSFT, KC_RCTL),
[TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN),
[TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN),
+
[TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL),
};
diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h
index d2f00c8cb3..461d7ba8a9 100644
--- a/users/konstantin/tap_dance.h
+++ b/users/konstantin/tap_dance.h
@@ -4,24 +4,24 @@
#define DST_A_R TD(TD_DST_A_R)
-#define RAL_LAL TD(TD_RAL_LAL)
#define RAL_RGU TD(TD_RAL_RGU)
#define RCT_RSF TD(TD_RCT_RSF)
#define RSF_RCT TD(TD_RSF_RCT)
#define LSFT_FN TD(TD_LSFT_FN)
#define RCTL_FN TD(TD_RCTL_FN)
+
#define FN_RCTL TD(TD_FN_RCTL)
enum tap_dance {
TD_DST_A_R,
- TD_RAL_LAL,
TD_RAL_RGU,
TD_RCT_RSF,
TD_RSF_RCT,
TD_LSFT_FN,
TD_RCTL_FN,
+
TD_FN_RCTL,
};