aboutsummaryrefslogtreecommitdiff
path: root/keyboards/crkbd/keymaps/gotham/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/crkbd/keymaps/gotham/keymap.c')
-rw-r--r--keyboards/crkbd/keymaps/gotham/keymap.c143
1 files changed, 143 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/gotham/keymap.c b/keyboards/crkbd/keymaps/gotham/keymap.c
new file mode 100644
index 000000000..6657f21ee
--- /dev/null
+++ b/keyboards/crkbd/keymaps/gotham/keymap.c
@@ -0,0 +1,143 @@
1#include QMK_KEYBOARD_H
2#include "keycodes.h"
3
4#ifdef OLED_DRIVER_ENABLE
5# include "oled.c"
6#endif
7
8#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
9# include "rgb.c"
10#endif
11
12// clang-format off
13const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
14 [_QWERTY] = LAYOUT(
15 //|-----------------------------------------------------| |-----------------------------------------------------|
16 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
17 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
18 SFT_EQ, SFT_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SFT_SCLN,SFT_QT,
19 //---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
20 KC_LCTL, CTL_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, CTL_SLSH,ADJ_GRV,
21 //---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
22 KC_LALT, LOW_SPC, RAI_EQ, RAI_ENT, LOW_BSP, KC_LGUI
23 //|--------------------------| |--------------------------|
24
25
26 ),
27
28 [_LOWER] = LAYOUT(
29 //|-----------------------------------------------------| |-----------------------------------------------------|
30 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
31 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
32 _______, KC_ANGL, KC_ANGR, KC_LPRN, KC_RPRN, KC_PGUP, KC_MINS, KC_LEFT, KC_UP, KC_RIGHT,KC_PLUS, _______,
33 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
34 _______, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_PGDOWN, KC_UNDS, KC_HOME, KC_DOWN, KC_END, XXXXXXX, _______,
35 //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
36 _______, _______, _______, _______, LOW_DEL, _______
37 //|--------------------------| |--------------------------|
38 ),
39
40 [_RAISE] = LAYOUT(
41 //|-----------------------------------------------------| |-----------------------------------------------------|
42 KC_ESC, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, XXXXXXX, XXXXXXX, KC_AMPR, KC_PIPE, KC_EXLM, KC_ASTR, XXXXXXX,
43 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
44 _______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, XXXXXXX, XXXXXXX, KC_UNDS, KC_EQL, KC_ANGL, KC_ANGR, XXXXXXX,
45 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
46 _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, XXXXXXX, XXXXXXX, KC_MINS, KC_PLUS, XXXXXXX, KC_BSLS, _______,
47 //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
48 _______, _______, _______, _______, _______, _______
49 //|--------------------------| |--------------------------|
50 ),
51
52 [_ADJUST] = LAYOUT(
53 //|-----------------------------------------------------| |-----------------------------------------------------|
54 XXXXXXX, CK_RST, CK_DOWN, CK_UP, CK_TOGG, RGB_TOG, MU_TOG, KC_F12, KC_F7, KC_F8, KC_F9, XXXXXXX,\
55 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
56 XXXXXXX, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, RGB_MOD, MU_MOD, KC_F11, KC_F4, KC_F5, KC_F6, RESET, \
57 //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
58 XXXXXXX, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, RGBRST, AU_TOG, KC_F10, KC_F1, KC_F2, KC_F3, _______,\
59 //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
60 _______, _______, _______, _______, KC_VOLD, KC_VOLU \
61 //|--------------------------| |--------------------------|
62 )
63};
64// clang-format off
65
66#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
67layer_state_t layer_state_set_user(layer_state_t state) {
68 /* For any layer other than default, save current RGB state and switch to layer-based RGB */
69 if (layer_state_cmp(state, 0)) {
70 restore_rgb_config();
71 } else {
72 uint8_t layer = get_highest_layer(state);
73 if (layer_state_cmp(layer_state, 0)) save_rgb_config();
74 rgb_by_layer(layer);
75 }
76 return state;
77}
78#endif
79
80bool process_record_user(uint16_t keycode, keyrecord_t *record) {
81#ifdef OLED_DRIVER_ENABLE
82 if (record->event.pressed) {
83 oled_timer = timer_read();
84 add_keylog(keycode);
85 }
86#endif
87
88 switch (keycode) {
89 case LOWER:
90 if (record->event.pressed) {
91 layer_on(_LOWER);
92 } else {
93 layer_off(_LOWER);
94 }
95 return false;
96 case RAISE:
97 if (record->event.pressed) {
98 layer_on(_RAISE);
99 } else {
100 layer_off(_RAISE);
101 }
102 return false;
103 case ADJUST:
104 if (record->event.pressed) {
105 layer_on(_ADJUST);
106 } else {
107 layer_off(_ADJUST);
108 }
109 return false;
110#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
111 case RGB_MOD:
112 case RGB_TOG:
113 case RGB_HUI:
114 case RGB_HUD:
115 case RGB_SAI:
116 case RGB_SAD:
117 case RGB_VAI:
118 case RGB_VAD:
119 case RGB_SPI:
120 case RGB_SPD:
121 /* Override layer-based RGB and resume RGB effect to be able to preview changes */
122 if (record->event.pressed) {
123 restore_rgb_config();
124 process_rgb(keycode, record);
125 save_rgb_config();
126 }
127 return false;
128 case RGBRST:
129 if (record->event.pressed) {
130# ifdef RGBLIGHT_ENABLE
131 eeconfig_update_rgblight_default();
132 rgblight_enable();
133# elif RGB_MATRIX_ENABLE
134 eeconfig_update_rgb_matrix_default();
135 rgb_matrix_enable();
136# endif
137 save_rgb_config();
138 }
139 return false;
140#endif
141 }
142 return true;
143}