diff options
Diffstat (limited to 'keyboards/m10a/keymaps/gam3cat/keymap.c')
| -rw-r--r-- | keyboards/m10a/keymaps/gam3cat/keymap.c | 199 |
1 files changed, 98 insertions, 101 deletions
diff --git a/keyboards/m10a/keymaps/gam3cat/keymap.c b/keyboards/m10a/keymaps/gam3cat/keymap.c index 8f4c878da..8ee35d50a 100644 --- a/keyboards/m10a/keymaps/gam3cat/keymap.c +++ b/keyboards/m10a/keymaps/gam3cat/keymap.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | #include "m10a.h" | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "action_layer.h" | ||
| 3 | #include "eeconfig.h" | ||
| 4 | #include "version.h" | 2 | #include "version.h" |
| 5 | 3 | ||
| 6 | extern keymap_config_t keymap_config; | 4 | extern keymap_config_t keymap_config; |
| @@ -18,46 +16,48 @@ enum layers { | |||
| 18 | _L9 | 16 | _L9 |
| 19 | }; | 17 | }; |
| 20 | 18 | ||
| 21 | enum m10a_keycodes { | 19 | enum custom_keycodes { |
| 22 | DYNAMIC_MACRO_RANGE = SAFE_RANGE, | 20 | DYNAMIC_MACRO_RANGE = SAFE_RANGE, |
| 21 | QMK_REV, | ||
| 22 | KC_WEB, | ||
| 23 | KC_WCLS | ||
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 26 | extern backlight_config_t backlight_config; | ||
| 27 | |||
| 25 | #include "dynamic_macro.h" | 28 | #include "dynamic_macro.h" |
| 26 | #define _______ KC_TRNS | 29 | #define FN_ZERO LT(_L9, KC_KP_0) |
| 27 | #define XXXXXXX KC_NO | ||
| 28 | #define FN_ZERO LT(_L9, KC_0) | ||
| 29 | #define KC_DMR1 DYN_REC_START1 | 30 | #define KC_DMR1 DYN_REC_START1 |
| 30 | #define KC_DMR2 DYN_REC_START2 | 31 | #define KC_DMR2 DYN_REC_START2 |
| 31 | #define KC_DMP1 DYN_MACRO_PLAY1 | 32 | #define KC_DMP1 DYN_MACRO_PLAY1 |
| 32 | #define KC_DMP2 DYN_MACRO_PLAY2 | 33 | #define KC_DMP2 DYN_MACRO_PLAY2 |
| 33 | #define KC_DMRS DYN_REC_STOP | 34 | #define KC_DMRS DYN_REC_STOP |
| 34 | 35 | ||
| 35 | static uint8_t current_layer; | ||
| 36 | |||
| 37 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 38 | /* .-----------. .-----------. .-----------. .-----------. .-----------. | 37 | /*## Layout Config: |
| 39 | * | 7| 8| 9| | +| -| *| | ^| &| !| |VLU|Ver|WFD| |VLU|NXT|FFD| | 38 | * .-----------. .-----------. .-----------. .-----------. .-----------. |
| 40 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 39 | * |7 |8 |9 | |+ |- |* | |^ |& |! | |VLU|Ver|WFD| |VLU|NXT|FFD| |
| 41 | * | 4| 5| 6| | /| %| ,| | D| E| F| |MUT|C-W|CHR| |MUT|STP|PLY| | 40 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 42 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 41 | * |4 |5 |6 | |/ |% |, | |D |E |F | |MUT|C-W|CHR| |MUT|STP|PLY| |
| 43 | * | 1| 2| 3| | .| =|Ent| | A| B| C| |VLD|CMP|WBK| |VLD|PRV|RWD| | 42 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 44 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 43 | * |1 |2 |3 | |. |= |Ent| |A |B |C | |VLD|CMP|WBK| |VLD|PRV|RWD| |
| 45 | * |L0 | _L9/0| |L1 | _L9 | |L2 | _L9 | |L3 | _L9 | |L4 | _L9 | | 44 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 46 | * *-----------* *-----------* *-----------* *-----------* *-----------* | 45 | * |#L0|_L9/0 | |#L1|_L9 | |#L2|_L9 | |#L3|_L9 | |#L4|_L9 | |
| 47 | * .-----------. .-----------. .-----------. .-----------. .-----------. | 46 | * *-----------* *-----------* *-----------* *-----------* *-----------* |
| 48 | * | | | | | | | | |MP1| |MP2| | | |RST| |_L6|_L7|_L8| | 47 | * .-----------. .-----------. .-----------. .-----------. .-----------. |
| 49 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 48 | * | | | | | | | | |MP1| |MP2| | | |RST| |_L6|_L7|_L8| |
| 50 | * | | | | | | | | | |MRS| | | | | | |_L3|_L4|_L5| | 49 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 51 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 50 | * | | | | | | | | | |MRS| | | | | | |_L3|_L4|_L5| |
| 52 | * | | | | | | | | |MR1| |MR2| | | | | |_L0|_L1|_L2| | 51 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 53 | * |-----------| |-----------| |-----------| |-----------| |-----------| | 52 | * | | | | | | | | |MR1| |MR2| | | | | |_L0|_L1|_L2| |
| 54 | * |L5 | _L9 | |L6 | _L9 | |L7 | _L9 | |L8 | _L9 | |L9 | | | 53 | * |-----------| |-----------| |-----------| |-----------| |-----------| |
| 55 | * *-----------* *-----------* *-----------* *-----------* *-----------* | 54 | * |#L5|_L9 | |#L6|_L9 | |#L7|_L9 | |#L8|_L9 | |#L9| | |
| 55 | * *-----------* *-----------* *-----------* *-----------* *-----------* | ||
| 56 | */ | 56 | */ |
| 57 | [_L0] = {{KC_7, KC_8, KC_9 }, {KC_4, KC_5, KC_6 }, {KC_1, KC_2, KC_3 }, {XXXXXXX, XXXXXXX, FN_ZERO}}, | 57 | [_L0] = {{KC_KP_7, KC_KP_8, KC_KP_9}, {KC_KP_4, KC_KP_5, KC_KP_6}, {KC_KP_1, KC_KP_2, KC_KP_3}, {XXXXXXX, XXXXXXX, FN_ZERO}}, |
| 58 | [_L1] = {{KC_PPLS, KC_PMNS, KC_PAST}, {KC_PSLS, KC_PERC, KC_COMM}, {KC_PDOT, KC_EQL, KC_PENT}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 58 | [_L1] = {{KC_PPLS, KC_PMNS, KC_PAST}, {KC_PSLS, KC_PERC, KC_COMM}, {KC_PDOT, KC_EQL, KC_PENT}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| 59 | [_L2] = {{KC_CIRC, KC_AMPR, KC_EXLM}, {S(KC_D), S(KC_E), S(KC_F)}, {S(KC_A), S(KC_B), S(KC_C)}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 59 | [_L2] = {{KC_CIRC, KC_AMPR, KC_EXLM}, {S(KC_D), S(KC_E), S(KC_F)}, {S(KC_A), S(KC_B), S(KC_C)}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| 60 | [_L3] = {{KC_VOLU, F(0), KC_WFWD}, {KC_MUTE, M(1), M(0) }, {KC_VOLD, KC_MYCM, KC_WBAK}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 60 | [_L3] = {{KC_VOLU, QMK_REV, KC_WFWD}, {KC_MUTE, KC_WCLS, KC_WEB }, {KC_VOLD, KC_MYCM, KC_WBAK}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| 61 | [_L4] = {{KC_VOLU, KC_MNXT, KC_MFFD}, {KC_MUTE, KC_MSTP, KC_MPLY}, {KC_VOLD, KC_MPRV, KC_MRWD}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 61 | [_L4] = {{KC_VOLU, KC_MNXT, KC_MFFD}, {KC_MUTE, KC_MSTP, KC_MPLY}, {KC_VOLD, KC_MPRV, KC_MRWD}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| 62 | [_L5] = {{_______, _______, _______}, {_______, _______, _______}, {_______, _______, _______}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 62 | [_L5] = {{_______, _______, _______}, {_______, _______, _______}, {_______, _______, _______}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| 63 | [_L6] = {{_______, _______, _______}, {_______, _______, _______}, {_______, _______, _______}, {XXXXXXX, XXXXXXX, MO(_L9)}}, | 63 | [_L6] = {{_______, _______, _______}, {_______, _______, _______}, {_______, _______, _______}, {XXXXXXX, XXXXXXX, MO(_L9)}}, |
| @@ -66,96 +66,93 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 66 | [_L9] = {{DF(_L6), DF(_L7), DF(_L8)}, {DF(_L3), DF(_L4), DF(_L5)}, {DF(_L0), DF(_L1), DF(_L2)}, {XXXXXXX, XXXXXXX, _______}}, | 66 | [_L9] = {{DF(_L6), DF(_L7), DF(_L8)}, {DF(_L3), DF(_L4), DF(_L5)}, {DF(_L0), DF(_L1), DF(_L2)}, {XXXXXXX, XXXXXXX, _______}}, |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { | 69 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 70 | switch(id) { | 70 | switch (keycode) { |
| 71 | case 0: | 71 | case QMK_REV: |
| 72 | if (record->event.pressed) { | 72 | if (record->event.pressed) { |
| 73 | return MACRO(I(10), D(LGUI), T(R), U(LGUI), END); | 73 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@" QMK_VERSION ":" QMK_BUILDDATE); |
| 74 | } | 74 | } |
| 75 | else { | 75 | return false; |
| 76 | break; | ||
| 77 | case KC_WEB: | ||
| 78 | if (record->event.pressed) { | ||
| 79 | SEND_STRING(SS_LGUI("r")); | ||
| 80 | wait_ms(100); | ||
| 76 | SEND_STRING("chrome.exe\n"); | 81 | SEND_STRING("chrome.exe\n"); |
| 77 | return false; | ||
| 78 | } | 82 | } |
| 79 | break; | 83 | return false; |
| 80 | case 1: | 84 | break; |
| 85 | case KC_WCLS: | ||
| 81 | if (record->event.pressed) { | 86 | if (record->event.pressed) { |
| 82 | return MACRO(I(10), D(LCTL), T(W), U(LCTL), END); | 87 | SEND_STRING (SS_LCTRL("w")); |
| 83 | } | 88 | } |
| 84 | break; | 89 | return false; |
| 90 | break; | ||
| 85 | } | 91 | } |
| 86 | return MACRO_NONE; | 92 | // Dynamic Macros. |
| 87 | }; | 93 | if (!process_record_dynamic_macro(keycode, record)) { |
| 88 | 94 | return false; | |
| 89 | const uint16_t PROGMEM fn_actions[] = { | ||
| 90 | [0] = ACTION_FUNCTION(0), | ||
| 91 | }; | ||
| 92 | |||
| 93 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { | ||
| 94 | switch (id) { | ||
| 95 | case 0: | ||
| 96 | if (record->event.pressed) { | ||
| 97 | SEND_STRING ("[Keyboard: " QMK_KEYBOARD "] -- [QMK Version: " QMK_VERSION "] -- [Keymap: " QMK_KEYMAP "]"); | ||
| 98 | } | ||
| 99 | break; | ||
| 100 | } | 95 | } |
| 96 | return true; | ||
| 97 | } | ||
| 98 | |||
| 99 | void custom_backlight_level(uint8_t level) { | ||
| 100 | if (level > BACKLIGHT_LEVELS) | ||
| 101 | level = BACKLIGHT_LEVELS; | ||
| 102 | backlight_config.level = level; | ||
| 103 | backlight_config.enable = !!backlight_config.level; | ||
| 104 | backlight_set(backlight_config.level); | ||
| 101 | } | 105 | } |
| 102 | 106 | ||
| 103 | void matrix_init_user(void) { | 107 | void matrix_init_user(void) { |
| 104 | #ifdef BACKLIGHT_ENABLE | 108 | #ifdef BACKLIGHT_ENABLE |
| 105 | backlight_level(0); | 109 | custom_backlight_level(0); |
| 106 | #endif | 110 | #endif |
| 107 | } | 111 | } |
| 108 | 112 | ||
| 109 | // Runs constantly in the background, in a loop. | ||
| 110 | void matrix_scan_user(void) { | 113 | void matrix_scan_user(void) { |
| 111 | uint8_t layer = biton32(layer_state); | ||
| 112 | 114 | ||
| 113 | if (current_layer == layer) { | ||
| 114 | } | ||
| 115 | else { | ||
| 116 | current_layer = layer; | ||
| 117 | switch (layer) { | ||
| 118 | case 0: | ||
| 119 | backlight_level(0); | ||
| 120 | break; | ||
| 121 | case 1: | ||
| 122 | backlight_level(1); | ||
| 123 | break; | ||
| 124 | case 2: | ||
| 125 | backlight_level(2); | ||
| 126 | break; | ||
| 127 | case 3: | ||
| 128 | backlight_level(3); | ||
| 129 | break; | ||
| 130 | case 4: | ||
| 131 | backlight_level(4); | ||
| 132 | break; | ||
| 133 | case 5: | ||
| 134 | backlight_level(5); | ||
| 135 | break; | ||
| 136 | case 6: | ||
| 137 | backlight_level(6); | ||
| 138 | break; | ||
| 139 | case 7: | ||
| 140 | backlight_level(6); | ||
| 141 | break; | ||
| 142 | case 8: | ||
| 143 | backlight_level(6); | ||
| 144 | break; | ||
| 145 | case 9: | ||
| 146 | backlight_level(0); | ||
| 147 | break; | ||
| 148 | default: | ||
| 149 | backlight_level(0); | ||
| 150 | break; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | } | 115 | } |
| 154 | 116 | ||
| 155 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 117 | uint32_t layer_state_set_user(uint32_t state) { |
| 156 | // Enable Dynamic Macros. | 118 | switch (biton32(state)) { |
| 157 | if (!process_record_dynamic_macro(keycode, record)) { | 119 | case _L0: |
| 158 | return false; | 120 | custom_backlight_level(0); |
| 121 | break; | ||
| 122 | case _L1: | ||
| 123 | custom_backlight_level(1); | ||
| 124 | break; | ||
| 125 | case _L2: | ||
| 126 | custom_backlight_level(2); | ||
| 127 | break; | ||
| 128 | case _L3: | ||
| 129 | custom_backlight_level(3); | ||
| 130 | break; | ||
| 131 | case _L4: | ||
| 132 | custom_backlight_level(4); | ||
| 133 | break; | ||
| 134 | case _L5: | ||
| 135 | custom_backlight_level(5); | ||
| 136 | break; | ||
| 137 | case _L6: | ||
| 138 | custom_backlight_level(6); | ||
| 139 | break; | ||
| 140 | case _L7: | ||
| 141 | custom_backlight_level(6); | ||
| 142 | break; | ||
| 143 | case _L8: | ||
| 144 | custom_backlight_level(6); | ||
| 145 | break; | ||
| 146 | case _L9: | ||
| 147 | custom_backlight_level(0); | ||
| 148 | break; | ||
| 149 | default: | ||
| 150 | custom_backlight_level(0); | ||
| 151 | break; | ||
| 159 | } | 152 | } |
| 160 | return true; | 153 | return state; |
| 154 | } | ||
| 155 | |||
| 156 | void led_set_user(uint8_t usb_led) { | ||
| 157 | |||
| 161 | } | 158 | } |
