summaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authordrashna <drashna@live.com>2017-11-10 19:58:53 -0800
committerJack Humbert <jack.humb@gmail.com>2017-11-10 22:58:53 -0500
commit0533362e8205957493d52d4356aa20537a151118 (patch)
tree106e6feb82d31192ce349f68b4763c5a3d71dcaa /users/drashna
parent4df4fa7c265e1e5c9b262851a704db7755971229 (diff)
Cleaned uppersonal userspace and keymaps (#1998)
* Cleanup of keymaps * Remove Tap Dance from Orthodox keymap * Cleaned up userspace and keymaps * Added sample (template)userspace files to my folder
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/drashna.c115
-rw-r--r--users/drashna/drashna.h7
-rw-r--r--users/drashna/rules.mk1
-rw-r--r--users/drashna/template.c82
-rw-r--r--users/drashna/template.h18
5 files changed, 164 insertions, 59 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 47565ff9cb..30da7414ee 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -3,6 +3,10 @@
#include "action.h"
#include "version.h"
+// Add reconfigurable functions here, for keymap customization
+// This allows for a global, userspace functions, and continued
+// customization of the keymap. Use _keymap instead of _user
+// functions in the keymaps
__attribute__ ((weak))
void matrix_init_keymap(void) {}
@@ -13,8 +17,15 @@ __attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
+__attribute__ ((weak))
+uint32_t layer_state_set_keymap (uint32_t state) {
+ return state;
+}
+bool is_overwatch = false;
+// Call user matrix init, set default RGB colors and then
+// call the keymap's init function
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
uint8_t default_layer = eeconfig_read_default_layer();
@@ -44,6 +55,8 @@ void matrix_init_user(void) {
matrix_init_keymap();
}
+// No global matrix scan code, so just run keymap's matix
+// scan function
void matrix_scan_user(void) {
matrix_scan_keymap();
}
@@ -61,16 +74,10 @@ void persistent_default_layer_set(uint16_t default_layer) {
default_layer_set(default_layer);
}
-
+// Defines actions tor my global custom keycodes. Defined in drashna.h file
+// Then runs the _keymap's recod handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
-
- uint16_t kc;
- if (is_overwatch) {
- kc = KC_BSPC;
- }
- else {
- kc = KC_ENTER;
- }
+
#ifdef CONSOLE_ENABLE
xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
#endif
@@ -143,6 +150,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_ergodox_ez))
case KC_OVERWATCH:
if (record->event.pressed) {
is_overwatch = !is_overwatch;
@@ -154,8 +162,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_SALT:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("Salt, salt, salt...");
register_code(KC_ENTER);
@@ -165,8 +173,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_MORESALT:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("Please sir, can I have some more salt?!");
register_code(KC_ENTER);
@@ -176,10 +184,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_SALTHARD:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
- SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!");
+ SEND_STRING("Your salt only makes me harder, and even more aggressive!");
register_code(KC_ENTER);
unregister_code(KC_ENTER);
}
@@ -187,8 +195,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_GOODGAME:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("Good game, everyone!");
register_code(KC_ENTER);
@@ -198,8 +206,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_GLHF:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("Good luck, have fun!!!");
register_code(KC_ENTER);
@@ -209,8 +217,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_SYMM:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("Left click to win!");
register_code(KC_ENTER);
@@ -218,21 +226,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
- case KC_DOOMFIST:
- if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
- _delay_ms(50);
- SEND_STRING("Hey, look at me. I'm Doomfist, and I'm overpowered! All I do is spam punches all day! I'm DPS, tank and defense, rolled into one! All I need is team healing to be complete!");
- register_code(KC_ENTER);
- unregister_code(KC_ENTER);
- }
- return false;
- break;
case KC_JUSTGAME:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.");
register_code(KC_ENTER);
@@ -242,8 +239,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_TORB:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("That was positively riveting!");
register_code(KC_ENTER);
@@ -253,8 +250,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case KC_AIM:
if (!record->event.pressed) {
- register_code(kc);
- unregister_code(kc);
+ register_code(is_overwatch ? KC_BSPC : KC_ENTER);
+ unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
_delay_ms(50);
SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
_delay_ms(50);
@@ -262,13 +259,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+#endif
case KC_MAKE:
if (!record->event.pressed) {
+ SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
+#ifndef CATERINA_BOOTLOADER
+ SEND_STRING(":teensy ");
+#else
+ SEND_STRING(" ");
+#endif
#ifdef RGBLIGHT_ENABLE
- SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP " RGBLIGHT_ENABLE=yes" SS_TAP(X_ENTER));
+ SEND_STRING("RGBLIGHT_ENABLE=yes ");
+#else
+ SEND_STRING("RGBLIGHT_ENABLE=no ");
+#endif
+#ifdef AUDIO_ENABLE
+ SEND_STRING("AUDIO_ENABLE=yes ");
+#else
+ SEND_STRING("AUDIO_ENABLE=no ");
+#endif
+#ifdef FAUXCLICKY_ENABLE
+ SEND_STRING("FAUXCLICKY_ENABLE=yes ");
#else
- SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP " RGBLIGHT_ENABLE=no"SS_TAP(X_ENTER));
+ SEND_STRING("FAUXCLICKY_ENABLE=no ");
#endif
+ SEND_STRING(SS_TAP(X_ENTER));
}
return false;
break;
@@ -295,21 +310,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
- case KC_P00:
- if (!record->event.pressed) {
- register_code(KC_P0);
- unregister_code(KC_P0);
- register_code(KC_P0);
- unregister_code(KC_P0);
- }
- return false;
- break;
}
return process_record_keymap(keycode, record);
}
-
-uint32_t layer_state_set_kb(uint32_t state) {
+// Runs state check and changes underglow color and animation
+// on layer change, no matter where the change was initiated
+// Then runs keymap's layer change check
+uint32_t layer_state_set_user (uint32_t state) {
#ifdef RGBLIGHT_ENABLE
uint8_t default_layer = eeconfig_read_default_layer();
@@ -329,7 +337,6 @@ uint32_t layer_state_set_kb(uint32_t state) {
case _MACROS:
rgblight_set_orange;
is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
- rgblight_mode(18);
break;
case _MEDIA:
rgblight_set_green;
@@ -375,5 +382,5 @@ uint32_t layer_state_set_kb(uint32_t state) {
break;
}
#endif
- return state;
+ return layer_state_set_keymap (state);
}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 0e7b25d2d3..6e897ad997 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -38,8 +38,7 @@
#define rgblight_set_purple rgblight_sethsv (0x10E, 0xFF, 0xFF);
#endif
-__attribute__ ((weak))
-bool is_overwatch = false;
+extern bool is_overwatch;
enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
@@ -59,15 +58,13 @@ enum custom_keycodes {
KC_SALTHARD,
KC_GOODGAME,
KC_SYMM,
- KC_DOOMFIST,
KC_JUSTGAME,
KC_GLHF,
KC_TORB,
KC_AIM,
KC_MAKE,
KC_RESET,
- KC_P00,
- NEWPLACEHOLDER
+ NEWPLACEHOLDER //use "NEWPLACEHOLDER for keymap specific codes
};
#endif
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 0150bb6089..6ce1ff5ba7 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,2 +1,3 @@
SRC += drashna.c
+EXTRAFLAGS = -flto
diff --git a/users/drashna/template.c b/users/drashna/template.c
new file mode 100644
index 0000000000..027c780e95
--- /dev/null
+++ b/users/drashna/template.c
@@ -0,0 +1,82 @@
+#include "drashna.h"
+#include "quantum.h"
+#include "action.h"
+#include "version.h"
+
+// Add reconfigurable functions here, for keymap customization
+// This allows for a global, userspace functions, and continued
+// customization of the keymap. Use _keymap instead of _user
+// functions in the keymaps
+__attribute__ ((weak))
+void matrix_init_keymap(void) {}
+
+__attribute__ ((weak))
+void matrix_scan_keymap(void) {}
+
+__attribute__ ((weak))
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+__attribute__ ((weak))
+uint32_t layer_state_set_keymap (uint32_t state) {
+ return state;
+}
+
+// Call user matrix init, then call the keymap's init function
+void matrix_init_user(void) {
+ matrix_init_keymap();
+}
+
+// No global matrix scan code, so just run keymap's matix
+// scan function
+void matrix_scan_user(void) {
+ matrix_scan_keymap();
+}
+
+
+// Defines actions tor my global custom keycodes. Defined in drashna.h file
+// Then runs the _keymap's recod handier if not processed here,
+// And use "NEWPLACEHOLDER" for new safe range
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+ switch (keycode) {
+ case KC_MAKE:
+ if (!record->event.pressed) {
+ SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
+#ifndef CATERINA_BOOTLOADER
+ SEND_STRING(":teensy ");
+#else
+ SEND_STRING(" ");
+#endif
+ SEND_STRING(SS_TAP(X_ENTER));
+ }
+ return false;
+ break;
+ case KC_RESET:
+ if (!record->event.pressed) {
+ reset_keyboard();
+ }
+ return false;
+ break;
+ case EPRM:
+ if (record->event.pressed) {
+ eeconfig_init();
+ }
+ return false;
+ break;
+ case VRSN:
+ if (record->event.pressed) {
+ SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ return false;
+ break;
+ }
+ return process_record_keymap(keycode, record);
+}
+
+// Runs state check and changes underglow color and animation
+// on layer change, no matter where the change was initiated
+// Then runs keymap's layer change check
+uint32_t layer_state_set_user (uint32_t state) {
+ return layer_state_set_keymap (state);
+}
diff --git a/users/drashna/template.h b/users/drashna/template.h
new file mode 100644
index 0000000000..d1251462b2
--- /dev/null
+++ b/users/drashna/template.h
@@ -0,0 +1,18 @@
+#ifndef USERSPACE
+#define USERSPACE
+
+#include "quantum.h"
+
+// Define layer names
+#define BASE 0
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+ EPRM,
+ VRSN,
+ KC_MAKE,
+ KC_RESET,
+ NEWPLACEHOLDER //use "NEWPLACEHOLDER for keymap specific codes
+};
+
+#endif