diff options
author | DaneEvans <dane@goneepic.com> | 2021-05-27 15:30:34 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 22:30:34 -0700 |
commit | 9da95bc3abc2d5682aea917e56abfeae30a7980f (patch) | |
tree | 8da651a066b4fb878e605d097ae13942ec453e7f /keyboards/navi10 | |
parent | 088c71b4ea6e083f01d6c5d7248555972c4125a4 (diff) | |
download | qmk_firmware-9da95bc3abc2d5682aea917e56abfeae30a7980f.tar.gz qmk_firmware-9da95bc3abc2d5682aea917e56abfeae30a7980f.zip |
[Keymap] add personal keymap files, and sofle_rgb default maps, (#12267)
Diffstat (limited to 'keyboards/navi10')
-rw-r--r-- | keyboards/navi10/keymaps/devdev/config.h | 35 | ||||
-rw-r--r-- | keyboards/navi10/keymaps/devdev/keymap.c | 263 | ||||
-rw-r--r-- | keyboards/navi10/keymaps/devdev/rules.mk | 2 |
3 files changed, 300 insertions, 0 deletions
diff --git a/keyboards/navi10/keymaps/devdev/config.h b/keyboards/navi10/keymaps/devdev/config.h new file mode 100644 index 000000000..dba45a5f2 --- /dev/null +++ b/keyboards/navi10/keymaps/devdev/config.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | Copyright 2019 Ethan Durrant (emdarcher) | ||
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 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
20 | #undef DEBOUNCE | ||
21 | #define DEBOUNCE 1 | ||
22 | |||
23 | #define TAPPING_TERM 220 | ||
24 | |||
25 | #ifdef RGBLIGHT_ENABLE | ||
26 | #define RGB_DI_PIN D3 | ||
27 | #define RGBLED_NUM 3 | ||
28 | |||
29 | #define RGBLIGHT_LIMIT_VAL 120 | ||
30 | #define RGBLIGHT_HUE_STEP 10 | ||
31 | #define RGBLIGHT_SAT_STEP 17 | ||
32 | #define RGBLIGHT_VAL_STEP 17 | ||
33 | |||
34 | |||
35 | #endif | ||
diff --git a/keyboards/navi10/keymaps/devdev/keymap.c b/keyboards/navi10/keymaps/devdev/keymap.c new file mode 100644 index 000000000..b0d43ebc6 --- /dev/null +++ b/keyboards/navi10/keymaps/devdev/keymap.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /* Copyright 2019 Ethan Durrant (emdarcher) | ||
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 | |||
17 | // NAVI 10 | ||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | #define INDICATOR_LED B5 | ||
21 | |||
22 | |||
23 | #define _ML1 2 | ||
24 | #define _FN2 3 | ||
25 | #define _PR3 4 | ||
26 | #define _GI4 4 | ||
27 | |||
28 | |||
29 | #define HS_RED 0,255 | ||
30 | #define HS_WHITE 0, 0 | ||
31 | #define HS_ORANGE 28, 255 | ||
32 | #define HS_GREEN 85, 255 | ||
33 | #define HS_TURQUOISE 123, 90 | ||
34 | #define HS_CYAN 128, 255 | ||
35 | #define HS_AZURE 132, 102 | ||
36 | #define HS_BLUE 170, 255 | ||
37 | #define HS_PURPLE 191, 255 | ||
38 | #define HS_MAGENTA 213, 255 | ||
39 | |||
40 | |||
41 | //create the tap type | ||
42 | typedef struct { | ||
43 | bool is_press_action; | ||
44 | int state; | ||
45 | } tap; | ||
46 | |||
47 | //tap dance states | ||
48 | enum { | ||
49 | // uses https://beta.docs.qmk.fm/using-qmk/software-features/feature_tap_dance | ||
50 | SINGLE_TAP = 1, | ||
51 | SINGLE_HOLD = 2, | ||
52 | DOUBLE_TAP = 3, | ||
53 | TRIPLE_TAP = 4, | ||
54 | }; | ||
55 | |||
56 | //tap dance keys | ||
57 | enum { | ||
58 | TAPPY_KEY = 0 | ||
59 | }; | ||
60 | |||
61 | enum custom_keycodes { // git macros | ||
62 | M_G_HERE = SAFE_RANGE, | ||
63 | M_G_PUSH, | ||
64 | M_G_PULL, | ||
65 | M_G_ADD, | ||
66 | M_G_COMM | ||
67 | }; | ||
68 | |||
69 | //function to handle all the tap dances | ||
70 | int cur_dance(qk_tap_dance_state_t *state); | ||
71 | |||
72 | //functions for each tap dance | ||
73 | void tk_finished(qk_tap_dance_state_t *state, void *user_data); | ||
74 | void tk_reset(qk_tap_dance_state_t *state, void *user_data); | ||
75 | |||
76 | // define the macros in here | ||
77 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
78 | switch (keycode) { | ||
79 | // open git bash here | ||
80 | case M_G_HERE: | ||
81 | if (record->event.pressed) { | ||
82 | SEND_STRING(SS_TAP(X_APP)"s"); | ||
83 | } else { | ||
84 | // when keycode M_G_HERE is released | ||
85 | } | ||
86 | break; | ||
87 | |||
88 | //git push | ||
89 | case M_G_PUSH: | ||
90 | if (record->event.pressed) { | ||
91 | // when keycode M_G_PUSH is pressed | ||
92 | SEND_STRING("git push"SS_TAP(X_ENTER)); | ||
93 | } else { | ||
94 | // when keycode M_G_PUSH is released | ||
95 | } | ||
96 | break; | ||
97 | |||
98 | // git pull | ||
99 | case M_G_PULL: | ||
100 | if (record->event.pressed) { | ||
101 | SEND_STRING("git pull"SS_TAP(X_ENTER)); | ||
102 | } | ||
103 | break; | ||
104 | |||
105 | // git add | ||
106 | case M_G_ADD: | ||
107 | if (record->event.pressed) { | ||
108 | SEND_STRING("git add "); | ||
109 | } | ||
110 | break; | ||
111 | |||
112 | // git commit | ||
113 | case M_G_COMM: // git commit | ||
114 | if (record->event.pressed) { | ||
115 | SEND_STRING("git commit -m ' "); | ||
116 | } | ||
117 | break; | ||
118 | } | ||
119 | return true; | ||
120 | }; | ||
121 | |||
122 | |||
123 | |||
124 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
125 | // Base | ||
126 | [0] = LAYOUT( | ||
127 | TD(TAPPY_KEY),KC_HOME, KC_PGUP, | ||
128 | KC_DEL, KC_END, KC_PGDN, | ||
129 | |||
130 | KC_UP, | ||
131 | KC_LEFT, KC_DOWN, KC_RIGHT), | ||
132 | |||
133 | // media function layer, toggled on a single tap | ||
134 | [_ML1] = LAYOUT( | ||
135 | KC_TRNS, KC_BSPC, KC_VOLU, | ||
136 | KC_MUTE, KC_ENTER, KC_VOLD, | ||
137 | |||
138 | KC_SPC, | ||
139 | KC_MRWD, KC_MPLY, KC_MFFD), | ||
140 | |||
141 | // F keys, double tap to get here | ||
142 | [_FN2] = LAYOUT( | ||
143 | TO(0), KC_F3, KC_F5, | ||
144 | KC_F2, KC_F4, KC_F6, | ||
145 | |||
146 | KC_F7, | ||
147 | KC_F9, KC_F8, KC_F10), | ||
148 | |||
149 | // programming, triple tap to get here | ||
150 | [_PR3] = LAYOUT( | ||
151 | TO(0), A(KC_F7), S(KC_F10), //atmel, segger, pycharm | ||
152 | KC_F2, KC_F4, S(KC_F9), | ||
153 | |||
154 | KC_UP, | ||
155 | KC_LEFT, KC_DOWN, KC_RIGHT), | ||
156 | |||
157 | // git function layer, hold to get here | ||
158 | [_GI4] = LAYOUT( | ||
159 | KC_TRNS, M_G_PUSH, M_G_ADD, | ||
160 | M_G_HERE, M_G_PULL, M_G_COMM, | ||
161 | |||
162 | RGB_VAI, | ||
163 | RGB_TOG, RGB_VAD, RGB_MOD), | ||
164 | |||
165 | |||
166 | |||
167 | }; | ||
168 | |||
169 | //determine the current tap dance state | ||
170 | int cur_dance (qk_tap_dance_state_t *state){ | ||
171 | if(state->count == 1) | ||
172 | { | ||
173 | //if a tap was registered | ||
174 | if(!state->pressed) | ||
175 | { | ||
176 | //if not still pressed, then was a single tap | ||
177 | return SINGLE_TAP; | ||
178 | } else | ||
179 | { | ||
180 | //if still pressed/held down, then it's a single hold | ||
181 | return SINGLE_HOLD; | ||
182 | } | ||
183 | } | ||
184 | else if (state->count == 2) | ||
185 | { | ||
186 | return DOUBLE_TAP; | ||
187 | } | ||
188 | |||
189 | else if (state->count == 3) | ||
190 | { | ||
191 | return TRIPLE_TAP; | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | return 8; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | //initialize the tap structure for the tap key | ||
200 | static tap tk_tap_state = { | ||
201 | .is_press_action = true, | ||
202 | .state = 0 | ||
203 | }; | ||
204 | |||
205 | //functions that control what our tap dance key does | ||
206 | void tk_finished(qk_tap_dance_state_t *state, void *user_data){ | ||
207 | tk_tap_state.state = cur_dance(state); | ||
208 | uint8_t val = rgblight_get_val(); | ||
209 | switch(tk_tap_state.state){ | ||
210 | case SINGLE_TAP: | ||
211 | //send desired key when tapped: | ||
212 | //setting to the media layer | ||
213 | if(layer_state_is(_ML1)){ | ||
214 | //if already active, toggle it to off | ||
215 | layer_off(_ML1); | ||
216 | rgblight_sethsv(HS_PURPLE, val); | ||
217 | } else { | ||
218 | //turn on the media layer | ||
219 | layer_on(_ML1); | ||
220 | rgblight_sethsv_at(HS_RED, 0, 0); | ||
221 | rgblight_sethsv_at(HS_GREEN, 0, 1); | ||
222 | rgblight_sethsv_at(HS_BLUE, val, 2); | ||
223 | } | ||
224 | break; | ||
225 | |||
226 | case DOUBLE_TAP: | ||
227 | layer_on(_FN2); | ||
228 | rgblight_sethsv_at(HS_RED, 0, 0); | ||
229 | rgblight_sethsv_at(HS_GREEN, val, 1); | ||
230 | rgblight_sethsv_at(HS_BLUE, 0, 2); | ||
231 | break; | ||
232 | case TRIPLE_TAP: | ||
233 | layer_on(_PR3); | ||
234 | rgblight_sethsv_at(HS_RED, 0, 0); | ||
235 | rgblight_sethsv_at(HS_GREEN, val, 1); | ||
236 | rgblight_sethsv_at(HS_BLUE, val, 2); | ||
237 | break; | ||
238 | case SINGLE_HOLD: | ||
239 | //set to desired layer when held: | ||
240 | //setting to the function layer | ||
241 | layer_on(_GI4); | ||
242 | rgblight_sethsv_at(HS_RED, val, 0); | ||
243 | rgblight_sethsv_at(HS_GREEN, val, 1); | ||
244 | rgblight_sethsv_at(HS_BLUE, val, 2); | ||
245 | break; | ||
246 | } | ||
247 | } | ||
248 | |||
249 | void tk_reset(qk_tap_dance_state_t *state, void *user_data){ | ||
250 | //if held and released, leave the layer | ||
251 | if(tk_tap_state.state == SINGLE_HOLD){ | ||
252 | layer_off(_GI4); | ||
253 | uint8_t val = rgblight_get_val(); | ||
254 | rgblight_sethsv(HS_PURPLE, val); | ||
255 | } | ||
256 | //reset the state | ||
257 | tk_tap_state.state = 0; | ||
258 | } | ||
259 | |||
260 | //associate the tap dance key with its functionality | ||
261 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
262 | [TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, TAPPING_TERM) | ||
263 | }; | ||
diff --git a/keyboards/navi10/keymaps/devdev/rules.mk b/keyboards/navi10/keymaps/devdev/rules.mk new file mode 100644 index 000000000..1c1ed316a --- /dev/null +++ b/keyboards/navi10/keymaps/devdev/rules.mk | |||
@@ -0,0 +1,2 @@ | |||
1 | RGBLIGHT_ENABLE = yes | ||
2 | TAP_DANCE_ENABLE = yes \ No newline at end of file | ||