diff options
author | peepeetee <43021794+peepeetee@users.noreply.github.com> | 2021-04-24 23:02:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 14:02:42 +1000 |
commit | 89bd04b9eba72c93e6e9227179aa4a1236f3061b (patch) | |
tree | f2c133e64dc1be6f2db44b13c141554f747a6ca6 | |
parent | 5b394e82c9da068dfed83ea6bdc40ba5182d7419 (diff) | |
download | qmk_firmware-89bd04b9eba72c93e6e9227179aa4a1236f3061b.tar.gz qmk_firmware-89bd04b9eba72c93e6e9227179aa4a1236f3061b.zip |
peepeetee's *very janky* hub16 keymap (#12506)
* peepeetee's bodged hub16 keymap
* add layer 3 lighting
* actually adds layer 3 lighting
* fixes layer 0; behavior is that layor 0 is unaltered from base pattern, while other states have distinct solid colors
-rw-r--r-- | keyboards/hub16/keymaps/peepeetee/config.h | 57 | ||||
-rw-r--r-- | keyboards/hub16/keymaps/peepeetee/keymap.c | 208 | ||||
-rw-r--r-- | keyboards/hub16/keymaps/peepeetee/rules.mk | 1 |
3 files changed, 266 insertions, 0 deletions
diff --git a/keyboards/hub16/keymaps/peepeetee/config.h b/keyboards/hub16/keymaps/peepeetee/config.h new file mode 100644 index 000000000..aa9e081c7 --- /dev/null +++ b/keyboards/hub16/keymaps/peepeetee/config.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | Copyright 2019 Josh Johnson | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ | ||
21 | // /*== all animations enable ==*/ | ||
22 | // #define RGBLIGHT_ANIMATIONS | ||
23 | // /*== or choose animations ==*/ | ||
24 | // #define RGBLIGHT_EFFECT_BREATHING | ||
25 | // #define RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
26 | // #define RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
27 | // #define RGBLIGHT_EFFECT_SNAKE | ||
28 | // #define RGBLIGHT_EFFECT_KNIGHT | ||
29 | // #define RGBLIGHT_EFFECT_CHRISTMAS | ||
30 | // #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
31 | // #define RGBLIGHT_EFFECT_RGB_TEST | ||
32 | // #define RGBLIGHT_EFFECT_ALTERNATING | ||
33 | // /*== customize breathing effect ==*/ | ||
34 | // /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ | ||
35 | // #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 | ||
36 | // /*==== use exp() and sin() ====*/ | ||
37 | // #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 | ||
38 | // #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 | ||
39 | // #endif | ||
40 | |||
41 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
42 | #define DEBOUNCE 20 | ||
43 | |||
44 | // Time out one shot layers after 3 seconds | ||
45 | #define ONESHOT_TIMEOUT 3000 | ||
46 | |||
47 | // Undef and redefine default brightness to half of 255 | ||
48 | #undef RGBLIGHT_LIMIT_VAL | ||
49 | #define RGBLIGHT_LIMIT_VAL 255 | ||
50 | |||
51 | //Define a preview timeout for RGB reviews | ||
52 | #define PREVIEW_TIMEOUT 5000 | ||
53 | |||
54 | // Enable Light Layers implementation | ||
55 | #define RGBLIGHT_LAYERS | ||
56 | // Allow Light Layers to override RGB off configuration | ||
57 | #define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF | ||
diff --git a/keyboards/hub16/keymaps/peepeetee/keymap.c b/keyboards/hub16/keymaps/peepeetee/keymap.c new file mode 100644 index 000000000..f0e393b26 --- /dev/null +++ b/keyboards/hub16/keymaps/peepeetee/keymap.c | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | Copyright 2019 Josh Johnson 2021 peepeetee | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) | ||
21 | static uint32_t rgb_preview_timer = 0; | ||
22 | #endif | ||
23 | |||
24 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
25 | |||
26 | |||
27 | // Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4) | ||
28 | [0] = LAYOUT( | ||
29 | KC_MPLY, KC_MUTE, | ||
30 | TG(3), TG(2), TG(1), TG(0), | ||
31 | KC_PSCR, KC_SLCK, KC_PAUS, A(KC_F4), | ||
32 | KC_INS, KC_HOME, KC_PGUP, KC_F12, //Transparent to let you go between layers | ||
33 | KC_DEL, A(KC_F4), KC_PGDN, KC_CALCULATOR | ||
34 | |||
35 | ), | ||
36 | |||
37 | [1] = LAYOUT( | ||
38 | KC_MPLY, KC_MUTE, | ||
39 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
40 | KC_F7, KC_F8, KC_F9, KC_F10, | ||
41 | KC_F4, KC_F5, KC_F6, KC_F11, | ||
42 | KC_F1, KC_F2, KC_F3, KC_F12 //Transparent to let you go between layers | ||
43 | ), | ||
44 | |||
45 | |||
46 | //Layer 5 - Keyboard Lights, Programming and Special Functions | ||
47 | [2] = LAYOUT( | ||
48 | KC_MPLY, KC_MUTE, | ||
49 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, //Transparent to let you go between layers | ||
50 | RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, | ||
51 | RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, | ||
52 | RGB_TOG, EEP_RST, RESET, KC_TRNS | ||
53 | ), | ||
54 | |||
55 | [3] = LAYOUT( | ||
56 | KC_MPLY, KC_MUTE, | ||
57 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, //Transparent to let you go between layers | ||
58 | RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, | ||
59 | RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, | ||
60 | RGB_TOG, EEP_RST, RESET, KC_TRNS | ||
61 | ) | ||
62 | |||
63 | |||
64 | //Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4) | ||
65 | // [0] = LAYOUT( | ||
66 | // KC_MPLY, KC_MUTE, | ||
67 | // KC_F13, KC_F14, KC_F15, KC_F16, | ||
68 | // KC_F17, KC_F18, KC_F19, KC_F20, | ||
69 | // KC_F21, KC_F22, KC_F23, KC_F24, | ||
70 | // OSL(1), OSL(2), OSL(3), TG(4) //Transparent to let you go between layers | ||
71 | // ), | ||
72 | |||
73 | // [1] = LAYOUT( | ||
74 | // KC_MPLY, KC_MUTE, | ||
75 | // LALT(KC_F13), LALT(KC_F14), LALT(KC_F15), LALT(KC_F16), | ||
76 | // LALT(KC_F17), LALT(KC_F18), LALT(KC_F19), LALT(KC_F20), | ||
77 | // LALT(KC_F21), LALT(KC_F22), LALT(KC_F23), LALT(KC_F24), | ||
78 | // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers | ||
79 | // ), | ||
80 | |||
81 | //Layer 2 - Shift + Function Key Layer | ||
82 | // [2] = LAYOUT( | ||
83 | // KC_MPLY, KC_MUTE, | ||
84 | // LSFT(KC_F13), LSFT(KC_F14), LSFT(KC_F15), LSFT(KC_F16), | ||
85 | // LSFT(KC_F17), LSFT(KC_F18), LSFT(KC_F19), LSFT(KC_F20), | ||
86 | // LSFT(KC_F21), LSFT(KC_F22), LSFT(KC_F23), LSFT(KC_F24), | ||
87 | // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers | ||
88 | // ), | ||
89 | |||
90 | // //Layer 3 - Control + Function Key | ||
91 | // [3] = LAYOUT( | ||
92 | // KC_MPLY, KC_MUTE, | ||
93 | // LCTL(KC_F13), LCTL(KC_F14), LCTL(KC_F15), LCTL(KC_F16), | ||
94 | // LCTL(KC_F17), LCTL(KC_F18), LCTL(KC_F19), LCTL(KC_F20), | ||
95 | // LCTL(KC_F21), LCTL(KC_F22), LCTL(KC_F23), LCTL(KC_F24), | ||
96 | // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers | ||
97 | // ), | ||
98 | |||
99 | // //Layer 4 - Multimedia | ||
100 | // [4] = LAYOUT( | ||
101 | // KC_MPLY, KC_MUTE, | ||
102 | // KC_MPRV, KC_MPLY, KC_U, KC_K, | ||
103 | // KC_NO, KC_NO, KC_ENT, KC_X, | ||
104 | // KC_NO, RESET, LSFT(KC_HASH), KC_J, | ||
105 | // TG(5), KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers | ||
106 | // ), | ||
107 | |||
108 | // //Layer 5 - Keyboard Lights, Programming and Special Functions | ||
109 | // [5] = LAYOUT( | ||
110 | // KC_MPLY, KC_MUTE, | ||
111 | // RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, | ||
112 | // RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, | ||
113 | // RGB_TOG, EEP_RST, RESET, KC_LSHIFT, | ||
114 | // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers | ||
115 | // ), | ||
116 | }; | ||
117 | |||
118 | const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
119 | {0,16,HSV_WHITE} | ||
120 | ); | ||
121 | const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
122 | {0,16,HSV_ORANGE} | ||
123 | ); | ||
124 | const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
125 | {0,16,HSV_RED} | ||
126 | ); | ||
127 | const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
128 | {0,16,HSV_BLUE} | ||
129 | ); | ||
130 | // const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
131 | // {0,16,HSV_WHITE} | ||
132 | // ); | ||
133 | // const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
134 | // {0,16,HSV_TEAL} | ||
135 | // ); | ||
136 | const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
137 | my_layer0_layer, | ||
138 | my_layer1_layer, | ||
139 | my_layer2_layer, | ||
140 | my_layer3_layer//, | ||
141 | // my_layer4_layer, | ||
142 | // my_layer5_layer | ||
143 | ); | ||
144 | |||
145 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
146 | if (index == 0) { /* Left Encoder */ | ||
147 | if (clockwise) { | ||
148 | tap_code(KC_MPRV); | ||
149 | } else { | ||
150 | tap_code(KC_MNXT); | ||
151 | } | ||
152 | } else if (index == 1) { /* Right Encoder */ | ||
153 | if (clockwise) { | ||
154 | tap_code(KC_VOLD); | ||
155 | } else { | ||
156 | tap_code(KC_VOLU); | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | void post_process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
161 | // Allow for a preview of changes when modifying RGB | ||
162 | # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) | ||
163 | switch (keycode) { | ||
164 | case RGB_TOG ... VLK_TOG: | ||
165 | for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) { | ||
166 | rgblight_set_layer_state(i, false); | ||
167 | } | ||
168 | rgb_preview_timer = timer_read32(); | ||
169 | break; | ||
170 | } | ||
171 | # endif | ||
172 | return; | ||
173 | } | ||
174 | |||
175 | //Set the appropriate layer color | ||
176 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
177 | rgblight_set_layer_state(0, false); | ||
178 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | ||
179 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | ||
180 | rgblight_set_layer_state(3, layer_state_cmp(state, 3)); | ||
181 | // rgblight_set_layer_state(4, layer_state_cmp(state, 4)); | ||
182 | // rgblight_set_layer_state(5, layer_state_cmp(state, 5)); | ||
183 | return state; | ||
184 | } | ||
185 | |||
186 | void keyboard_post_init_user(void) { | ||
187 | //Enable the LED layers | ||
188 | rgblight_layers = my_rgb_layers; | ||
189 | layer_state_set_user(layer_state); | ||
190 | } | ||
191 | |||
192 | void matrix_scan_user(void) { | ||
193 | # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) | ||
194 | // Allow preview for | ||
195 | if (rgb_preview_timer && TIMER_DIFF_32(timer_read32(), rgb_preview_timer) > PREVIEW_TIMEOUT) { | ||
196 | rgb_preview_timer = 0; | ||
197 | default_layer_state_set_user(default_layer_state); | ||
198 | layer_state_set_user(layer_state); | ||
199 | led_update_user((led_t) host_keyboard_leds()); | ||
200 | } | ||
201 | # endif | ||
202 | } | ||
203 | |||
204 | //EEPROM Reset Function | ||
205 | void eeconfig_init_user(void) { | ||
206 | rgblight_enable(); // Enable RGB by default | ||
207 | rgblight_sethsv_orange(); // Set it to orange by default | ||
208 | } | ||
diff --git a/keyboards/hub16/keymaps/peepeetee/rules.mk b/keyboards/hub16/keymaps/peepeetee/rules.mk new file mode 100644 index 000000000..384d149ae --- /dev/null +++ b/keyboards/hub16/keymaps/peepeetee/rules.mk | |||
@@ -0,0 +1 @@ | |||
BOOTMAGIC_ENABLE = lite \ No newline at end of file | |||