From 9b46fabe084cd3e15104f88ef5d1f87f215de3c6 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Mon, 13 May 2019 09:58:15 -0500 Subject: Xulkal Keymap Changes (#5861) --- users/xulkal/process_records.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'users/xulkal/process_records.c') diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 531f99eb06..7c2b5e133f 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -16,13 +16,13 @@ extern void eeconfig_update_rgb_matrix_default(void); #endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint16_t reset_timer; switch (keycode) { case QWERTY: if (record->event.pressed) { set_single_persistent_default_layer(_QWERTY); } return false; - break; case GAME: #ifndef GAMELAYER_DISABLE if (record->event.pressed) { @@ -30,7 +30,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #endif return false; - break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); @@ -44,7 +43,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif } return false; - break; case RAISE: if (record->event.pressed) { layer_on(_RAISE); @@ -58,7 +56,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif } return false; - break; case RGBRST: #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { @@ -71,7 +68,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #endif return false; - break; + case RESET: + if (record->event.pressed) { + reset_timer = timer_read(); + } else { + if (timer_elapsed(reset_timer) >= 500) { + reset_keyboard(); + } + } + return false; } return process_record_keymap(keycode, record) && -- cgit v1.2.3 From a0d6c5a1136e2c56aa4a57eac08355c2b5d79ad5 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sun, 19 May 2019 11:15:50 -0500 Subject: [Keymap] Update Xulkal user code (#5920) --- users/xulkal/process_records.c | 56 ++++++------------------------------------ 1 file changed, 7 insertions(+), 49 deletions(-) (limited to 'users/xulkal/process_records.c') diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 7c2b5e133f..5ba59965fb 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -15,47 +15,15 @@ qk_tap_dance_action_t tap_dance_actions[] = { extern void eeconfig_update_rgb_matrix_default(void); #endif +#ifdef TRILAYER_ENABLED +uint32_t layer_state_set_user(uint32_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} +#endif + bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint16_t reset_timer; switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - case GAME: -#ifndef GAMELAYER_DISABLE - if (record->event.pressed) { - set_single_persistent_default_layer(_GAME); - } -#endif - return false; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } else { - layer_off(_LOWER); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } - return false; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } else { - layer_off(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } - return false; case RGBRST: #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { @@ -79,20 +47,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } - return process_record_keymap(keycode, record) && -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - process_record_rgb(keycode, record) && -#endif // RGBLIGHT_ENABLE; - true; + return process_record_keymap(keycode, record); } __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } - - -__attribute__ ((weak)) -bool process_record_rgb(uint16_t keycode, keyrecord_t *record) { - return true; -} -- cgit v1.2.3 From 4f788c2ae90583f64e0cec6545a3da75a5aff0f8 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sat, 1 Jun 2019 16:39:31 -0500 Subject: [Keymap] Xulkal user changes (#6044) * Xulkal user changes Xulkal user changes * Reduce code duplication * Massive user code refactor --- users/xulkal/process_records.c | 74 ++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'users/xulkal/process_records.c') diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 5ba59965fb..115623caa4 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,56 +1,58 @@ #include "process_records.h" - -#ifdef TAP_DANCE_ENABLE -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), - [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), - [TAP_TAB] = ACTION_TAP_DANCE_DOUBLE (KC_TAB, LSFT(KC_TAB)), - [CTRL_MINUS] = ACTION_TAP_DANCE_DOUBLE (KC_LCTL, KC_MINS), - [CTRL_PLUS] = ACTION_TAP_DANCE_DOUBLE (KC_RCTL, KC_EQL) -}; -#endif +#include "custom_keycodes.h" +#include "timer_utils.h" #if defined(RGB_MATRIX_ENABLE) extern void eeconfig_update_rgb_matrix_default(void); #endif #ifdef TRILAYER_ENABLED -uint32_t layer_state_set_user(uint32_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } #endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint16_t reset_timer; - switch (keycode) { - case RGBRST: +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + static uint16_t reset_timer; + +#ifndef TAP_DANCE_ENABLE + if (!process_tap_dance_double(keycode, record)) + return false; +#endif + + switch (keycode) + { + case RGBRST: + { #if defined(RGBLIGHT_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgblight_default(); - rgblight_enable(); - } + if (record->event.pressed) + { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } #elif defined(RGB_MATRIX_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgb_matrix_default(); - } + if (record->event.pressed) + eeconfig_update_rgb_matrix_default(); #endif - return false; - case RESET: - if (record->event.pressed) { - reset_timer = timer_read(); - } else { - if (timer_elapsed(reset_timer) >= 500) { - reset_keyboard(); - } - } - return false; + } + return false; + case RESET: + { + if (record->event.pressed) + reset_timer = timer_read() + 500; + else if (timer_expired(reset_timer)) + reset_keyboard(); + } + return false; } return process_record_keymap(keycode, record); } __attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) +{ + return true; } -- cgit v1.2.3