summaryrefslogtreecommitdiffstats
path: root/users/drashna/drashna.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/drashna.c')
-rw-r--r--users/drashna/drashna.c96
1 files changed, 89 insertions, 7 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 8efd99f80..f72902f0b 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -38,7 +38,7 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
clear_keyboard();
tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
wait_ms(50);
- send_string(str);
+ send_string_with_delay(str, MACRO_TIMER);
wait_ms(50);
tap(KC_ENTER);
}
@@ -48,6 +48,40 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
+bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) {
+ static uint16_t this_timer;
+ if(pressed) {
+ this_timer= timer_read();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM){
+ register_code(code);
+ unregister_code(code);
+ } else {
+ register_code(mod_code);
+ register_code(code);
+ unregister_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ return false;
+}
+
+bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
+ if(pressed) {
+ this_timer= timer_read();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM){
+ register_code(code);
+ unregister_code(code);
+ } else {
+ register_code(mod_code);
+ register_code(code);
+ unregister_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ return false;
+}
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
@@ -57,6 +91,15 @@ __attribute__ ((weak))
void matrix_init_keymap(void) {}
__attribute__ ((weak))
+void startup_keymap(void) {}
+
+__attribute__ ((weak))
+void suspend_power_down_keymap(void) {}
+
+__attribute__ ((weak))
+void suspend_wakeup_init_keymap(void) {}
+
+__attribute__ ((weak))
void matrix_scan_keymap(void) {}
__attribute__ ((weak))
@@ -69,12 +112,18 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}
+
__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
return state;
}
__attribute__ ((weak))
+uint32_t default_layer_state_set_keymap (uint32_t state) {
+ return state;
+}
+
+__attribute__ ((weak))
void led_set_keymap(uint8_t usb_led) {}
@@ -99,14 +148,38 @@ void matrix_init_user(void) {
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(UC_WINC);
#endif //UNICODE_ENABLE
- matrix_init_rgb();
matrix_init_keymap();
}
+void startup_user (void) {
+ #ifdef RGBLIGHT_ENABLE
+ matrix_init_rgb();
+ #endif //RGBLIGHT_ENABLE
+ startup_keymap();
+}
+
+void suspend_power_down_user(void)
+{
+ suspend_power_down_keymap();
+}
+
+void suspend_wakeup_init_user(void)
+{
+ suspend_wakeup_init_keymap();
+ #ifdef KEYBOARD_ergodox_ez
+ wait_ms(10);
+ #endif
+}
+
// No global matrix scan code, so just run keymap's matrix
// scan function
void matrix_scan_user(void) {
+ static bool has_ran_yet;
+ if (!has_ran_yet) {
+ has_ran_yet = true;
+ startup_user();
+ }
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
@@ -160,7 +233,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
if (!record->event.pressed) {
- SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
+ send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP
#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
":dfu"
#elif defined(BOOTLOADER_HALFKAY)
@@ -168,7 +241,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#elif defined(BOOTLOADER_CATERINA)
":avrdude"
#endif // bootloader options
- SS_TAP(X_ENTER));
+ SS_TAP(X_ENTER)), 10);
}
return false;
break;
@@ -197,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case VRSN: // Prints firmware version
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
+ send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER);
}
return false;
break;
@@ -256,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
diablo_key_time[dtime] = diablo_times[0];
}
}
-#endif // TAP_DANCE_ENABLE#endif
+#endif // TAP_DANCE_ENABLE
return false; break;
@@ -314,7 +387,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif // UNICODE_ENABLE
}
- return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record);
+ return process_record_keymap(keycode, record) &&
+#ifdef RGBLIGHT_ENABLE
+ process_record_user_rgb(keycode, record) &&
+#endif // RGBLIGHT_ENABLE
+ process_record_secrets(keycode, record);
}
@@ -331,6 +408,11 @@ uint32_t layer_state_set_user(uint32_t state) {
}
+uint32_t default_layer_state_set_kb(uint32_t state) {
+ return default_layer_state_set_keymap (state);
+}
+
+
// Any custom LED code goes here.
// So far, I only have keyboard specific code,
// So nothing goes here.