aboutsummaryrefslogtreecommitdiff
path: root/keyboards/abacus/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/abacus/keymaps/default/keymap.c')
-rw-r--r--keyboards/abacus/keymaps/default/keymap.c148
1 files changed, 148 insertions, 0 deletions
diff --git a/keyboards/abacus/keymaps/default/keymap.c b/keyboards/abacus/keymaps/default/keymap.c
new file mode 100644
index 000000000..c1d5bd882
--- /dev/null
+++ b/keyboards/abacus/keymaps/default/keymap.c
@@ -0,0 +1,148 @@
1/* Copyright 2020 nickolaij
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// wait DELAY ms before unregistering media keys
19#define MEDIA_KEY_DELAY 10
20
21// Defines names for use in layer keycodes and the keymap
22enum layer_names {
23 _BASE,
24 _UPPER,
25 _LOWER
26};
27
28// Defines the keycodes used by our macros in process_record_user
29enum custom_keycodes {
30 NICKURL = SAFE_RANGE,
31 ALTTAB
32};
33
34enum unicode_names {
35 LOVEEYES,
36 THINK,
37 UPSIDEDOWN,
38 NOMOUTH,
39 PARTY,
40 HEART,
41 EGGPLANT,
42 PEACH,
43 EMOJI100,
44 EMOJIB
45};
46
47const uint32_t PROGMEM unicode_map[] = {
48 [LOVEEYES] = 0x1f60d,
49 [THINK] = 0x1f914,
50 [UPSIDEDOWN] = 0x1f643,
51 [NOMOUTH] = 0x1f636,
52 [PARTY] = 0x1f973,
53 [HEART] = 0x1f495,
54 [EMOJI100] = 0x1f4af,
55 [PEACH] = 0x1f351,
56 [EGGPLANT] = 0x1f346,
57 [EMOJIB] = 0x1f171
58};
59
60
61
62const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
63 /* Base */
64 [_BASE] = LAYOUT(
65 KC_ESCAPE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPACE,
66 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_BSLASH,
67 KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_UP, KC_DELETE,
68 KC_LCTRL, KC_LGUI, MO(_UPPER), KC_SPACE, KC_ENTER, MO(_LOWER), KC_LEFT, KC_DOWN, KC_RIGHT
69 ),
70 [_UPPER] = LAYOUT(
71 KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
72 ALTTAB, _______, _______, _______, _______, _______, _______, _______, KC_LBRACKET, KC_RBRACKET, KC_QUOTE, KC_SLASH,
73 _______, _______, _______, _______, _______, _______, _______, _______, KC_MINUS, KC_EQUAL, _______, _______,
74 KC_LALT, _______, _______, _______, _______, _______, KC_HOME, _______, KC_END
75 ),
76 [_LOWER] = LAYOUT(
77 NICKURL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
78 _______, KC_F11, KC_F12, RGB_MODE_PLAIN, RGB_MODE_BREATHE, RGB_MODE_RAINBOW, RGB_MODE_SWIRL, RGB_MODE_SNAKE, RGB_MODE_KNIGHT, RGB_MODE_GRADIENT, XXXXXXX, RGB_TOG,
79 _______, X(LOVEEYES), X(THINK), X(UPSIDEDOWN), X(NOMOUTH), X(PARTY), X(PEACH), X(HEART), X(EGGPLANT), X(EMOJI100), X(EMOJIB), RGB_HUI,
80 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______
81 )
82
83
84};
85
86bool process_record_user(uint16_t keycode, keyrecord_t *record) {
87 switch (keycode) {
88 case NICKURL:
89 if (record->event.pressed) {
90 SEND_STRING("https://www.github.com/nickolaij");
91 } else {
92 tap_code(KC_ENTER);
93 }
94 return true;
95 break;
96
97 case ALTTAB:
98 if (record->event.pressed) {
99 tap_code16(A(KC_TAB));
100 }
101 return true;
102 break;
103
104 default:
105 return true;
106
107 }
108}
109
110
111void dip_switch_update_user(uint8_t index, bool active) {
112 switch (index) {
113 case 0:
114 if(active) {
115 switch(get_highest_layer(layer_state)) {
116 case _BASE:
117 tap_code16(LCTL(KC_F));
118 break;
119 case _UPPER:
120 tap_code(KC_MUTE);
121 break;
122 case _LOWER:
123 tap_code(KC_MEDIA_PLAY_PAUSE);
124 break;
125 }
126 }
127 }
128}
129
130
131void matrix_init_user(void) {
132 set_unicode_input_mode(UC_WINC);
133}
134
135void encoder_update_user(uint8_t index, bool clockwise) {
136
137 switch(get_highest_layer(layer_state)) {
138 case _BASE:
139 clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP);
140 break;
141 case _UPPER:
142 clockwise ? tap_code(KC_VOLU) : tap_code(KC_VOLD);
143 break;
144 case _LOWER:
145 clockwise ? tap_code(KC_MEDIA_NEXT_TRACK) : tap_code(KC_MEDIA_PREV_TRACK);
146 break;
147 }
148}