aboutsummaryrefslogtreecommitdiff
path: root/keyboards/kmac_pad/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/kmac_pad/keymaps/default/keymap.c')
-rw-r--r--keyboards/kmac_pad/keymaps/default/keymap.c143
1 files changed, 143 insertions, 0 deletions
diff --git a/keyboards/kmac_pad/keymaps/default/keymap.c b/keyboards/kmac_pad/keymaps/default/keymap.c
new file mode 100644
index 000000000..b9b9f823f
--- /dev/null
+++ b/keyboards/kmac_pad/keymaps/default/keymap.c
@@ -0,0 +1,143 @@
1/*
2Copyright 2021 talsu <talsu84@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19
20enum kmac_pad_keycodes {
21 MD_BOOT = SAFE_RANGE,
22 MCR1,
23 MCR2,
24 MCR3,
25 MCR4,
26 MCR5,
27 MCR6,
28 MCR7,
29 MCR8,
30 MCR9,
31 MCR10,
32 MCR11,
33 MCR12
34};
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 [0] = LAYOUT( /* Base */
38 TG(1),
39 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
40 KC_P7, KC_P8, KC_P9, KC_PPLS,
41 KC_P4, KC_P5, KC_P6,
42 KC_P1, KC_P2, KC_P3, KC_PENT,
43 KC_P0, KC_PDOT ),
44 [1] = LAYOUT( /* FN */
45 KC_TRNS,
46 MCR1, MCR2, MCR3, KC_TRNS,
47 MCR4, MCR5, MCR6, KC_TRNS,
48 MCR7, MCR8, MCR9,
49 MCR10, MCR11, MCR12, KC_TRNS,
50 KC_TRNS, MD_BOOT )
51};
52
53bool process_record_user(uint16_t keycode, keyrecord_t *record) {
54
55 switch (keycode) {
56 case MD_BOOT:
57 {
58 static uint32_t key_timer;
59 if (record->event.pressed) {
60 key_timer = timer_read32();
61 } else {
62 if (timer_elapsed32(key_timer) >= 2000) {
63 reset_keyboard();
64 }
65 }
66 return false;
67 }
68 case MCR1:
69 if (record->event.pressed) {
70 SEND_STRING("Macro 1");
71 }
72 return false;
73 case MCR2:
74 if (record->event.pressed) {
75 SEND_STRING("Macro 2");
76 }
77 return false;
78 case MCR3:
79 if (record->event.pressed) {
80 SEND_STRING("Macro 3");
81 }
82 return false;
83 case MCR4:
84 if (record->event.pressed) {
85 SEND_STRING("Macro 4");
86 }
87 return false;
88 case MCR5:
89 if (record->event.pressed) {
90 SEND_STRING("Macro 5");
91 }
92 return false;
93 case MCR6:
94 if (record->event.pressed) {
95 SEND_STRING("Macro 6");
96 }
97 return false;
98 case MCR7:
99 if (record->event.pressed) {
100 SEND_STRING("Macro 7");
101 }
102 return false;
103 case MCR8:
104 if (record->event.pressed) {
105 SEND_STRING("Macro 8");
106 }
107 return false;
108 case MCR9:
109 if (record->event.pressed) {
110 SEND_STRING("Macro 9");
111 }
112 return false;
113 case MCR10:
114 if (record->event.pressed) {
115 SEND_STRING("Macro 10");
116 }
117 return false;
118 case MCR11:
119 if (record->event.pressed) {
120 SEND_STRING("Macro 12");
121 }
122 return false;
123 case MCR12:
124 if (record->event.pressed) {
125 SEND_STRING("Macro 12");
126 }
127 return false;
128 default:
129 return true;
130 }
131
132}
133
134bool led_update_user(led_t led_state) {
135 writePin(B1, led_state.num_lock);
136 return false;
137}
138
139
140layer_state_t layer_state_set_user(layer_state_t state) {
141 writePin(B3, !IS_LAYER_ON_STATE(state, 0));
142 return state;
143}