aboutsummaryrefslogtreecommitdiff
path: root/keyboards/zinc/keymaps/monks/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/zinc/keymaps/monks/keymap.c')
-rw-r--r--keyboards/zinc/keymaps/monks/keymap.c255
1 files changed, 255 insertions, 0 deletions
diff --git a/keyboards/zinc/keymaps/monks/keymap.c b/keyboards/zinc/keymaps/monks/keymap.c
new file mode 100644
index 000000000..5fd7c6aa8
--- /dev/null
+++ b/keyboards/zinc/keymaps/monks/keymap.c
@@ -0,0 +1,255 @@
1#include QMK_KEYBOARD_H
2
3extern keymap_config_t keymap_config;
4
5#ifdef RGBLIGHT_ENABLE
6//Following line allows macro to read current RGB settings
7extern rgblight_config_t rgblight_config;
8rgblight_config_t RGB_current_config;
9#endif
10
11extern uint8_t is_master;
12
13// Each layer gets a name for readability, which is then used in the keymap matrix below.
14// The underscores don't mean anything - you can have a layer called STUFF or any other name.
15// Layer names don't all need to be of the same length, obviously, and you can also skip them
16// entirely and just use numbers.
17enum layer_number {
18 _QWERTY = 0,
19 _LOWER,
20 _RAISE,
21 _ADJUST
22};
23
24enum custom_keycodes {
25 QWERTY = SAFE_RANGE,
26 COLEMAK,
27 DVORAK,
28 LOWER,
29 RAISE,
30 ADJUST,
31 BACKLIT,
32 KANA,
33 EISU,
34 RGBRST
35};
36
37enum macro_keycodes {
38 KC_SAMPLEMACRO,
39};
40
41
42//Macros
43#define M_SAMPLE M(KC_SAMPLEMACRO)
44
45const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \
46 /* Qwerty
47 * ,-----------------------------------------. ,-----------------------------------------.
48 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
49 * |------+------+------+------+------+------| |------+------+------+------+------+------|
50 * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
51 * |------+------+------+------+------+------| |------+------+------+------+------+------|
52 * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
53 * |------+------+------+------+------+------| |------+------+------+------+------+------|
54 * | Esc |ADJUST| Alt | GUI |LOWER |Space | | Space| RAISE| KANA | Left | Down | Right|
55 * `-----------------------------------------' `-----------------------------------------'
56 */
57[_QWERTY] = LAYOUT_ortho_4x12(
58 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
59 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
60 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
61 KC_ESC, ADJUST, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_RGHT \
62 ),
63
64 /* Lower
65 * ,-----------------------------------------. ,-----------------------------------------.
66 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
67 * |------+------+------+------+------+------| |------+------+------+------+------+------|
68 * | | | | | | | | - | _ | + | { | } | | |
69 * |------+------+------+------+------+------| |------+------+------+------+------+------|
70 * | | | | | | | | | | | | UP | |
71 * |------+------+------+------+------+------| |------+------+------+------+------+------|
72 * | | | | | | | | | | | | | |
73 * `-----------------------------------------' `-----------------------------------------'
74 */
75 [_LOWER] = LAYOUT_ortho_4x12( \
76 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
77 _______, _______, _______, _______, _______, _______, KC_MINS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
78 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, \
79 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
80 ),
81
82 /* Raise
83 * ,-----------------------------------------. ,-----------------------------------------.
84 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
85 * |------+------+------+------+------+------| |------+------+------+------+------+------|
86 * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
87 * |------+------+------+------+------+------| |------+------+------+------+------+------|
88 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | ? | |
89 * |------+------+------+------+------+------| |------+------+------+------+------+------|
90 * | | | | | | | | | | Next | Vol- | Vol+ | Play |
91 * `-----------------------------------------' `-----------------------------------------'
92 */
93 [_RAISE] = LAYOUT_ortho_4x12( \
94 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
95 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
96 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, S(KC_SLSH), _______, \
97 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
98 ),
99
100 /* Adjust (Lower + Raise)
101 * ,-----------------------------------------. ,-----------------------------------------.
102 * | | Reset|RGBRST| | | | | | | | | | Ins |
103 * |------+------+------+------+------+------| |------+------+------+------+------+------|
104 * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause |
105 * |------+------+------+------+------+------| |------+------+------+------+------+------|
106 * | | MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| |
107 * |------+------+------+------+------+------| |------+------+------+------+------+------|
108 * | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End |
109 * `-----------------------------------------' `-----------------------------------------'
110 */
111 [_ADJUST] = LAYOUT_ortho_4x12( \
112 _______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, \
113 _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\
114 _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______,\
115 _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END\
116 )
117};
118
119// define variables for reactive RGB
120bool TOG_STATUS = false;
121
122// Setting ADJUST layer RGB back to default
123void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
124 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
125 #ifdef RGBLIGHT_ENABLE
126 rgblight_mode_noeeprom(RGB_current_config.mode);
127 #endif
128 layer_on(layer3);
129 } else {
130 layer_off(layer3);
131 }
132}
133
134bool process_record_user(uint16_t keycode, keyrecord_t *record) {
135 switch (keycode) {
136 case QWERTY:
137 if (record->event.pressed) {
138 set_single_persistent_default_layer(_QWERTY);
139 }
140 return false;
141 break;
142
143 case LOWER:
144 if (record->event.pressed) {
145 //not sure how to have keyboard check mode and set it to a variable, so my work around
146 //uses another variable that would be set to true after the first time a reactive key is pressed.
147 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
148 } else {
149 TOG_STATUS = !TOG_STATUS;
150 #ifdef RGBLIGHT_ENABLE
151 rgblight_mode_noeeprom(16);
152 #endif
153 }
154 layer_on(_LOWER);
155 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
156 } else {
157 #ifdef RGBLIGHT_ENABLE
158 rgblight_mode_noeeprom(RGB_current_config.mode); // revert RGB to initial mode prior to RGB mode change
159 #endif
160 TOG_STATUS = false;
161 layer_off(_LOWER);
162 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
163 }
164 return false;
165 break;
166
167 case RAISE:
168 if (record->event.pressed) {
169 //not sure how to have keyboard check mode and set it to a variable, so my work around
170 //uses another variable that would be set to true after the first time a reactive key is pressed.
171 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
172 } else {
173 TOG_STATUS = !TOG_STATUS;
174 #ifdef RGBLIGHT_ENABLE
175 rgblight_mode_noeeprom(15);
176 #endif
177 }
178 layer_on(_RAISE);
179 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
180 } else {
181 #ifdef RGBLIGHT_ENABLE
182 rgblight_mode_noeeprom(RGB_current_config.mode); // revert RGB to initial mode prior to RGB mode change
183 #endif
184 layer_off(_RAISE);
185 TOG_STATUS = false;
186 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
187 }
188 return false;
189 break;
190
191 case ADJUST:
192 if (record->event.pressed) {
193 layer_on(_ADJUST);
194 } else {
195 layer_off(_ADJUST);
196 }
197 return false;
198 break;
199 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
200 case RGB_MOD:
201 #ifdef RGBLIGHT_ENABLE
202 if (record->event.pressed) {
203 rgblight_mode_noeeprom(RGB_current_config.mode);
204 rgblight_step();
205 RGB_current_config.mode = rgblight_config.mode;
206 }
207 #endif
208 return false;
209 break;
210
211 case EISU:
212 if (record->event.pressed) {
213 if(keymap_config.swap_lalt_lgui==false){
214 register_code(KC_LANG2);
215 }else{
216 SEND_STRING(SS_LALT("`"));
217 }
218 } else {
219 unregister_code(KC_LANG2);
220 }
221 return false;
222 break;
223 case KANA:
224 if (record->event.pressed) {
225 if(keymap_config.swap_lalt_lgui==false){
226 register_code(KC_LANG1);
227 }else{
228 SEND_STRING(SS_LALT("`"));
229 }
230 } else {
231 unregister_code(KC_LANG1);
232 }
233 return false;
234 break;
235
236 case RGBRST:
237 #ifdef RGBLIGHT_ENABLE
238 if (record->event.pressed) {
239 eeconfig_update_rgblight_default();
240 rgblight_enable();
241 RGB_current_config = rgblight_config;
242 }
243 #endif
244 break;
245 }
246 return true;
247}
248
249
250void matrix_init_user(void) {
251 #ifdef RGBLIGHT_ENABLE
252 rgblight_init();
253 RGB_current_config = rgblight_config;
254 #endif
255}