]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
[Keymap] Add KC_MAKE keycode to my userspace and keymaps (#5324)
authorstanrc85 <47038504+stanrc85@users.noreply.github.com>
Wed, 6 Mar 2019 20:20:51 +0000 (15:20 -0500)
committerDrashna Jaelre <drashna@live.com>
Wed, 6 Mar 2019 20:20:51 +0000 (12:20 -0800)
* 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

keyboards/hs60/v2/keymaps/stanrc85/keymap.c
layouts/community/60_ansi/stanrc85-ansi/keymap.c
users/stanrc85/rules.mk
users/stanrc85/stanrc85.c [new file with mode: 0644]
users/stanrc85/stanrc85.h

index f4dcf30f9f359212d339d5696c31d0efc3c70992..276adfe297cae4e57f914b29d95c3bc1e0e87920 100644 (file)
@@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
        [3] = LAYOUT_60_ansi(
                _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EEP_RST,
                _______, EF_INC,  ES_INC,  S1_INC,  H1_INC,  S2_INC,  H2_INC,  BR_INC,  _______, _______, _______, _______, _______, RESET,
-               TG(1),   EF_DEC,  ES_DEC,  S1_DEC,  H1_DEC,  S2_DEC,  H2_DEC,  BR_DEC,  _______, _______, _______, _______, _______,
+               TG(1),   EF_DEC,  ES_DEC,  S1_DEC,  H1_DEC,  S2_DEC,  H2_DEC,  BR_DEC,  _______, _______, _______, _______, KC_MAKE,
                _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
                _______, _______, _______,                   _______,                   _______, _______, _______, _______)
 };
@@ -65,6 +65,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 //  S2_INC, S2_DEC,   // Color 2 saturation increase/decrease
 //  BR_INC, BR_DEC,   // backlight brightness increase/decrease
 
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
   return true;
 }
index 27c3f16582fa5ea29bcd3fed97402a657d8b25a5..00d6f5ede498aa6ed12ec911bf123e2972afb144 100644 (file)
@@ -52,11 +52,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
        [3] = LAYOUT_60_ansi(
                _______, RGB_TOG, RGB_MOD, RGB_VAD, RGB_VAI, RGB_SAI, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______,
                _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,
-               TG(1),   _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+               TG(1),   _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MAKE,
                _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
                _______, _______, _______,                   _______,                   _______, _______, _______, _______)
 };
 
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
   return true;
 }
index c94dca0b7cf0623ccc20016dd212882484f3f599..4b66f9692db09bfaf458e54b8d07c2bdc1017667 100644 (file)
@@ -8,6 +8,8 @@ AUDIO_ENABLE = no
 CONSOLE_ENABLE = no
 NKRO_ENABLE = no
 
+SRC += stanrc85.c
+
 ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
   # Include my fancy rgb functions source here
   SRC += layer_rgb.c
diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c
new file mode 100644 (file)
index 0000000..ecf3641
--- /dev/null
@@ -0,0 +1,41 @@
+#include "stanrc85.h"
+
+__attribute__ ((weak))
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+  return true;
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  switch (keycode) {
+  case KC_MAKE:
+    if (!record->event.pressed) {
+      uint8_t temp_mod = get_mods();
+      uint8_t temp_osm = get_oneshot_mods();
+      clear_mods();
+      clear_oneshot_mods();
+      send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10);
+        if (temp_mod & MODS_SHIFT_MASK || temp_osm & MODS_SHIFT_MASK ) {
+          //RESET board for flashing if SHIFT held or tapped with KC_MAKE
+          #if defined(__arm__)
+            send_string_with_delay_P(PSTR(":dfu-util"), 10);
+            wait_ms(100);
+            reset_keyboard();
+          #elif defined(BOOTLOADER_DFU)
+            send_string_with_delay_P(PSTR(":dfu"), 10);
+          #elif defined(BOOTLOADER_HALFKAY)
+            send_string_with_delay_P(PSTR(":teensy"), 10);
+          #elif defined(BOOTLOADER_CATERINA)
+            send_string_with_delay_P(PSTR(":avrdude"), 10);
+          #else
+            reset_keyboard();
+          #endif // bootloader options
+        }
+        if (temp_mod & MODS_CTRL_MASK || temp_osm & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); }
+        send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10);
+        set_mods(temp_mod);
+      }
+    return false;
+    break;
+  }
+  return process_record_keymap(keycode, record);
+}
index 7e581f993eeac9a4940859d8489538c72f073b6b..091c810707feb06398b17d8676d0f03a7981e167 100644 (file)
@@ -1,12 +1,21 @@
 #pragma once
 
 #include "quantum.h"
+#include "version.h"
 
 #define DEFAULT 0  //Custom ANSI
 #define LAYER1 1   //Default ANSI (enable with Fn2+CAPS)
 #define LAYER2 2   //Function keys, arrows, custom shortcuts, volume control
 #define LAYER3 3   //RGB Underglow controls and RESET
 
+enum custom_keycodes {
+  KC_MAKE = SAFE_RANGE,
+  NEW_SAFE_RANGE  //use "NEW_SAFE_RANGE" for keymap specific codes
+};
+
+#define MODS_SHIFT_MASK  (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_CTRL_MASK  (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
+
 //Aliases for longer keycodes
 #define KC_CAD LALT(LCTL(KC_DEL))
 #define KC_LOCK        LGUI(KC_L)