diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/bocaj/wrappers.h | 14 | ||||
-rw-r--r-- | users/brandonschlack/brandonschlack.h | 1 | ||||
-rw-r--r-- | users/callum/callum.c | 4 | ||||
-rw-r--r-- | users/hvp/hvp.h | 3 | ||||
-rwxr-xr-x | users/ishtob/config.h | 3 | ||||
-rw-r--r-- | users/spidey3/config.h | 5 | ||||
-rw-r--r-- | users/spidey3/init.c | 7 | ||||
-rw-r--r-- | users/spidey3/layer_rgb.c | 397 | ||||
-rw-r--r-- | users/spidey3/rules.mk | 2 | ||||
-rw-r--r-- | users/spidey3/spidey3.c | 168 | ||||
-rw-r--r-- | users/spidey3/spidey3.h | 5 | ||||
-rw-r--r-- | users/spidey3/unicode.h | 2 |
12 files changed, 425 insertions, 186 deletions
diff --git a/users/bocaj/wrappers.h b/users/bocaj/wrappers.h index c76820f49..0f18d346a 100644 --- a/users/bocaj/wrappers.h +++ b/users/bocaj/wrappers.h | |||
@@ -12,7 +12,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro. | |||
12 | 12 | ||
13 | // clang-format off | 13 | // clang-format off |
14 | #define WRAPPER_ergodox_pretty(...) LAYOUT_ergodox_pretty(__VA_ARGS__) | 14 | #define WRAPPER_ergodox_pretty(...) LAYOUT_ergodox_pretty(__VA_ARGS__) |
15 | #define WRAPPER_ortho_4x12(...) LAYOUT_planck_mit(__VA_ARGS__) | 15 | #define WRAPPER_ortho_4x12(...) LAYOUT_ortho_4x12(__VA_ARGS__) |
16 | 16 | ||
17 | /* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ | 17 | /* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */ |
18 | #define WRAPPER_ergodox_bocaj( \ | 18 | #define WRAPPER_ergodox_bocaj( \ |
@@ -62,25 +62,25 @@ expanded before being used as arguments to the LAYOUT_xxx macro. | |||
62 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ | 62 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ |
63 | K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ | 63 | K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ |
64 | K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | 64 | K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ |
65 | K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ | 65 | K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C \ |
66 | )\ | 66 | )\ |
67 | WRAPPER_ortho_4x12( \ | 67 | WRAPPER_ortho_4x12( \ |
68 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ | 68 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ |
69 | K11, K12, SFT_T(K13), GUI_T(K14), ALT_T(K15), K16, K17, ALT_T(K18), GUI_T(K19), SFT_T(K1A), K1B, K1C, \ | 69 | K11, K12, SFT_T(K13), GUI_T(K14), ALT_T(K15), K16, K17, ALT_T(K18), GUI_T(K19), SFT_T(K1A), K1B, K1C, \ |
70 | K21, CTL_T(K22), K23, K24, K25, K26, K27, K28, K29, K2A, CTL_T(K2B), K2C, \ | 70 | K21, CTL_T(K22), K23, K24, K25, K26, K27, K28, K29, K2A, CTL_T(K2B), K2C, \ |
71 | K31, K32, K33, K34, LT(_LOWER, K35), K36, LT(_RAISE, K37), K38, K39, K3A, K3B ) | 71 | K31, K32, K33, K34, LT(_LOWER, K35), K36, K37, LT(_RAISE, K38), K39, K3A, K3B, K3C ) |
72 | 72 | ||
73 | #define WRAPPER_planck_bocaj_WIN( \ | 73 | #define WRAPPER_planck_bocaj_WIN( \ |
74 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ | 74 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ |
75 | K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ | 75 | K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \ |
76 | K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | 76 | K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ |
77 | K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ | 77 | K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C \ |
78 | )\ | 78 | )\ |
79 | WRAPPER_ortho_4x12( \ | 79 | WRAPPER_ortho_4x12( \ |
80 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ | 80 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \ |
81 | K11, K12, SFT_T(K13), CTL_T(K14), ALT_T(K15), K16, K17, ALT_T(K18), CTL_T(K19), SFT_T(K1A), K1B, K1C, \ | 81 | K11, K12, SFT_T(K13), CTL_T(K14), ALT_T(K15), K16, K17, ALT_T(K18), CTL_T(K19), SFT_T(K1A), K1B, K1C, \ |
82 | K21, GUI_T(K22), K23, K24, K25, K26, K27, K28, K29, K2A, GUI_T(K2B), K2C, \ | 82 | K21, GUI_T(K22), K23, K24, K25, K26, K27, K28, K29, K2A, GUI_T(K2B), K2C, \ |
83 | K31, K32, K33, K34, LT(_LOWER, K35), K36, LT(_RAISE, K37), K38, K39, K3A, K3B ) | 83 | K31, K32, K33, K34, LT(_LOWER, K35), K36, K37, LT(_RAISE, K38), K39, K3A, K3B, K3C ) |
84 | 84 | ||
85 | #define WRAPPER_planck_bocaj_base( \ | 85 | #define WRAPPER_planck_bocaj_base( \ |
86 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ | 86 | K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ |
@@ -91,7 +91,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro. | |||
91 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ | 91 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ |
92 | KC_TAB, K11, K12, K13, K14, ALL_T(K15), MEH_T(K16), K17, K18, K19, K1A, KC_QUOT, \ | 92 | KC_TAB, K11, K12, K13, K14, ALL_T(K15), MEH_T(K16), K17, K18, K19, K1A, KC_QUOT, \ |
93 | KC_LSFT, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, _______, \ | 93 | KC_LSFT, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, _______, \ |
94 | _______, KC_LEAD, KC_UP, KC_LEFT, KC_BSPC, KC_SPC, KC_ENTER, KC_RIGHT, KC_DOWN, QWERTY, WORKMAN \ | 94 | _______, KC_LEAD, KC_UP, KC_LEFT, KC_BSPC, KC_SPC, KC_SPC, KC_ENTER, KC_RIGHT, KC_DOWN, QWERTY, WORKMAN \ |
95 | ) | 95 | ) |
96 | 96 | ||
97 | #define WRAPPER_planck_bocaj_base_WIN( \ | 97 | #define WRAPPER_planck_bocaj_base_WIN( \ |
@@ -103,7 +103,7 @@ expanded before being used as arguments to the LAYOUT_xxx macro. | |||
103 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ | 103 | KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ |
104 | KC_TAB, K11, K12, K13, K14, ALL_T(K15), MEH_T(K16), K17, K18, K19, K1A, KC_QUOT, \ | 104 | KC_TAB, K11, K12, K13, K14, ALL_T(K15), MEH_T(K16), K17, K18, K19, K1A, KC_QUOT, \ |
105 | KC_LSFT, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, _______, \ | 105 | KC_LSFT, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, _______, \ |
106 | _______, KC_LEAD, KC_UP, KC_LEFT, KC_BSPC, KC_SPC, KC_ENTER, KC_RIGHT, KC_DOWN, QWERTY, WORKMAN \ | 106 | _______, KC_LEAD, KC_UP, KC_LEFT, KC_BSPC, KC_SPC, KC_SPC, KC_ENTER, KC_RIGHT, KC_DOWN, QWERTY, WORKMAN \ |
107 | ) | 107 | ) |
108 | 108 | ||
109 | /* | 109 | /* |
diff --git a/users/brandonschlack/brandonschlack.h b/users/brandonschlack/brandonschlack.h index d7dbc0ea4..4fbf6906d 100644 --- a/users/brandonschlack/brandonschlack.h +++ b/users/brandonschlack/brandonschlack.h | |||
@@ -46,6 +46,7 @@ enum bs_layers { | |||
46 | _ADJUST = 15 // 15: Change keyboard settings | 46 | _ADJUST = 15 // 15: Change keyboard settings |
47 | }; | 47 | }; |
48 | 48 | ||
49 | #define _MACRO _M1 | ||
49 | #define _LOWER _FN1 | 50 | #define _LOWER _FN1 |
50 | #define _RAISE _FN2 | 51 | #define _RAISE _FN2 |
51 | 52 | ||
diff --git a/users/callum/callum.c b/users/callum/callum.c index 4661902af..b3254a9cf 100644 --- a/users/callum/callum.c +++ b/users/callum/callum.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #define TABL G(S(KC_LBRC)) | 10 | #define TABL G(S(KC_LBRC)) |
11 | #define TABR G(S(KC_RBRC)) | 11 | #define TABR G(S(KC_RBRC)) |
12 | #define SPCL A(G(KC_LEFT)) | 12 | #define SPCL A(G(KC_LEFT)) |
13 | #define SPCR A(G(KC_RGHT)) | 13 | #define SPC_R A(G(KC_RGHT)) |
14 | #define LA_SYM MO(SYM) | 14 | #define LA_SYM MO(SYM) |
15 | #define LA_NAV MO(NAV) | 15 | #define LA_NAV MO(NAV) |
16 | 16 | ||
@@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
50 | [NAV] = LAYOUT_callum( | 50 | [NAV] = LAYOUT_callum( |
51 | KC_TAB, SW_WIN, TABL, TABR, KC_VOLU, RESET, HOME, KC_UP, END, KC_DEL, | 51 | KC_TAB, SW_WIN, TABL, TABR, KC_VOLU, RESET, HOME, KC_UP, END, KC_DEL, |
52 | OS_SHFT, OS_CTRL, OS_ALT, OS_CMD, KC_VOLD, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, | 52 | OS_SHFT, OS_CTRL, OS_ALT, OS_CMD, KC_VOLD, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, |
53 | SPCL, SPCR, BACK, FWD, KC_MPLY, XXXXXXX, KC_PGDN, KC_PGUP, SW_LANG, KC_ENT, | 53 | SPCL, SPC_R, BACK, FWD, KC_MPLY, XXXXXXX, KC_PGDN, KC_PGUP, SW_LANG, KC_ENT, |
54 | _______, _______, _______, _______ | 54 | _______, _______, _______, _______ |
55 | ), | 55 | ), |
56 | 56 | ||
diff --git a/users/hvp/hvp.h b/users/hvp/hvp.h index 99da258aa..b016da9e2 100644 --- a/users/hvp/hvp.h +++ b/users/hvp/hvp.h | |||
@@ -5,8 +5,9 @@ | |||
5 | #endif | 5 | #endif |
6 | #include "quantum.h" | 6 | #include "quantum.h" |
7 | 7 | ||
8 | #undef TAPPING_TERM | ||
8 | #define TAPPING_TERM 150 | 9 | #define TAPPING_TERM 150 |
9 | 10 | ||
10 | // Keys | 11 | // Keys |
11 | 12 | ||
12 | #define D_NAVI MT(MOD_LCTL | MOD_LSFT, KC_D) \ No newline at end of file | 13 | #define D_NAVI MT(MOD_LCTL | MOD_LSFT, KC_D) |
diff --git a/users/ishtob/config.h b/users/ishtob/config.h index 1f567f4a5..6c07d2f2f 100755 --- a/users/ishtob/config.h +++ b/users/ishtob/config.h | |||
@@ -50,9 +50,6 @@ | |||
50 | * MIDI options | 50 | * MIDI options |
51 | */ | 51 | */ |
52 | 52 | ||
53 | /* Prevent use of disabled MIDI features in the keymap */ | ||
54 | //#define MIDI_ENABLE_STRICT 1 | ||
55 | |||
56 | /* enable basic MIDI features: | 53 | /* enable basic MIDI features: |
57 | - MIDI notes can be sent when in Music mode is on | 54 | - MIDI notes can be sent when in Music mode is on |
58 | */ | 55 | */ |
diff --git a/users/spidey3/config.h b/users/spidey3/config.h index 053240718..7062fde03 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h | |||
@@ -3,9 +3,10 @@ | |||
3 | #define LED_DISABLE_WHEN_USB_SUSPENDED true | 3 | #define LED_DISABLE_WHEN_USB_SUSPENDED true |
4 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true | 4 | #define RGB_DISABLE_WHEN_USB_SUSPENDED true |
5 | #define RGBLIGHT_LAYERS | 5 | #define RGBLIGHT_LAYERS |
6 | #define RGBLIGHT_MAX_LAYERS 16 | 6 | #define RGBLIGHT_MAX_LAYERS 17 |
7 | #define RGBLIGHT_LAYER_BLINK | 7 | #define RGBLIGHT_LAYER_BLINK |
8 | #define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF | 8 | #define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF |
9 | #define RGBLIGHT_STARTUP_ANIMATION | ||
9 | 10 | ||
10 | #undef RGBLIGHT_ANIMATIONS | 11 | #undef RGBLIGHT_ANIMATIONS |
11 | #define RGBLIGHT_EFFECT_BREATHING | 12 | #define RGBLIGHT_EFFECT_BREATHING |
@@ -17,6 +18,8 @@ | |||
17 | #define RGBLIGHT_EFFECT_ALTERNATING | 18 | #define RGBLIGHT_EFFECT_ALTERNATING |
18 | #define RGBLIGHT_EFFECT_TWINKLE | 19 | #define RGBLIGHT_EFFECT_TWINKLE |
19 | 20 | ||
21 | #define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC | ||
22 | |||
20 | #define SPI_DEBUG_SCAN_RATE | 23 | #define SPI_DEBUG_SCAN_RATE |
21 | 24 | ||
22 | #undef MANUFACTURER | 25 | #undef MANUFACTURER |
diff --git a/users/spidey3/init.c b/users/spidey3/init.c index 273c2b289..8db41a5f4 100644 --- a/users/spidey3/init.c +++ b/users/spidey3/init.c | |||
@@ -18,11 +18,6 @@ void eeconfig_init_user(void) { | |||
18 | #endif | 18 | #endif |
19 | } | 19 | } |
20 | 20 | ||
21 | void shutdown_user() { | ||
22 | #ifdef RGBLIGHT_ENABLE | 21 | #ifdef RGBLIGHT_ENABLE |
23 | clear_rgb_layers(); | 22 | void shutdown_user(void) { shutdown_user_rgb(); } |
24 | rgblight_enable(); | ||
25 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
26 | rgblight_sethsv_noeeprom(HSV_RED); | ||
27 | #endif | 23 | #endif |
28 | } | ||
diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index 160cc4317..37e59579c 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include "spidey3.h" | 3 | #include "spidey3.h" |
4 | #include "velocikey.h" | 4 | #include "velocikey.h" |
5 | #include <lib/lib8tion/lib8tion.h> | ||
5 | 6 | ||
6 | uint32_t rgb_mode; | 7 | uint32_t rgb_mode; |
7 | uint16_t rgb_hue; | 8 | uint16_t rgb_hue; |
@@ -9,10 +10,17 @@ uint8_t rgb_sat; | |||
9 | uint8_t rgb_val; | 10 | uint8_t rgb_val; |
10 | bool rgb_saved = 0; | 11 | bool rgb_saved = 0; |
11 | 12 | ||
13 | extern bool spi_gflock; | ||
14 | extern uint16_t spi_replace_mode; | ||
15 | |||
12 | void spidey_glow(void) { | 16 | void spidey_glow(void) { |
13 | rgblight_enable(); | 17 | rgblight_enable(); |
14 | rgblight_mode(RGBLIGHT_MODE_TWINKLE + 4); | ||
15 | rgblight_sethsv(213, 255, 128); | 18 | rgblight_sethsv(213, 255, 128); |
19 | if ((RGBLIGHT_MODE_TWINKLE <= rgblight_get_mode()) && (rgblight_get_mode() < RGBLIGHT_MODE_TWINKLE_end)) { | ||
20 | rgblight_step(); | ||
21 | } else { | ||
22 | rgblight_mode(RGBLIGHT_MODE_TWINKLE); | ||
23 | } | ||
16 | #ifdef VELOCIKEY_ENABLE | 24 | #ifdef VELOCIKEY_ENABLE |
17 | if (velocikey_enabled()) velocikey_toggle(); | 25 | if (velocikey_enabled()) velocikey_toggle(); |
18 | #endif | 26 | #endif |
@@ -23,6 +31,7 @@ void eeconfig_init_user_rgb(void) { spidey_glow(); } | |||
23 | // clang-format off | 31 | // clang-format off |
24 | 32 | ||
25 | // Convenience macros | 33 | // Convenience macros |
34 | #define NONE { RGBLIGHT_END_SEGMENTS } | ||
26 | #define CORNER_BL(color) { 0, 1, color } | 35 | #define CORNER_BL(color) { 0, 1, color } |
27 | #define CORNER_BR(color) { RGBLED_NUM / 2 - 1, 1, color } | 36 | #define CORNER_BR(color) { RGBLED_NUM / 2 - 1, 1, color } |
28 | #define CORNER_FR(color) { RGBLED_NUM / 2, 1, color } | 37 | #define CORNER_FR(color) { RGBLED_NUM / 2, 1, color } |
@@ -31,10 +40,12 @@ void eeconfig_init_user_rgb(void) { spidey_glow(); } | |||
31 | #define FRONT(inset, color) { RGBLED_NUM / 2 + inset, RGBLED_NUM / 2 - 2 * inset, color } | 40 | #define FRONT(inset, color) { RGBLED_NUM / 2 + inset, RGBLED_NUM / 2 - 2 * inset, color } |
32 | #define BACK(inset, color) { inset, RGBLED_NUM / 2 - 2 * inset, color } | 41 | #define BACK(inset, color) { inset, RGBLED_NUM / 2 - 2 * inset, color } |
33 | 42 | ||
43 | const rgblight_segment_t PROGMEM _none[] = NONE; | ||
44 | |||
34 | #define LAYER_OFFSET 0 | 45 | #define LAYER_OFFSET 0 |
35 | const rgblight_segment_t PROGMEM _layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_PURPLE)); | 46 | // No indicator for base layer |
36 | const rgblight_segment_t PROGMEM _layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNERS(HSV_MAGENTA)); | 47 | const rgblight_segment_t PROGMEM _layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNERS(HSV_MAGENTA)); // _NUMPAD |
37 | const rgblight_segment_t PROGMEM _layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNERS(HSV_GREEN)); | 48 | const rgblight_segment_t PROGMEM _layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNERS(HSV_GREEN)); // _FN |
38 | 49 | ||
39 | #define LOCK_OFFSET 3 | 50 | #define LOCK_OFFSET 3 |
40 | const rgblight_segment_t PROGMEM _numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(3, HSV_YELLOW)); | 51 | const rgblight_segment_t PROGMEM _numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(3, HSV_YELLOW)); |
@@ -49,12 +60,20 @@ const rgblight_segment_t PROGMEM _glyphreplace_layer[] = RGBLIGHT_LAYER_SEGMENTS | |||
49 | const rgblight_segment_t PROGMEM _no_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_RED)); | 60 | const rgblight_segment_t PROGMEM _no_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_RED)); |
50 | const rgblight_segment_t PROGMEM _yes_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_GREEN)); | 61 | const rgblight_segment_t PROGMEM _yes_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_GREEN)); |
51 | const rgblight_segment_t PROGMEM _meh_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_YELLOW)); | 62 | const rgblight_segment_t PROGMEM _meh_layer[] = RGBLIGHT_LAYER_SEGMENTS(FRONT(1, HSV_YELLOW)); |
63 | const rgblight_segment_t PROGMEM _huh_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNERS(HSV_YELLOW), FRONT(1, HSV_BLUE), BACK(1, HSV_BLUE)); | ||
64 | |||
65 | #define UNICODE_OFFSET 12 | ||
66 | const rgblight_segment_t PROGMEM _uc_mac_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_PURPLE)); | ||
67 | // No indicator for UC_LNX | ||
68 | // UC_WIN disabled in config.h | ||
69 | // UC_BSD not implemented | ||
70 | const rgblight_segment_t PROGMEM _uc_winc_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_CYAN)); | ||
52 | 71 | ||
53 | // Now define the array of layers. Higher numbered layers take precedence. | 72 | // Now define the array of layers. Higher numbered layers take precedence. |
54 | const rgblight_segment_t *const PROGMEM _rgb_layers[] = { | 73 | const rgblight_segment_t *const PROGMEM _rgb_layers[] = { |
55 | [LAYER_OFFSET + 0] = _layer1_layer, | 74 | [LAYER_OFFSET + _BASE] = _none, |
56 | [LAYER_OFFSET + 1] = _layer2_layer, | 75 | [LAYER_OFFSET + _NUMPAD] = _layer1_layer, |
57 | [LAYER_OFFSET + 2] = _layer3_layer, | 76 | [LAYER_OFFSET + _FN] = _layer2_layer, |
58 | 77 | ||
59 | [LOCK_OFFSET + USB_LED_NUM_LOCK] = _numlock_layer, | 78 | [LOCK_OFFSET + USB_LED_NUM_LOCK] = _numlock_layer, |
60 | [LOCK_OFFSET + USB_LED_CAPS_LOCK] = _capslock_layer, | 79 | [LOCK_OFFSET + USB_LED_CAPS_LOCK] = _capslock_layer, |
@@ -66,11 +85,18 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { | |||
66 | [ACK_OFFSET + ACK_NO] = _no_layer, | 85 | [ACK_OFFSET + ACK_NO] = _no_layer, |
67 | [ACK_OFFSET + ACK_YES] = _yes_layer, | 86 | [ACK_OFFSET + ACK_YES] = _yes_layer, |
68 | [ACK_OFFSET + ACK_MEH] = _meh_layer, | 87 | [ACK_OFFSET + ACK_MEH] = _meh_layer, |
88 | [ACK_OFFSET + ACK_HUH] = _huh_layer, | ||
89 | |||
90 | [UNICODE_OFFSET + UC_MAC] = _uc_mac_layer, | ||
91 | [UNICODE_OFFSET + UC_LNX] = _none, | ||
92 | [UNICODE_OFFSET + UC_WIN] = _none, | ||
93 | [UNICODE_OFFSET + UC_BSD] = _none, | ||
94 | [UNICODE_OFFSET + UC_WINC] = _uc_winc_layer, | ||
69 | 95 | ||
70 | [ACK_OFFSET + ACK_MEH + 1] = NULL | 96 | [UNICODE_OFFSET + UC__COUNT] = NULL |
71 | }; | 97 | }; |
72 | 98 | ||
73 | // clang-format on | 99 | // clang-format on |
74 | 100 | ||
75 | const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; | 101 | const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; |
76 | 102 | ||
@@ -84,118 +110,259 @@ void clear_rgb_layers() { | |||
84 | void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { | 110 | void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { |
85 | for (uint8_t i = start; i < end; i++) { | 111 | for (uint8_t i = start; i < end; i++) { |
86 | bool is_on = layer_state_cmp(state, i); | 112 | bool is_on = layer_state_cmp(state, i); |
87 | dprintf("layer[%u]=%u\n", i, is_on); | 113 | dprintf("layer[%u]=rl[%u]=%u\n", i, LAYER_OFFSET + i, is_on); |
88 | rgblight_set_layer_state(LAYER_OFFSET + i - 1, is_on); | 114 | rgblight_set_layer_state(LAYER_OFFSET + i, is_on); |
89 | } | 115 | } |
90 | } | 116 | } |
91 | 117 | ||
118 | void do_rgb_unicode(void) { | ||
119 | uint8_t uc_mode = get_unicode_input_mode(); | ||
120 | for (uint8_t i = 0; i < UC__COUNT; i++) { | ||
121 | bool is_on = i == uc_mode; | ||
122 | dprintf("unicode[%u]=rl[%u]=%u\n", i, UNICODE_OFFSET + i, is_on); | ||
123 | rgblight_set_layer_state(UNICODE_OFFSET + i, is_on); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | void do_rgb_all(void) { | ||
128 | do_rgb_layers(default_layer_state, LAYER_BASE_DEFAULT, LAYER_BASE_REGULAR); | ||
129 | do_rgb_layers(layer_state, LAYER_BASE_REGULAR, LAYER_BASE_END); | ||
130 | do_rgb_unicode(); | ||
131 | rgblight_set_layer_state(MISC_OFFSET + 0, spi_gflock); | ||
132 | rgblight_set_layer_state(MISC_OFFSET + 1, spi_replace_mode != SPI_NORMAL); | ||
133 | } | ||
134 | |||
135 | // flags. 0 = no change, 1 = increment, -1 = decrement. | ||
136 | int8_t change_hue = 0; | ||
137 | int8_t change_sat = 0; | ||
138 | int8_t change_val = 0; | ||
139 | |||
140 | // timer to control color change speed | ||
141 | uint16_t change_timer = 0; | ||
142 | const uint16_t change_tick = 15; | ||
143 | |||
92 | extern rgblight_config_t rgblight_config; | 144 | extern rgblight_config_t rgblight_config; |
93 | extern rgblight_status_t rgblight_status; | 145 | extern rgblight_status_t rgblight_status; |
94 | static bool startup_animation_done = false; | 146 | |
147 | #if defined(RGBLIGHT_STARTUP_ANIMATION) | ||
148 | |||
149 | #define STARTUP_ANIMATION_SATURATION 200 | ||
150 | #define STARTUP_ANIMATION_VALUE 255 | ||
151 | #define STARTUP_ANIMATION_FADE_STEP 5 | ||
152 | #define STARTUP_ANIMATION_CYCLE_STEP 2 | ||
153 | #define STARTUP_ANIMATION_RAMP_TO_STEPS 70 | ||
154 | #define STARTUP_ANIMATION_STEP_TIME 10 | ||
155 | #define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME | ||
156 | |||
157 | typedef enum { | ||
158 | DISABLED, | ||
159 | WAITING, | ||
160 | RESTART, | ||
161 | START, | ||
162 | FADE_OLD, | ||
163 | FADE_IN, | ||
164 | CYCLE, | ||
165 | RAMP_DOWN, | ||
166 | RAMP_TO, | ||
167 | CLEAN_UP, | ||
168 | DONE | ||
169 | } startup_animation_state_t; | ||
170 | |||
171 | static rgblight_config_t old_config; | ||
172 | static uint8_t old_base_mode; | ||
173 | static startup_animation_state_t startup_animation_state = DISABLED; | ||
174 | static uint16_t rgblight_startup_loop_timer; | ||
175 | |||
176 | void startup_animation_init(void) { | ||
177 | old_config.raw = rgblight_config.raw; | ||
178 | old_base_mode = rgblight_status.base_mode; | ||
179 | |||
180 | if (!old_config.enable) | ||
181 | rgblight_enable_noeeprom(); | ||
182 | } | ||
183 | #endif | ||
95 | 184 | ||
96 | void keyboard_post_init_user_rgb(void) { | 185 | void keyboard_post_init_user_rgb(void) { |
97 | // Enable the LED layers | 186 | // Enable the LED layers |
98 | rgblight_layers = _rgb_layers; | 187 | rgblight_layers = _rgb_layers; |
99 | do_rgb_layers(default_layer_state, LAYER_BASE_DEFAULT + 1, LAYER_BASE_REGULAR); | 188 | do_rgb_all(); |
100 | do_rgb_layers(layer_state, LAYER_BASE_REGULAR, LAYER_BASE_END); | ||
101 | 189 | ||
102 | // Startup animation | 190 | #if defined(RGBLIGHT_STARTUP_ANIMATION) |
103 | { | 191 | startup_animation_init(); |
104 | bool is_enabled = rgblight_config.enable; | 192 | startup_animation_state = STARTUP_ANIMATION_INITIAL_DELAY ? WAITING : START; |
105 | uint8_t old_hue = rgblight_config.hue; | 193 | #endif |
106 | uint8_t old_sat = rgblight_config.sat; | 194 | } |
107 | uint8_t old_val = rgblight_config.val; | ||
108 | uint8_t old_mode = rgblight_config.mode; | ||
109 | 195 | ||
110 | bool ramp_down = | 196 | void matrix_scan_user_rgb(void) { |
197 | #if defined(RGBLIGHT_STARTUP_ANIMATION) | ||
198 | if (startup_animation_state != DONE && is_keyboard_master()) { | ||
199 | if (startup_animation_state == START || timer_elapsed(rgblight_startup_loop_timer) > STARTUP_ANIMATION_STEP_TIME) { | ||
200 | static uint8_t counter; | ||
201 | rgblight_startup_loop_timer = timer_read(); | ||
202 | |||
203 | switch (startup_animation_state) { | ||
204 | case WAITING: | ||
205 | #ifdef STARTUP_ANIMATION_DEBUG | ||
206 | dprintf("sua WAITING counter=%u\n", counter); | ||
207 | #endif | ||
208 | if (counter < STARTUP_ANIMATION_INITIAL_DELAY / STARTUP_ANIMATION_STEP_TIME) { | ||
209 | counter++; | ||
210 | } else { | ||
211 | startup_animation_state = START; | ||
212 | } | ||
213 | break; | ||
214 | |||
215 | case RESTART: | ||
216 | dprintln("sua RESTART"); | ||
217 | startup_animation_init(); | ||
218 | case START: | ||
219 | dprintln("sua START"); | ||
220 | startup_animation_state = FADE_OLD; | ||
221 | counter = old_config.val; | ||
222 | // No break! Just roll into FADE_OLD in the same iteration... | ||
223 | |||
224 | case FADE_OLD: | ||
225 | #ifdef STARTUP_ANIMATION_DEBUG | ||
226 | dprintf("sua FADE_OLD counter=%u\n", counter); | ||
227 | #endif | ||
228 | if (counter >= STARTUP_ANIMATION_FADE_STEP) { | ||
229 | rgblight_sethsv_noeeprom(old_config.hue, old_config.sat, counter); | ||
230 | counter -= STARTUP_ANIMATION_FADE_STEP; | ||
231 | } else { | ||
232 | counter = 0; | ||
233 | startup_animation_state = FADE_IN; | ||
234 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
235 | } | ||
236 | break; | ||
237 | |||
238 | case FADE_IN: | ||
239 | #ifdef STARTUP_ANIMATION_DEBUG | ||
240 | dprintf("sua FADE_IN counter=%u\n", counter); | ||
241 | #endif | ||
242 | if (counter < STARTUP_ANIMATION_VALUE) { | ||
243 | rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); | ||
244 | counter += STARTUP_ANIMATION_FADE_STEP; | ||
245 | } else { | ||
246 | counter = 255; | ||
247 | startup_animation_state = CYCLE; | ||
248 | } | ||
249 | break; | ||
250 | |||
251 | case CYCLE: | ||
252 | #ifdef STARTUP_ANIMATION_DEBUG | ||
253 | dprintf("sua CYCLE counter=%u\n", counter); | ||
254 | #endif | ||
255 | if (counter >= STARTUP_ANIMATION_CYCLE_STEP) { | ||
256 | rgblight_sethsv_noeeprom((counter + old_config.hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE); | ||
257 | counter -= STARTUP_ANIMATION_CYCLE_STEP; | ||
258 | } else { | ||
259 | if ( | ||
111 | #ifdef RGBLIGHT_EFFECT_BREATHING | 260 | #ifdef RGBLIGHT_EFFECT_BREATHING |
112 | (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) || | 261 | (old_base_mode == RGBLIGHT_MODE_BREATHING) || |
113 | #endif | 262 | #endif |
114 | #ifdef RGBLIGHT_EFFECT_SNAKE | 263 | #ifdef RGBLIGHT_EFFECT_SNAKE |
115 | (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE) || | 264 | (old_base_mode == RGBLIGHT_MODE_SNAKE) || |
116 | #endif | 265 | #endif |
117 | #ifdef RGBLIGHT_EFFECT_KNIGHT | 266 | #ifdef RGBLIGHT_EFFECT_KNIGHT |
118 | (rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT) || | 267 | (old_base_mode == RGBLIGHT_MODE_KNIGHT) || |
119 | #endif | 268 | #endif |
120 | #ifdef RGBLIGHT_EFFECT_TWINKLE | 269 | #ifdef RGBLIGHT_EFFECT_TWINKLE |
121 | (rgblight_status.base_mode == RGBLIGHT_MODE_TWINKLE) || | 270 | (old_base_mode == RGBLIGHT_MODE_TWINKLE) || |
122 | #endif | 271 | #endif |
123 | !is_enabled; | 272 | !old_config.enable) { |
124 | 273 | counter = STARTUP_ANIMATION_VALUE; | |
125 | bool ramp_to = | 274 | startup_animation_state = RAMP_DOWN; |
275 | } else if ( | ||
126 | #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT | 276 | #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT |
127 | (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) || | 277 | (old_base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) || |
128 | #endif | 278 | #endif |
129 | #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD | 279 | #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD |
130 | (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) || | 280 | (old_base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) || |
131 | #endif | 281 | #endif |
132 | #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL | 282 | #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL |
133 | (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) || | 283 | (old_base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) || |
134 | #endif | 284 | #endif |
135 | #ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS | 285 | #ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS |
136 | (rgblight_status.base_mode == RGBLIGHT_MODE_CHRISTMAS) || | 286 | (old_base_mode == RGBLIGHT_MODE_CHRISTMAS) || |
137 | #endif | 287 | #endif |
138 | #ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST_ | 288 | #ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST_ |
139 | (rgblight_status.base_mode == RGBLIGHT_MODE_RGB_TEST) || | 289 | (old_base_mode == RGBLIGHT_MODE_RGB_TEST) || |
140 | #endif | 290 | #endif |
141 | (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_LIGHT); | 291 | (old_base_mode == RGBLIGHT_MODE_STATIC_LIGHT)) { |
142 | 292 | counter = 0; | |
143 | #define STARTUP_ANIMATION_SATURATION 200 | 293 | startup_animation_state = RAMP_TO; |
144 | #define STARTUP_ANIMATION_VALUE 255 | 294 | } else { |
145 | #define STARTUP_ANIMATION_STEP 5 | 295 | startup_animation_state = CLEAN_UP; |
146 | 296 | } | |
147 | rgblight_enable_noeeprom(); | 297 | } |
148 | if (rgblight_config.enable) { | 298 | break; |
149 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | 299 | |
150 | for (uint8_t i = 0; i < STARTUP_ANIMATION_VALUE; i += STARTUP_ANIMATION_STEP) { | 300 | case RAMP_DOWN: |
151 | rgblight_sethsv_noeeprom(old_hue, STARTUP_ANIMATION_SATURATION, i); | 301 | #ifdef STARTUP_ANIMATION_DEBUG |
152 | matrix_scan(); | 302 | dprintf("sua RAMP_DOWN counter=%u\n", counter); |
153 | wait_ms(10); | 303 | #endif |
154 | } | 304 | if (counter >= STARTUP_ANIMATION_FADE_STEP) { |
155 | for (uint8_t i = 255; i > 0; i -= STARTUP_ANIMATION_STEP) { | 305 | rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); |
156 | rgblight_sethsv_noeeprom((i + old_hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE); | 306 | counter -= STARTUP_ANIMATION_FADE_STEP; |
157 | matrix_scan(); | 307 | } else { |
158 | wait_ms(10); | 308 | startup_animation_state = CLEAN_UP; |
159 | } | 309 | } |
160 | 310 | break; | |
161 | if (ramp_down) { | 311 | |
162 | dprintln("ramp_down"); | 312 | case RAMP_TO: |
163 | for (uint8_t i = STARTUP_ANIMATION_VALUE; i > 0; i -= STARTUP_ANIMATION_STEP) { | 313 | { |
164 | rgblight_sethsv_noeeprom(old_hue, STARTUP_ANIMATION_SATURATION, i); | 314 | #ifdef STARTUP_ANIMATION_DEBUG |
165 | matrix_scan(); | 315 | dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter); |
166 | wait_ms(10); | 316 | #endif |
167 | } | 317 | uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS; |
168 | } else if (ramp_to) { | 318 | if (counter < steps) { |
169 | dprintf("ramp_to s=%u, v=%u\n", old_sat, old_val); | 319 | uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps); |
170 | uint8_t steps = 50; | 320 | uint8_t v = STARTUP_ANIMATION_VALUE + counter * (((float)old_config.val - STARTUP_ANIMATION_VALUE) / (float)steps); |
171 | for (uint8_t i = 0; i < steps; i++) { | 321 | rgblight_sethsv_noeeprom(old_config.hue, s, v); |
172 | uint8_t s = STARTUP_ANIMATION_SATURATION + i * (((float)old_sat - STARTUP_ANIMATION_SATURATION) / (float)steps); | 322 | counter++; |
173 | uint8_t v = STARTUP_ANIMATION_VALUE + i * (((float)old_val - STARTUP_ANIMATION_VALUE) / (float)steps); | 323 | } else { |
174 | rgblight_sethsv_noeeprom(old_hue, s, v); | 324 | startup_animation_state = CLEAN_UP; |
175 | matrix_scan(); | 325 | } |
176 | wait_ms(10); | 326 | } |
177 | } | 327 | break; |
328 | |||
329 | case CLEAN_UP: | ||
330 | dprintln("sua CLEAN_UP"); | ||
331 | rgblight_reload_from_eeprom(); | ||
332 | startup_animation_state = DONE; | ||
333 | dprintln("sua DONE"); | ||
334 | break; | ||
335 | |||
336 | default: | ||
337 | break; | ||
178 | } | 338 | } |
179 | rgblight_mode_noeeprom(old_mode); | ||
180 | } | 339 | } |
181 | if (is_enabled) { | 340 | } |
182 | rgblight_sethsv_noeeprom(old_hue, old_sat, old_val); | 341 | #endif |
183 | } else { | 342 | |
184 | rgblight_disable_noeeprom(); | 343 | if (change_hue != 0 || change_val != 0 || change_sat != 0) { |
185 | // Hack! | 344 | if (timer_elapsed(change_timer) > change_tick) { |
186 | // rgblight_sethsv_noeeprom() doesn't update these if rgblight is disabled, | 345 | HSV hsv = rgblight_get_hsv(); |
187 | // but if do it before disabling we get an ugly flash. | 346 | hsv.h += change_hue; |
188 | rgblight_config.hue = old_hue; | 347 | hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t) change_sat) : qsub8(hsv.s, (uint8_t) -change_sat); |
189 | rgblight_config.sat = old_sat; | 348 | hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t) change_val) : qsub8(hsv.v, (uint8_t) -change_val); |
190 | rgblight_config.val = old_val; | 349 | rgblight_sethsv_noeeprom(hsv.h, hsv.s, hsv.v); |
350 | change_timer = timer_read(); | ||
191 | } | 351 | } |
192 | dprint("done\n"); | 352 | } |
193 | startup_animation_done = true; | 353 | } |
354 | |||
355 | void shutdown_user_rgb(void) { | ||
356 | clear_rgb_layers(); | ||
357 | rgblight_enable_noeeprom(); | ||
358 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
359 | for (int i = 0; i < RGBLED_NUM; i++) { | ||
360 | rgblight_setrgb_at(0xFF, 0x80 * (i % 2), 0, i); | ||
194 | } | 361 | } |
195 | } | 362 | } |
196 | 363 | ||
197 | layer_state_t default_layer_state_set_user_rgb(layer_state_t state) { | 364 | layer_state_t default_layer_state_set_user_rgb(layer_state_t state) { |
198 | do_rgb_layers(state, 1u, LAYER_BASE_REGULAR); | 365 | do_rgb_layers(state, LAYER_BASE_DEFAULT, LAYER_BASE_REGULAR); |
199 | return state; | 366 | return state; |
200 | } | 367 | } |
201 | 368 | ||
@@ -225,15 +392,45 @@ void rgb_layer_ack(layer_ack_t n) { | |||
225 | extern keymap_config_t keymap_config; | 392 | extern keymap_config_t keymap_config; |
226 | extern rgblight_config_t rgblight_config; | 393 | extern rgblight_config_t rgblight_config; |
227 | 394 | ||
228 | extern bool spi_gflock; | ||
229 | extern uint16_t spi_replace_mode; | ||
230 | |||
231 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | 395 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { |
232 | if (record->event.pressed) { | 396 | if (record->event.pressed) { |
233 | switch (keycode) { | 397 | switch (keycode) { |
234 | case SPI_GLO: | 398 | case SPI_GLO: |
235 | spidey_glow(); | 399 | spidey_glow(); |
236 | return false; | 400 | return false; |
401 | |||
402 | // clang-format off | ||
403 | case RGB_HUI: change_timer = timer_read(); change_hue = 1; return false; | ||
404 | case RGB_HUD: change_timer = timer_read(); change_hue = -1; return false; | ||
405 | case RGB_SAI: change_timer = timer_read(); change_sat = 1; return false; | ||
406 | case RGB_SAD: change_timer = timer_read(); change_sat = -1; return false; | ||
407 | case RGB_VAI: change_timer = timer_read(); change_val = 1; return false; | ||
408 | case RGB_VAD: change_timer = timer_read(); change_val = -1; return false; | ||
409 | // clang-format on | ||
410 | } | ||
411 | } else { | ||
412 | bool rgb_done = false; | ||
413 | switch (keycode) { | ||
414 | case RGB_HUI: | ||
415 | case RGB_HUD: | ||
416 | change_hue = 0; | ||
417 | rgb_done = true; | ||
418 | break; | ||
419 | case RGB_SAI: | ||
420 | case RGB_SAD: | ||
421 | change_sat = 0; | ||
422 | rgb_done = true; | ||
423 | break; | ||
424 | case RGB_VAI: | ||
425 | case RGB_VAD: | ||
426 | change_val = 0; | ||
427 | rgb_done = true; | ||
428 | break; | ||
429 | } | ||
430 | |||
431 | if (rgb_done) { | ||
432 | HSV final = rgblight_get_hsv(); | ||
433 | rgblight_sethsv(final.h, final.s, final.v); | ||
237 | } | 434 | } |
238 | } | 435 | } |
239 | 436 | ||
@@ -244,13 +441,12 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | |||
244 | switch (keycode) { | 441 | switch (keycode) { |
245 | // Acks follow... | 442 | // Acks follow... |
246 | case DEBUG: | 443 | case DEBUG: |
247 | rgb_layer_ack_yn(debug_enable); | 444 | if (debug_matrix || debug_keyboard) |
248 | break; | 445 | rgb_layer_ack(ACK_HUH); |
249 | 446 | else if (debug_enable) | |
250 | case SPI_LNX: | 447 | rgb_layer_ack(ACK_YES); |
251 | case SPI_OSX: | 448 | else |
252 | case SPI_WIN: | 449 | rgb_layer_ack(ACK_NO); |
253 | rgb_layer_ack(ACK_MEH); | ||
254 | break; | 450 | break; |
255 | 451 | ||
256 | case SPI_GFLOCK: | 452 | case SPI_GFLOCK: |
@@ -280,5 +476,16 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { | |||
280 | rgb_layer_ack_yn(keymap_config.nkro); | 476 | rgb_layer_ack_yn(keymap_config.nkro); |
281 | break; | 477 | break; |
282 | #endif | 478 | #endif |
479 | |||
480 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) | ||
481 | case SPI_LNX: | ||
482 | case SPI_OSX: | ||
483 | case SPI_WIN: | ||
484 | case UC_MOD: | ||
485 | case UC_RMOD: | ||
486 | rgb_layer_ack(ACK_MEH); | ||
487 | do_rgb_unicode(); | ||
488 | break; | ||
489 | #endif | ||
283 | } | 490 | } |
284 | } | 491 | } |
diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk index 2d4da2294..bd378f545 100644 --- a/users/spidey3/rules.mk +++ b/users/spidey3/rules.mk | |||
@@ -1,4 +1,6 @@ | |||
1 | BOOTMAGIC_ENABLE = lite | 1 | BOOTMAGIC_ENABLE = lite |
2 | CONSOLE_ENABLE = yes # Console for debug | ||
3 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
2 | LTO_ENABLE = yes | 4 | LTO_ENABLE = yes |
3 | 5 | ||
4 | SRC += init.c | 6 | SRC += init.c |
diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index a8dafcb7b..df73c903d 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c | |||
@@ -14,49 +14,44 @@ static uint32_t matrix_scan_count = 0; | |||
14 | static bool reported_version = false; | 14 | static bool reported_version = false; |
15 | 15 | ||
16 | # if defined(SPI_DEBUG_SCAN_RATE) | 16 | # if defined(SPI_DEBUG_SCAN_RATE) |
17 | static uint32_t matrix_timer = 0; | 17 | static uint32_t matrix_timer = 0; |
18 | static uint32_t last_matrix_scan_count = 0; | ||
19 | # endif | 18 | # endif |
20 | 19 | ||
20 | void report_version(void) { | ||
21 | uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); | ||
22 | reported_version = true; | ||
23 | } | ||
24 | #endif | ||
25 | |||
21 | void matrix_scan_user(void) { | 26 | void matrix_scan_user(void) { |
27 | #if defined(CONSOLE_ENABLE) && !defined(NO_DEBUG) | ||
22 | # if defined(SPI_DEBUG_SCAN_RATE) | 28 | # if defined(SPI_DEBUG_SCAN_RATE) |
23 | matrix_scan_count++; | 29 | matrix_scan_count++; |
24 | if (debug_enable) { | 30 | if (debug_enable) { |
25 | uint32_t timer_now = timer_read32(); | 31 | uint32_t timer_now = timer_read32(); |
26 | if (matrix_timer == 0) { | 32 | if (matrix_timer == 0) { |
27 | matrix_timer = timer_now; | 33 | matrix_timer = timer_now; |
28 | last_matrix_scan_count = matrix_scan_count; | 34 | matrix_scan_count = 0; |
29 | matrix_scan_count = 0; | ||
30 | } else if (TIMER_DIFF_32(timer_now, matrix_timer) > SPI_SCAN_RATE_INTERVAL * 1000) { | 35 | } else if (TIMER_DIFF_32(timer_now, matrix_timer) > SPI_SCAN_RATE_INTERVAL * 1000) { |
31 | matrix_timer = timer_now; | 36 | matrix_timer = timer_now; |
32 | last_matrix_scan_count = matrix_scan_count; | 37 | uprintf("scan rate: %lu/s\n", matrix_scan_count / SPI_SCAN_RATE_INTERVAL); |
33 | matrix_scan_count = 0; | 38 | matrix_scan_count = 0; |
34 | if (!reported_version) { | 39 | if (!reported_version) report_version(); |
35 | uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); | ||
36 | reported_version = true; | ||
37 | } | ||
38 | uprintf("scan rate: %lu/s\n", last_matrix_scan_count / SPI_SCAN_RATE_INTERVAL); | ||
39 | } | 40 | } |
40 | } | 41 | } |
41 | # else | 42 | # else |
42 | if (!reported_version) { | 43 | if (!reported_version) { |
43 | matrix_scan_count++; | 44 | matrix_scan_count++; |
44 | if (matrix_scan_count > 300) { | 45 | if (matrix_scan_count > 300) report_version(); |
45 | uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); | ||
46 | reported_version = true; | ||
47 | } | ||
48 | } | 46 | } |
49 | # endif | 47 | # endif |
50 | } | ||
51 | #endif | 48 | #endif |
52 | 49 | #ifdef RGBLIGHT_ENABLE | |
53 | bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph) { | 50 | matrix_scan_user_rgb(); |
54 | uint8_t temp_mod = get_mods(); | ||
55 | #ifndef NO_ACTION_ONESHOT | ||
56 | uint8_t temp_osm = get_oneshot_mods(); | ||
57 | #else | ||
58 | uint8_t temp_osm = 0; | ||
59 | #endif | 51 | #endif |
52 | } | ||
53 | |||
54 | bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint8_t temp_mod, uint8_t temp_osm) { | ||
60 | if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) { | 55 | if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) { |
61 | switch (keycode) { | 56 | switch (keycode) { |
62 | case KC_A ... KC_Z: | 57 | case KC_A ... KC_Z: |
@@ -121,21 +116,43 @@ bool process_gflock(uint16_t keycode, keyrecord_t *record) { | |||
121 | } | 116 | } |
122 | 117 | ||
123 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 118 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
119 | dprintf("key event: kc: %02X, col: %02u, row: %02u, pressed: %u mods: %08b " | ||
120 | #if !defined(NO_ACTION_ONESHOT) | ||
121 | "os: %08b " | ||
122 | #endif | ||
123 | "weak: %08b\n", | ||
124 | keycode, record->event.key.col, record->event.key.row, record->event.pressed, bitrev(get_mods()), | ||
125 | #if !defined(NO_ACTION_ONESHOT) | ||
126 | bitrev(get_oneshot_mods()), | ||
127 | #endif | ||
128 | bitrev(get_weak_mods())); | ||
129 | |||
124 | if (!rand_seeded) { | 130 | if (!rand_seeded) { |
125 | srand(record->event.time % keycode); | 131 | srand(record->event.time % keycode); |
126 | rand_seeded = true; | 132 | rand_seeded = true; |
127 | } | 133 | } |
128 | 134 | ||
135 | uint8_t mods = get_mods(); | ||
136 | #ifndef NO_ACTION_ONESHOT | ||
137 | uint8_t osm = get_oneshot_mods(); | ||
138 | #else | ||
139 | uint8_t osm = 0; | ||
140 | #endif | ||
141 | |||
129 | if (record->event.pressed) { | 142 | if (record->event.pressed) { |
130 | switch (keycode) { | 143 | switch (keycode) { |
131 | #ifndef NO_DEBUG | 144 | #ifndef NO_DEBUG |
132 | // Re-implement this here, but fix the persistence! | 145 | // Re-implement this here, but fix the persistence! |
133 | case DEBUG: | 146 | case DEBUG: |
134 | if (!debug_enable) { | 147 | if (get_mods() & MOD_MASK_SHIFT) { |
148 | debug_enable = 0; | ||
149 | debug_keyboard = 0; | ||
150 | debug_matrix = 0; | ||
151 | } else if (!debug_enable) { | ||
135 | debug_enable = 1; | 152 | debug_enable = 1; |
136 | # if defined(SPI_DEBUG_SCAN_RATE) | 153 | # if defined(SPI_DEBUG_SCAN_RATE) |
137 | matrix_timer = 0; | 154 | matrix_timer = 0; |
138 | reported_version = false; | 155 | report_version(); |
139 | # endif | 156 | # endif |
140 | } else if (!debug_keyboard) { | 157 | } else if (!debug_keyboard) { |
141 | debug_keyboard = 1; | 158 | debug_keyboard = 1; |
@@ -157,31 +174,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
157 | case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; | 174 | case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; |
158 | case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; | 175 | case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; |
159 | 176 | ||
160 | // clang-format on | 177 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) |
161 | 178 | case SPI_LNX: set_unicode_input_mode(UC_LNX); break; | |
162 | case SPI_LNX: | 179 | case SPI_OSX: set_unicode_input_mode(UC_OSX); break; |
163 | dprint("SPI_LNX\n"); | 180 | case SPI_WIN: set_unicode_input_mode(UC_WINC); break; |
164 | set_single_persistent_default_layer(_BASE); | ||
165 | layer_off(_OSX); | ||
166 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) | ||
167 | set_unicode_input_mode(UC_LNX); | ||
168 | #endif | 181 | #endif |
169 | break; | 182 | // clang-format on |
170 | case SPI_OSX: | ||
171 | dprint("SPI_OSX\n"); | ||
172 | set_single_persistent_default_layer(_OSX); | ||
173 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) | ||
174 | set_unicode_input_mode(UC_OSX); | ||
175 | #endif | ||
176 | break; | ||
177 | case SPI_WIN: | ||
178 | dprint("SPI_WIN\n"); | ||
179 | set_single_persistent_default_layer(_BASE); | ||
180 | layer_off(_OSX); | ||
181 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) | ||
182 | set_unicode_input_mode(UC_WINC); | ||
183 | #endif | ||
184 | break; | ||
185 | 183 | ||
186 | case SPI_NORMAL ... SPI_FRAKTR: | 184 | case SPI_NORMAL ... SPI_FRAKTR: |
187 | spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode; | 185 | spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode; |
@@ -193,14 +191,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
193 | dprintf("spi_gflock = %u\n", spi_gflock); | 191 | dprintf("spi_gflock = %u\n", spi_gflock); |
194 | break; | 192 | break; |
195 | 193 | ||
196 | case KC_PSCR: { | 194 | case SPI_KP_00: |
197 | uint8_t mods = get_mods(); | 195 | tap_code(KC_KP_0); |
198 | #ifndef NO_ACTION_ONESHOT | 196 | #if TAP_CODE_DELAY > 0 |
199 | uint8_t osm = get_oneshot_mods(); | 197 | wait_ms(TAP_CODE_DELAY); |
200 | #else | ||
201 | uint8_t osm = 0; | ||
202 | #endif | 198 | #endif |
199 | register_code(KC_KP_0); | ||
200 | return false; | ||
203 | 201 | ||
202 | case KC_PSCR: { | ||
203 | // It's kind of a hack, but we use unicode input mode | ||
204 | // to determine what Print Screen key should do. The | ||
205 | // idea here is to make it consistent across hosts. | ||
204 | switch (get_unicode_input_mode()) { | 206 | switch (get_unicode_input_mode()) { |
205 | case UC_MAC: | 207 | case UC_MAC: |
206 | if ((mods | osm) & MOD_MASK_ALT) { | 208 | if ((mods | osm) & MOD_MASK_ALT) { |
@@ -265,6 +267,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
265 | case CH_ASST: | 267 | case CH_ASST: |
266 | host_consumer_send(0); | 268 | host_consumer_send(0); |
267 | return false; | 269 | return false; |
270 | |||
271 | case SPI_KP_00: | ||
272 | unregister_code(KC_KP_0); | ||
273 | return false; | ||
268 | } | 274 | } |
269 | } | 275 | } |
270 | 276 | ||
@@ -273,32 +279,56 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
273 | case KC_SPACE: | 279 | case KC_SPACE: |
274 | switch (spi_replace_mode) { | 280 | switch (spi_replace_mode) { |
275 | case SPI_WIDE: | 281 | case SPI_WIDE: |
276 | return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003); | 282 | return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, mods, osm); |
277 | case SPI_SCRIPT: | 283 | case SPI_SCRIPT: |
278 | return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002); | 284 | return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, mods, osm); |
279 | case SPI_BLOCKS: | 285 | case SPI_BLOCKS: |
280 | return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002); | 286 | return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, mods, osm); |
281 | case SPI_CIRCLE: | 287 | case SPI_CIRCLE: |
282 | return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002); | 288 | return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, mods, osm); |
283 | case SPI_SQUARE: | 289 | case SPI_SQUARE: |
284 | return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002); | 290 | return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, mods, osm); |
285 | case SPI_PARENS: | 291 | case SPI_PARENS: |
286 | return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002); | 292 | return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, mods, osm); |
287 | case SPI_FRAKTR: | 293 | case SPI_FRAKTR: |
288 | return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002); | 294 | return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, mods, osm); |
289 | } | 295 | } |
290 | break; | 296 | break; |
291 | 297 | ||
292 | case KC_F1 ... KC_F12: | 298 | case KC_F1 ... KC_F12: |
293 | return process_gflock(keycode, record); | 299 | return process_gflock(keycode, record); |
294 | } | ||
295 | 300 | ||
296 | #ifdef RGBLIGHT_ENABLE | 301 | #ifdef SHIFT_BACKSPACE_DELETE |
297 | bool res = process_record_user_rgb(keycode, record); | 302 | case KC_BSPC: { |
298 | if (!res) return false; | 303 | static bool delkey_registered; |
304 | if (record->event.pressed) { | ||
305 | if ((mods | osm) & MOD_MASK_SHIFT) { | ||
306 | del_mods(MOD_MASK_SHIFT); | ||
307 | #ifndef NO_ACTION_ONESHOT | ||
308 | clear_oneshot_mods(); | ||
309 | #endif | ||
310 | register_code(KC_DEL); | ||
311 | delkey_registered = true; | ||
312 | set_mods(mods); | ||
313 | return false; | ||
314 | } | ||
315 | } else { // on release of KC_BSPC | ||
316 | // In case KC_DEL is still being sent even after the release of KC_BSPC | ||
317 | if (delkey_registered) { | ||
318 | unregister_code(KC_DEL); | ||
319 | delkey_registered = false; | ||
320 | return false; | ||
321 | } | ||
322 | } | ||
323 | } | ||
299 | #endif | 324 | #endif |
325 | } | ||
300 | 326 | ||
327 | #ifdef RGBLIGHT_ENABLE | ||
328 | return process_record_user_rgb(keycode, record); | ||
329 | #else | ||
301 | return true; | 330 | return true; |
331 | #endif | ||
302 | } | 332 | } |
303 | 333 | ||
304 | void post_process_record_user(uint16_t keycode, keyrecord_t *record) { | 334 | void post_process_record_user(uint16_t keycode, keyrecord_t *record) { |
diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index 5bfba4e59..d018e5def 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | enum userspace_layers { | 9 | enum userspace_layers { |
10 | _BASE = 0, | 10 | _BASE = 0, |
11 | _OSX, | ||
12 | _NUMPAD, | 11 | _NUMPAD, |
13 | _FN, | 12 | _FN, |
14 | }; | 13 | }; |
@@ -31,6 +30,7 @@ enum custom_keycodes { | |||
31 | SPI_PARENS, | 30 | SPI_PARENS, |
32 | SPI_FRAKTR, | 31 | SPI_FRAKTR, |
33 | SPI_GFLOCK, | 32 | SPI_GFLOCK, |
33 | SPI_KP_00, | ||
34 | }; | 34 | }; |
35 | 35 | ||
36 | #ifdef RGBLIGHT_ENABLE | 36 | #ifdef RGBLIGHT_ENABLE |
@@ -45,12 +45,14 @@ typedef enum layer_ack { | |||
45 | ACK_NO = 0, | 45 | ACK_NO = 0, |
46 | ACK_YES, | 46 | ACK_YES, |
47 | ACK_MEH, | 47 | ACK_MEH, |
48 | ACK_HUH, | ||
48 | } layer_ack_t; | 49 | } layer_ack_t; |
49 | 50 | ||
50 | # define RGB_LAYER_ACK_DURATION 500 | 51 | # define RGB_LAYER_ACK_DURATION 500 |
51 | 52 | ||
52 | void eeconfig_init_user_rgb(void); | 53 | void eeconfig_init_user_rgb(void); |
53 | void matrix_init_user_rgb(void); | 54 | void matrix_init_user_rgb(void); |
55 | void matrix_scan_user_rgb(void); | ||
54 | void keyboard_post_init_user_rgb(void); | 56 | void keyboard_post_init_user_rgb(void); |
55 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); | 57 | bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); |
56 | void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record); | 58 | void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record); |
@@ -60,6 +62,7 @@ bool led_update_user_rgb(led_t led_state); | |||
60 | void rgb_layer_ack(layer_ack_t n); | 62 | void rgb_layer_ack(layer_ack_t n); |
61 | void rgb_layer_ack_yn(bool yn); | 63 | void rgb_layer_ack_yn(bool yn); |
62 | void clear_rgb_layers(void); | 64 | void clear_rgb_layers(void); |
65 | void shutdown_user_rgb(void); | ||
63 | #endif | 66 | #endif |
64 | 67 | ||
65 | #ifdef UNICODEMAP_ENABLE | 68 | #ifdef UNICODEMAP_ENABLE |
diff --git a/users/spidey3/unicode.h b/users/spidey3/unicode.h index db7824983..6182669fb 100644 --- a/users/spidey3/unicode.h +++ b/users/spidey3/unicode.h | |||
@@ -23,6 +23,6 @@ enum unicode_names { | |||
23 | }; | 23 | }; |
24 | 24 | ||
25 | # define X_BUL (XP(BUL1, BUL2)) | 25 | # define X_BUL (XP(BUL1, BUL2)) |
26 | # define X_DASH (XP(ENDASH, EMDASH)) | 26 | # define X_DASH (XP(EMDASH, ENDASH)) |
27 | 27 | ||
28 | #endif | 28 | #endif |