diff options
author | stanrc85 <47038504+stanrc85@users.noreply.github.com> | 2019-03-06 15:20:51 -0500 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-03-06 12:20:51 -0800 |
commit | 33e9f1c75a6961fa25689aba2586fd0ef1fba75f (patch) | |
tree | 59c653a830ee60fccefd39d09251397edb0eb7de | |
parent | be8257f0a784a07e7dd93ecafe96c1d7774383f7 (diff) | |
download | qmk_firmware-33e9f1c75a6961fa25689aba2586fd0ef1fba75f.tar.gz qmk_firmware-33e9f1c75a6961fa25689aba2586fd0ef1fba75f.zip |
[Keymap] Add KC_MAKE keycode to my userspace and keymaps (#5324)
* Add keycode for KC_MAKE
* Add KC_MAKE keycode
* Add stanrc85.c file with KC_MAKE
* Remove unused include
* Improved KC_MAKE stolen from Drashna
* Define mod mask for new KC_MAKE code
* RESET board to flash after compiling
* Remove send_string
* RESET fixed in KC_MAKE
-rw-r--r-- | keyboards/hs60/v2/keymaps/stanrc85/keymap.c | 4 | ||||
-rw-r--r-- | layouts/community/60_ansi/stanrc85-ansi/keymap.c | 4 | ||||
-rw-r--r-- | users/stanrc85/rules.mk | 2 | ||||
-rw-r--r-- | users/stanrc85/stanrc85.c | 41 | ||||
-rw-r--r-- | users/stanrc85/stanrc85.h | 9 |
5 files changed, 56 insertions, 4 deletions
diff --git a/keyboards/hs60/v2/keymaps/stanrc85/keymap.c b/keyboards/hs60/v2/keymaps/stanrc85/keymap.c index f4dcf30f9..276adfe29 100644 --- a/keyboards/hs60/v2/keymaps/stanrc85/keymap.c +++ b/keyboards/hs60/v2/keymaps/stanrc85/keymap.c | |||
@@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
52 | [3] = LAYOUT_60_ansi( | 52 | [3] = LAYOUT_60_ansi( |
53 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST, | 53 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST, |
54 | _______, EF_INC, ES_INC, S1_INC, H1_INC, S2_INC, H2_INC, BR_INC, _______, _______, _______, _______, _______, RESET, | 54 | _______, EF_INC, ES_INC, S1_INC, H1_INC, S2_INC, H2_INC, BR_INC, _______, _______, _______, _______, _______, RESET, |
55 | TG(1), EF_DEC, ES_DEC, S1_DEC, H1_DEC, S2_DEC, H2_DEC, BR_DEC, _______, _______, _______, _______, _______, | 55 | TG(1), EF_DEC, ES_DEC, S1_DEC, H1_DEC, S2_DEC, H2_DEC, BR_DEC, _______, _______, _______, _______, KC_MAKE, |
56 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 56 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
57 | _______, _______, _______, _______, _______, _______, _______, _______) | 57 | _______, _______, _______, _______, _______, _______, _______, _______) |
58 | }; | 58 | }; |
@@ -65,6 +65,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
65 | // S2_INC, S2_DEC, // Color 2 saturation increase/decrease | 65 | // S2_INC, S2_DEC, // Color 2 saturation increase/decrease |
66 | // BR_INC, BR_DEC, // backlight brightness increase/decrease | 66 | // BR_INC, BR_DEC, // backlight brightness increase/decrease |
67 | 67 | ||
68 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 68 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { |
69 | return true; | 69 | return true; |
70 | } | 70 | } |
diff --git a/layouts/community/60_ansi/stanrc85-ansi/keymap.c b/layouts/community/60_ansi/stanrc85-ansi/keymap.c index 27c3f1658..00d6f5ede 100644 --- a/layouts/community/60_ansi/stanrc85-ansi/keymap.c +++ b/layouts/community/60_ansi/stanrc85-ansi/keymap.c | |||
@@ -52,11 +52,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
52 | [3] = LAYOUT_60_ansi( | 52 | [3] = LAYOUT_60_ansi( |
53 | _______, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, RGB_SAI, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, | 53 | _______, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, RGB_SAI, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, |
54 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, | 54 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, |
55 | TG(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 55 | TG(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MAKE, |
56 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 56 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
57 | _______, _______, _______, _______, _______, _______, _______, _______) | 57 | _______, _______, _______, _______, _______, _______, _______, _______) |
58 | }; | 58 | }; |
59 | 59 | ||
60 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 60 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { |
61 | return true; | 61 | return true; |
62 | } | 62 | } |
diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk index c94dca0b7..4b66f9692 100644 --- a/users/stanrc85/rules.mk +++ b/users/stanrc85/rules.mk | |||
@@ -8,6 +8,8 @@ AUDIO_ENABLE = no | |||
8 | CONSOLE_ENABLE = no | 8 | CONSOLE_ENABLE = no |
9 | NKRO_ENABLE = no | 9 | NKRO_ENABLE = no |
10 | 10 | ||
11 | SRC += stanrc85.c | ||
12 | |||
11 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 13 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
12 | # Include my fancy rgb functions source here | 14 | # Include my fancy rgb functions source here |
13 | SRC += layer_rgb.c | 15 | SRC += layer_rgb.c |
diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c new file mode 100644 index 000000000..ecf364117 --- /dev/null +++ b/users/stanrc85/stanrc85.c | |||
@@ -0,0 +1,41 @@ | |||
1 | #include "stanrc85.h" | ||
2 | |||
3 | __attribute__ ((weak)) | ||
4 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
5 | return true; | ||
6 | } | ||
7 | |||
8 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
9 | switch (keycode) { | ||
10 | case KC_MAKE: | ||
11 | if (!record->event.pressed) { | ||
12 | uint8_t temp_mod = get_mods(); | ||
13 | uint8_t temp_osm = get_oneshot_mods(); | ||
14 | clear_mods(); | ||
15 | clear_oneshot_mods(); | ||
16 | send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10); | ||
17 | if (temp_mod & MODS_SHIFT_MASK || temp_osm & MODS_SHIFT_MASK ) { | ||
18 | //RESET board for flashing if SHIFT held or tapped with KC_MAKE | ||
19 | #if defined(__arm__) | ||
20 | send_string_with_delay_P(PSTR(":dfu-util"), 10); | ||
21 | wait_ms(100); | ||
22 | reset_keyboard(); | ||
23 | #elif defined(BOOTLOADER_DFU) | ||
24 | send_string_with_delay_P(PSTR(":dfu"), 10); | ||
25 | #elif defined(BOOTLOADER_HALFKAY) | ||
26 | send_string_with_delay_P(PSTR(":teensy"), 10); | ||
27 | #elif defined(BOOTLOADER_CATERINA) | ||
28 | send_string_with_delay_P(PSTR(":avrdude"), 10); | ||
29 | #else | ||
30 | reset_keyboard(); | ||
31 | #endif // bootloader options | ||
32 | } | ||
33 | if (temp_mod & MODS_CTRL_MASK || temp_osm & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); } | ||
34 | send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); | ||
35 | set_mods(temp_mod); | ||
36 | } | ||
37 | return false; | ||
38 | break; | ||
39 | } | ||
40 | return process_record_keymap(keycode, record); | ||
41 | } | ||
diff --git a/users/stanrc85/stanrc85.h b/users/stanrc85/stanrc85.h index 7e581f993..091c81070 100644 --- a/users/stanrc85/stanrc85.h +++ b/users/stanrc85/stanrc85.h | |||
@@ -1,12 +1,21 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | 2 | ||
3 | #include "quantum.h" | 3 | #include "quantum.h" |
4 | #include "version.h" | ||
4 | 5 | ||
5 | #define DEFAULT 0 //Custom ANSI | 6 | #define DEFAULT 0 //Custom ANSI |
6 | #define LAYER1 1 //Default ANSI (enable with Fn2+CAPS) | 7 | #define LAYER1 1 //Default ANSI (enable with Fn2+CAPS) |
7 | #define LAYER2 2 //Function keys, arrows, custom shortcuts, volume control | 8 | #define LAYER2 2 //Function keys, arrows, custom shortcuts, volume control |
8 | #define LAYER3 3 //RGB Underglow controls and RESET | 9 | #define LAYER3 3 //RGB Underglow controls and RESET |
9 | 10 | ||
11 | enum custom_keycodes { | ||
12 | KC_MAKE = SAFE_RANGE, | ||
13 | NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes | ||
14 | }; | ||
15 | |||
16 | #define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) | ||
17 | #define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL)) | ||
18 | |||
10 | //Aliases for longer keycodes | 19 | //Aliases for longer keycodes |
11 | #define KC_CAD LALT(LCTL(KC_DEL)) | 20 | #define KC_CAD LALT(LCTL(KC_DEL)) |
12 | #define KC_LOCK LGUI(KC_L) | 21 | #define KC_LOCK LGUI(KC_L) |