aboutsummaryrefslogtreecommitdiff
path: root/keyboards/amjpad/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/amjpad/keymaps/default/keymap.c')
-rw-r--r--keyboards/amjpad/keymaps/default/keymap.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/keyboards/amjpad/keymaps/default/keymap.c b/keyboards/amjpad/keymaps/default/keymap.c
new file mode 100644
index 000000000..362afd107
--- /dev/null
+++ b/keyboards/amjpad/keymaps/default/keymap.c
@@ -0,0 +1,101 @@
1#include "amjpad.h"
2
3#ifdef RGBLIGHT_ENABLE
4#include "rgblight.h"
5#endif
6
7// Used for SHIFT_ESC
8#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9
10// Each layer gets a name for readability, which is then used in the keymap matrix below.
11// The underscores don't mean anything - you can have a layer called STUFF or any other name.
12// Layer names don't all need to be of the same length, obviously, and you can also skip them
13// entirely and just use numbers.
14#define _BL 0
15#define _FL 1
16
17#define _______ KC_TRNS
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20 /* Keymap _BL: (Base Layer) Default Layer
21 * ,-------------------.
22 * |Esc |TAB |BS | = |
23 * |----|----|----|----|
24 * | NL | / | * | - |
25 * |----|----|----|----|
26 * | 7 | 8 | 9 | |
27 * |----|----|----| + |
28 * | 4 | 5 | 6 | |
29 * |----|----|----|----|
30 * | 1 | 2 | 3 | |
31 * |----|----|----| En |
32 * | 0 |./FN| |
33 * `-------------------'
34 */
35
36[_BL] = KEYMAP(
37 KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \
38 KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \
39 KC_P7, KC_P8, KC_P9, KC_PPLS, \
40 KC_P4, KC_P5, KC_P6, \
41 KC_P1, KC_P2, KC_P3, KC_PENT, \
42 KC_P0, LT(_FL,KC_PDOT)),
43
44 /* Keymap _FL: Function Layer
45 * ,-------------------.
46 * |Esc |TAB |BS | = |
47 * |----|----|----|----|
48 * | NL | / | * | - |
49 * |----|----|----|----|
50 * | 7 | 8 | 9 | |
51 * |----|----|----|RST |
52 * | 4 | 5 | 6 | |
53 * |----|----|----|----|
54 * | 1 | 2 | 3 | |
55 * |----|----|----| En |
56 * | 0 |./FN| |
57 * `-------------------'
58 */
59[_FL] = KEYMAP(
60
61 KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \
62 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
63 KC_P7, KC_P8, KC_P9, RESET, \
64 KC_P4, KC_P5, KC_P6, \
65 KC_P1, KC_P2, KC_P3, KC_PENT, \
66 KC_P0, LT(_FL,KC_PDOT)),
67};
68
69enum function_id {
70 SHIFT_ESC,
71};
72
73const uint16_t PROGMEM fn_actions[] = {
74 [0] = ACTION_FUNCTION(SHIFT_ESC),
75};
76
77void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
78 static uint8_t shift_esc_shift_mask;
79 switch (id) {
80 case SHIFT_ESC:
81 shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
82 if (record->event.pressed) {
83 if (shift_esc_shift_mask) {
84 add_key(KC_GRV);
85 send_keyboard_report();
86 } else {
87 add_key(KC_ESC);
88 send_keyboard_report();
89 }
90 } else {
91 if (shift_esc_shift_mask) {
92 del_key(KC_GRV);
93 send_keyboard_report();
94 } else {
95 del_key(KC_ESC);
96 send_keyboard_report();
97 }
98 }
99 break;
100 }
101}