aboutsummaryrefslogtreecommitdiff
path: root/keyboards/delikeeb/vanana/keymaps/default/keymap.c
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-04-10 12:13:40 +0100
committerAkshay <[email protected]>2022-04-10 12:13:40 +0100
commitdc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch)
tree4ccb8fa5886b66fa9d480edef74236c27f035e16 /keyboards/delikeeb/vanana/keymaps/default/keymap.c
Diffstat (limited to 'keyboards/delikeeb/vanana/keymaps/default/keymap.c')
-rw-r--r--keyboards/delikeeb/vanana/keymaps/default/keymap.c162
1 files changed, 162 insertions, 0 deletions
diff --git a/keyboards/delikeeb/vanana/keymaps/default/keymap.c b/keyboards/delikeeb/vanana/keymaps/default/keymap.c
new file mode 100644
index 000000000..281bb36ac
--- /dev/null
+++ b/keyboards/delikeeb/vanana/keymaps/default/keymap.c
@@ -0,0 +1,162 @@
1/* Copyright 2020 noclew
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
18#ifdef AUDIO_ENABLE
19 float song_coin[][2] = SONG(COIN_SOUND);
20#endif
21
22// Defines names for use in layer keycodes and the keymap
23enum layer_names {
24 _BASE,
25 _LOWER,
26 _RAISE,
27 _ADJUST
28};
29
30// Defines the keycodes used by our macros in process_record_user
31enum custom_keycodes {
32 BASE = SAFE_RANGE,
33 LOWER,
34 RAISE,
35};
36
37const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 /* BASE
39 * ------------------------------------------- -------------------------------------------
40 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
41 * ------------------------------------------- -------------------------------------------
42 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
43 * ------------------------------------------- --------- --------------------------------------------
44 * | Esc | A | S | D | F | G | | Bksp | | H | J | K | L | ; |Enter |
45 * ------------------------------------------- --------- -------------------------------------------
46 * | Shift| Z | X | C | V | B | | Del | | N | M | , | . | / |Sft(')|
47 * ------------------------------------------- --------- -------------------------------------------
48 * | GUI | Alt | Ctrl |Lower |Space | |Space |Raise |Alt | Left | Right|
49 * ------------------------------------ ------------------------------------
50 */
51
52 [_BASE] = LAYOUT(
53 KC_GRV, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_BSPC,
54 KC_TAB, KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSLS,
55 KC_ESC, KC_A , KC_S , KC_D , KC_F , KC_G , KC_BSPC, KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_ENT ,
56 KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_DEL , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, RSFT_T(KC_QUOT),
57 KC_LGUI, KC_LALT, KC_LCTL, LOWER , KC_SPC, KC_SPC , RAISE , KC_RALT, KC_LEFT, KC_RGHT
58 ),
59
60 [_LOWER] = LAYOUT(
61 KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 ,
62 KC_BSPC, KC_SLSH, KC_7 , KC_8 , KC_9 , KC_PPLS, KC_CIRC, KC_LBRC, KC_RBRC, KC_AT , KC_EXLM, _______,
63 KC_EQL , KC_0 , KC_4 , KC_5 , KC_6 , KC_MINS, KC_LEFT, KC_PIPE, KC_LPRN, KC_RPRN, KC_HASH, KC_DQUO, _______,
64 KC_ENT , KC_PAST, KC_1 , KC_2 , KC_3 , KC_UNDS, KC_RGHT, KC_DLR , KC_LCBR, KC_RCBR, KC_AMPR, KC_PERC, _______,
65 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
66 ),
67
68 [_RAISE] = LAYOUT(
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
70 _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_BSPC, KC_DEL , KC_END , _______,
71 _______, _______, _______, _______, _______, _______, KC_UP , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_QUOT, _______,
72 _______, _______, _______, _______, _______, _______, KC_DOWN, _______, KC_PGUP, _______, KC_PGDN, _______, _______,
73 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
74 ),
75
76 [_ADJUST] = LAYOUT(
77 RESET , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DEBUG ,
78 _______, RGB_TOG, RGB_RMOD, RGB_MOD, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______,
79 KC_CAPS, _______, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, KC_VOLU, _______, _______, _______, _______, _______, _______,
80 _______, AU_ON , AU_OFF , _______, _______, _______, KC_VOLD, _______, _______, _______, _______, _______, _______,
81 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
82 )
83};
84
85bool process_record_user(uint16_t keycode, keyrecord_t *record) {
86 switch (keycode) {
87
88 case LOWER:
89 if (record->event.pressed) {
90 layer_on(_LOWER);
91 update_tri_layer(_LOWER, _RAISE, _ADJUST);
92 } else {
93 layer_off(_LOWER);
94 update_tri_layer(_LOWER, _RAISE, _ADJUST);
95 }
96 return false;
97
98 case RAISE:
99 if (record->event.pressed) {
100 layer_on(_RAISE);
101 update_tri_layer(_LOWER, _RAISE, _ADJUST);
102 } else {
103 layer_off(_RAISE);
104 update_tri_layer(_LOWER, _RAISE, _ADJUST);
105 }
106 return false;
107
108 case RESET:
109 if (record->event.pressed) {
110 #ifdef AUDIO_ENABLE
111 stop_all_notes();
112 PLAY_SONG(song_coin);
113 #endif
114 }
115 return false;
116 }
117 return true;
118}
119
120bool encoder_update_user(uint8_t index, bool clockwise) {
121 /* With an if statement we can check which encoder was turned. */
122 if (index == 0) { /* First encoder */
123 /* And with another if statement we can check the direction. */
124 if (clockwise) {
125 if (IS_LAYER_ON(_LOWER)){
126 tap_code(KC_RIGHT);
127 } else if (IS_LAYER_ON(_RAISE)){
128 tap_code(KC_DOWN);
129 } else {
130 tap_code(KC_VOLU);
131 }
132 } else {
133 if (IS_LAYER_ON(_LOWER)){
134 tap_code(KC_LEFT);
135 } else if (IS_LAYER_ON(_RAISE)){
136 tap_code(KC_UP);
137 } else {
138 tap_code(KC_VOLD);
139 }
140 }
141
142 } else if (index == 1) { /* Second encoder. Only supported by Elite-C */
143 if (clockwise) {
144 if (IS_LAYER_ON(_LOWER)){
145 tap_code(KC_RIGHT);
146 } else if (IS_LAYER_ON(_RAISE)){
147 tap_code(KC_DOWN);
148 } else {
149 tap_code(KC_VOLU);
150 }
151 } else {
152 if (IS_LAYER_ON(_LOWER)){
153 tap_code(KC_LEFT);
154 } else if (IS_LAYER_ON(_RAISE)){
155 tap_code(KC_UP);
156 } else {
157 tap_code(KC_VOLD);
158 }
159 }
160 }
161 return true;
162}