diff options
Diffstat (limited to 'keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c')
-rw-r--r-- | keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c b/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c new file mode 100644 index 000000000..97f7039a7 --- /dev/null +++ b/keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* Copyright 2020 2Moons | ||
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_jp.h" | ||
18 | |||
19 | #ifdef RGBLIGHT_ENABLE | ||
20 | //Following line allows macro to read current RGB settings | ||
21 | extern rgblight_config_t rgblight_config; | ||
22 | #endif | ||
23 | |||
24 | extern uint8_t is_master; | ||
25 | |||
26 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
27 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
28 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
29 | // entirely and just use numbers. | ||
30 | enum layer_number { | ||
31 | _QWERTY = 0, | ||
32 | _FLOCK, | ||
33 | _FN, | ||
34 | _LOWER, | ||
35 | _RAISE, | ||
36 | _ADJUST, | ||
37 | }; | ||
38 | |||
39 | enum custom_keycodes { | ||
40 | RGB_RST = SAFE_RANGE | ||
41 | }; | ||
42 | |||
43 | enum tapdances{ | ||
44 | TD_ESFL = 0, | ||
45 | TD_ESQW, | ||
46 | }; | ||
47 | |||
48 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
49 | [TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK), | ||
50 | [TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY), | ||
51 | }; | ||
52 | |||
53 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
54 | [_QWERTY] = LAYOUT_all( | ||
55 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
56 | KC_ESC, KC_GRAVE, 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_BSPACE, KC_BSPACE, KC_BSPACE, | ||
57 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
58 | RGB_MODE_FORWARD, 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, | ||
59 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
60 | RGB_MODE_GRADIENT, 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, | ||
61 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
62 | RGB_MODE_XMAS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_RSFT, | ||
63 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
64 | RGB_TOG, KC_LCTL, KC_LALT, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL, MO(_FN) | ||
65 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
66 | ), | ||
67 | |||
68 | [_FLOCK] = LAYOUT_all( | ||
69 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
70 | KC_ESC, KC_GRAVE, 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_BSPACE, KC_BSPACE, KC_BSPACE, | ||
71 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
72 | RGB_MODE_FORWARD, 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, | ||
73 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
74 | RGB_MODE_GRADIENT, 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, | ||
75 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
76 | RGB_MODE_XMAS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_RSFT, | ||
77 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
78 | RGB_TOG, KC_LCTL, KC_LALT, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL, MO(_FN) | ||
79 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
80 | ), | ||
81 | |||
82 | [_FN] = LAYOUT_all( | ||
83 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
84 | KC_ESC, TG(_ADJUST), 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_INS, KC_BSPACE, KC_DEL, | ||
85 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
86 | _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUSE, KC_UP, _______, _______, _______, | ||
87 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
88 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, _______, _______, | ||
89 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
90 | _______, _______, _______, _______, _______, _______, _______, _______, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, _______, _______, | ||
91 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
92 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
93 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
94 | ), | ||
95 | |||
96 | [_LOWER] = LAYOUT_all( | ||
97 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
98 | KC_ESC, KC_GRAVE, 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_BSPACE, KC_BSPACE, KC_BSPACE, | ||
99 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
100 | RGB_MODE_FORWARD, 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, | ||
101 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
102 | RGB_MODE_GRADIENT, 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, | ||
103 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
104 | RGB_MODE_XMAS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_RSFT, | ||
105 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
106 | RGB_TOG, KC_LCTL, KC_LALT, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL, MO(_FN) | ||
107 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
108 | ), | ||
109 | |||
110 | [_RAISE] = LAYOUT_all( | ||
111 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
112 | KC_ESC, KC_GRAVE, 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_BSPACE, KC_BSPACE, KC_BSPACE, | ||
113 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
114 | RGB_MODE_FORWARD, 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, | ||
115 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
116 | RGB_MODE_GRADIENT, 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, | ||
117 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
118 | RGB_MODE_XMAS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_RSFT, | ||
119 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
120 | RGB_TOG, KC_LCTL, KC_LALT, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL, MO(_FN) | ||
121 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
122 | ), | ||
123 | |||
124 | [_ADJUST] = LAYOUT_all( /* Base */ | ||
125 | //,------------------------------------------------------------------------| |----------------------------------------------------------------. | ||
126 | XXXXXXX, TG(_ADJUST), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, | ||
127 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
128 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
129 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
130 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
131 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
132 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, XXXXXXX, | ||
133 | //|--------+---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+----------| | ||
134 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
135 | //`----------------------------------------------------------------| |--------------------------------------------' | ||
136 | ) | ||
137 | }; | ||
138 | |||
139 | |||
140 | //A description for expressing the layer position in LED mode. | ||
141 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
142 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
143 | #ifdef RGBLIGHT_ENABLE | ||
144 | switch (get_highest_layer(state)) { | ||
145 | case _FLOCK: | ||
146 | rgblight_sethsv_at(HSV_YELLOW, 0); | ||
147 | break; | ||
148 | case _FN: | ||
149 | rgblight_sethsv_at(HSV_GREEN, 0); | ||
150 | break; | ||
151 | case _LOWER: | ||
152 | rgblight_sethsv_at(HSV_BLUE, 0); | ||
153 | break; | ||
154 | case _RAISE: | ||
155 | rgblight_sethsv_at(HSV_RED, 0); | ||
156 | break; | ||
157 | case _ADJUST: | ||
158 | rgblight_sethsv_at(HSV_PURPLE, 0); | ||
159 | break; | ||
160 | default: // for any other layers, or the default layer | ||
161 | rgblight_sethsv_at( 0, 0, 0, 0); | ||
162 | break; | ||
163 | } | ||
164 | rgblight_set_effect_range( 1, 4); | ||
165 | #endif | ||
166 | return state; | ||
167 | } | ||
168 | |||
169 | int RGB_current_mode; | ||
170 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
171 | bool result = false; | ||
172 | switch (keycode) { | ||
173 | #ifdef RGBLIGHT_ENABLE | ||
174 | case RGB_MOD: | ||
175 | if (record->event.pressed) { | ||
176 | rgblight_mode(RGB_current_mode); | ||
177 | rgblight_step(); | ||
178 | RGB_current_mode = rgblight_config.mode; | ||
179 | } | ||
180 | break; | ||
181 | case RGB_RST: | ||
182 | if (record->event.pressed) { | ||
183 | eeconfig_update_rgblight_default(); | ||
184 | rgblight_enable(); | ||
185 | RGB_current_mode = rgblight_config.mode; | ||
186 | } | ||
187 | break; | ||
188 | #endif | ||
189 | default: | ||
190 | result = true; | ||
191 | break; | ||
192 | } | ||
193 | |||
194 | return result; | ||
195 | } | ||