aboutsummaryrefslogtreecommitdiff
path: root/keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c')
-rw-r--r--keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c303
1 files changed, 303 insertions, 0 deletions
diff --git a/keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c b/keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c
new file mode 100644
index 000000000..934463b11
--- /dev/null
+++ b/keyboards/kprepublic/bm68hsrgb/keymaps/peepeetee/keymap.c
@@ -0,0 +1,303 @@
1/* Copyright 2019 ash0x0 2021 peepeetee
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17#include "keymap.h"
18// // Defines names for use in layer keycodes and the keymap
19// enum layer_names {
20// _BASE,
21// _FN
22// };
23
24
25
26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
27 [0] = LAYOUT_65_ansi(
28 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
29 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
30 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDOWN,
31 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
32 KC_LCTL, KC_LGUI,LT(1, KC_LALT), KC_SPC, KC_RALT, MO(1),KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT
33 ),
34 [1] = LAYOUT_65_ansi(
35 KC_GRAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DELETE,
36 RGB_MOD, RGB_HUI, RGB_VAI, RGB_SAI, RGB_SPI, _______, KC_KP_7, KC_KP_8, KC_KP_9, _______, _______, _______, _______, _______, KC_PGUP,
37 RGB_TOG, RGB_HUD, RGB_VAD, RGB_SAD, RGB_SPD, _______, KC_KP_4, KC_KP_5, KC_KP_6, _______, _______, _______, _______, KC_PGDOWN,
38 BL_TOGG, _______, _______, _______, _______, RESET, KC_KP_1, KC_KP_2, KC_KP_3, _______, _______, _______, KC_AUDIO_VOL_UP, KC_END,
39 _______, _______, _______, _______, _______, _______, _______, KC_BRIGHTNESS_DOWN, KC_AUDIO_VOL_DOWN, KC_BRIGHTNESS_UP
40 ),
41
42};
43
44/*
45Templete
46 [ ] = LAYOUT_65_ansi(
47 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
48 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
49 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
50 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
51 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
52 ),
53*/
54
55#ifdef _______
56#undef _______
57#define _______ {0, 0, 0}
58
59const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
60 [1] = {
61 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
62 GREEN, BLUE, {0, 0, 255}, PURPLE, AZURE, _______, {0, 0, 255}, {0, 0, 255}, {0, 0, 255}, _______, _______, _______, _______, _______, _______,
63 RED, BLUE, {0, 0, 1}, PURPLE, AZURE, _______, {0, 0, 255}, {0, 0, 255}, {0, 0, 255}, _______, _______, _______, _______, _______,
64 _______, _______, _______, _______, _______, RED, {0, 0, 255}, {0, 0, 255}, {0, 0, 255}, _______, _______, _______, _______, _______,
65 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
66 }
67
68};
69
70#undef _______
71#define _______ KC_TRNS
72#endif
73
74
75
76void keyboard_post_init_user(void) {
77 // Call the post init code.
78 dfa_state = 0; // ENGLISH
79}
80
81
82
83bool process_record_user(uint16_t keycode, keyrecord_t *record) {
84 switch (keycode) {
85 case KC_DELETE:
86 if (record->event.pressed) {
87 dfa_state = 0;
88 } else {
89 // Do something else when release
90 }
91 return false; // Skip all further processing of this key
92 case KC_SPC:
93 if (record->event.pressed) {
94 if ((get_mods() & MOD_BIT(KC_LGUI)) == MOD_BIT(KC_LGUI)){
95 if(dfa_state == 3){
96 dfa_state = 0;
97 } else {
98 dfa_state = dfa_state + 1;
99 }
100 }
101 } else {
102 // Do something else when release
103 }
104 return true; // Continue execution
105
106
107 case KC_HOME:
108 if (record->event.pressed) {
109 switch(dfa_state){
110 case 0 :{
111 return false;
112 }
113 case 1 :{
114 tap_code16(G(KC_SPC));
115 wait_ms(100);
116 tap_code16(G(KC_SPC));
117 wait_ms(100);
118 tap_code16(G(KC_SPC));
119 dfa_state = 0;
120 return false;
121 }
122 case 2 :{
123 tap_code16(G(KC_SPC));
124 wait_ms(100);
125 tap_code16(G(KC_SPC));
126 dfa_state = 0;
127 return false;
128 }
129 case 3 :{
130 tap_code16(G(KC_SPC));
131 dfa_state = 0;
132 return false;
133 }
134 }
135
136 // Do something when pressed
137 } else {
138 // Do something else when release
139 }
140 return false; // Skip all further processing of this key
141 // case KC_PGUP:
142 // if (record->event.pressed) {
143 // switch(dfa_state){
144 // case 0 :{
145 // tap_code16(G(KC_SPC));
146 // dfa_state = 1;
147 // return false;
148 // }
149 // case 1 :{
150 // return false;
151 // }
152 // case 2 :{
153 // tap_code16(G(KC_SPC));
154 // wait_ms(100);
155 // tap_code16(G(KC_SPC));
156 // wait_ms(100);
157 // tap_code16(G(KC_SPC));
158 // dfa_state = 1;
159 // return false;
160 // }
161 // case 3 :{
162 // tap_code16(G(KC_SPC));
163 // wait_ms(100);
164 // tap_code16(G(KC_SPC));
165 // dfa_state = 1;
166 // return false;
167 // }
168 // }
169 // // Do something when pressed
170 // } else {
171 // // Do something else when release
172 // }
173 // return false; // Skip all further processing of this key
174 // case KC_PGDOWN:
175 // if (record->event.pressed) {
176 // switch(dfa_state){
177 // case 0 :{
178 // tap_code16(G(KC_SPC));
179 // wait_ms(100);
180 // tap_code16(G(KC_SPC));
181 // dfa_state = 2;
182 // return false;
183 // }
184 // case 1 :{
185 // tap_code16(G(KC_SPC));
186 // dfa_state = 2;
187 // return false;
188 // }
189 // case 2 :{
190 // return false;
191 // }
192 // case 3 :{
193 // tap_code16(G(KC_SPC));
194 // wait_ms(100);
195 // tap_code16(G(KC_SPC));
196 // wait_ms(100);
197 // tap_code16(G(KC_SPC));
198 // dfa_state = 2;
199 // return false;
200 // }
201 // }
202 // // Do something when pressed
203 // } else {
204 // // Do something else when release
205 // }
206 // return false; // Skip all further processing of this key
207 // case KC_END:
208 // if (record->event.pressed) {
209 // switch(dfa_state){
210 // case 0 :{
211 // tap_code16(G(KC_SPC));
212 // wait_ms(100);
213 // tap_code16(G(KC_SPC));
214 // wait_ms(100);
215 // tap_code16(G(KC_SPC));
216 // dfa_state = 3;
217 // return false;
218 // }
219 // case 1 :{
220 // tap_code16(G(KC_SPC));
221 // wait_ms(100);
222 // tap_code16(G(KC_SPC));
223 // dfa_state = 3;
224 // return false;
225 // }
226 // case 2 :{
227 // tap_code16(G(KC_SPC));
228 // dfa_state = 3;
229 // return false;
230 // }
231 // case 3 :{
232 // return false;
233 // }
234 // }
235 // // Do something when pressed
236 // } else {
237 // // Do something else when release
238 // }
239 // return false; // Skip all further processing of this key
240 case RGB_TOG:
241 if (record->event.pressed) {
242 switch (rgb_matrix_get_flags()) {
243 case LED_FLAG_ALL: {
244 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
245 rgb_matrix_set_color_all(0, 0, 0);
246 }
247 break;
248 case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
249 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
250 rgb_matrix_set_color_all(0, 0, 0);
251 }
252 break;
253 case LED_FLAG_UNDERGLOW: {
254 rgb_matrix_set_flags(LED_FLAG_NONE);
255 rgb_matrix_disable_noeeprom();
256 }
257 break;
258 default: {
259 rgb_matrix_set_flags(LED_FLAG_ALL);
260 rgb_matrix_enable_noeeprom();
261 }
262 break;
263 }
264 }
265 return false;
266 default:
267 return true; // Process all other keycodes normally
268 }
269}
270
271void set_layer_color(int layer) {
272 if (layer == 0) { return; }
273 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
274 HSV hsv = {
275 .h = pgm_read_byte(&ledmap[layer][i][0]),
276 .s = pgm_read_byte(&ledmap[layer][i][1]),
277 .v = pgm_read_byte(&ledmap[layer][i][2]),
278 };
279 if (hsv.h || hsv.s || hsv.v) {
280 RGB rgb = hsv_to_rgb(hsv);
281 float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
282 rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b);
283 } else if (layer != 1) {
284 // Only deactivate non-defined key LEDs at layers other than FN. Because at FN we have RGB adjustments and need to see them live.
285 // If the values are all false then it's a transparent key and deactivate LED at this layer
286 rgb_matrix_set_color(i, 0, 0, 0);
287 }
288 }
289}
290
291void rgb_matrix_indicators_user(void) {
292
293 led_t host_leds = host_keyboard_led_state();
294 if (host_leds.caps_lock) {
295 //rgb_matrix_set_color(30, 0xFF, 0xFF, 0xFF);
296 rgb_matrix_set_color(30, 0x0, 0x0, 0x0);
297
298 } else {
299 //rgb_matrix_set_color(30, 0x0, 0x0, 0x0);
300 }
301 set_layer_color(get_highest_layer(layer_state));
302
303}