aboutsummaryrefslogtreecommitdiff
path: root/keyboards/crkbd/keymaps/mcrown/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/crkbd/keymaps/mcrown/keymap.c')
-rw-r--r--keyboards/crkbd/keymaps/mcrown/keymap.c141
1 files changed, 141 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/mcrown/keymap.c b/keyboards/crkbd/keymaps/mcrown/keymap.c
new file mode 100644
index 000000000..907e1347b
--- /dev/null
+++ b/keyboards/crkbd/keymaps/mcrown/keymap.c
@@ -0,0 +1,141 @@
1/** @file keymap.c
2 * @brief keymao.c that includes key layout and keylogs functions
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * @author Mario Corona ([email protected]) 2021
18 *
19 */
20
21#include "mcrown.h"
22
23const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24 [_QWERTY] = LAYOUT_wrapper(
25 /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/
26 _____________________QWERTY_L1______________________, _____________________QWERTY_R1______________________,
27 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
28 _____________________QWERTY_L2______________________, _____________________QWERTY_R2______________________,
29 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
30 _____________________QWERTY_L3______________________, _____________________QWERTY_R3______________________,
31 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
32 _____________MOD_LEFT_____________, _____________MOD_RIGHT____________
33 /*|-----------------------------------| |----------------------------------|*/
34 ),
35
36 [_LOWER] = LAYOUT_wrapper(
37 /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/
38 _____________________LOWER_L1_______________________, _____________________LOWER_R1_______________________,
39 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
40 _____________________LOWER_L2_______________________, _____________________LOWER_R2_______________________,
41 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
42 _____________________LOWER_L3_______________________, _____________________LOWER_R3_______________________,
43 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
44 _____________MOD_LEFT_____________, _____________MOD_RIGHT____________
45 /*|-----------------------------------| |----------------------------------|*/
46 ),
47
48 [_RAISE] = LAYOUT_wrapper(
49 /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/
50 _____________________RAISE_L1_______________________, _____________________RAISE_R1_______________________,
51 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
52 _____________________RAISE_L2_______________________, _____________________RAISE_R2_______________________,
53 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
54 _____________________RAISE_L3_______________________, _____________________RAISE_R3_______________________,
55 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
56 _____________MOD_LEFT_____________, _____________MOD_RIGHT____________
57 /*|-----------------------------------| |----------------------------------|*/
58 ),
59
60 [_ADJUST] = LAYOUT_wrapper(
61 /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/
62 _____________________ADJUST_L1______________________, _____________________ADJUST_R1______________________,
63 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
64 _____________________ADJUST_L2______________________, _____________________ADJUST_R2______________________,
65 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
66 _____________________ADJUST_L3______________________, _____________________ADJUST_R3______________________,
67 /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/
68 _____________MOD_LEFT_____________, _____________MOD_RIGHT____________
69 /*|-----------------------------------| |----------------------------------|*/
70 ),
71};
72
73bool process_record_user(uint16_t keycode, keyrecord_t *record){
74 bool user_records_press=true;
75
76 if (record->event.pressed){
77 add_keylog(keycode);
78 }
79
80 switch (keycode){
81 case QWERTY:
82 if (record->event.pressed){
83 set_single_persistent_default_layer(_QWERTY);
84 }
85 break;
86
87 case LOWER:
88 if(record->event.pressed){
89 layer_on(_LOWER);
90 update_tri_layer(_LOWER, _RAISE, _ADJUST);
91 }else{
92 layer_off(_LOWER);
93 update_tri_layer(_LOWER, _RAISE, _ADJUST);
94 }
95 break;
96
97 case RAISE:
98 if (record->event.pressed){
99 layer_on(_RAISE);
100 update_tri_layer(_LOWER, _RAISE, _ADJUST);
101 }else{
102 layer_off(_RAISE);
103 update_tri_layer(_LOWER, _RAISE, _ADJUST);
104 }
105 break;
106
107 case ADJUST:
108 if (record->event.pressed){
109 layer_on(_ADJUST);
110 }else{
111 layer_off(_ADJUST);
112 }
113 break;
114
115 case RGB_MOD:
116 #ifdef RGBLIGHT_ENABLE
117 if(record->event.pressed){
118 rgblight_mode(RGB_current_mode);
119 rgblight_step();
120 RGB_current_mode = rgblight_get_mode();
121 }
122 #endif
123 break;
124
125 case RGBRST:
126 #ifdef RGBLIGHT_ENABLE
127 if(record->event.pressed){
128 eeconfig_update_rgblight_default();
129 rgblight_enable();
130 RGB_current_mode = rgblight_get_mode();
131 }
132 #endif
133 break;
134
135 default:
136 user_records_press=false;
137 break;
138 }
139
140 return false==user_records_press;
141}