X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=users%2Fxulkal%2Fprocess_records.c;h=2c5d2a4e751d58e344ef45848af5295e4b21ffb0;hb=e2dfb787da2a2ba88e0e074b396a2b988e10eccf;hp=5ba59965fb88b714983456147924bf8805979f40;hpb=6b8be985551efc5a5f95dfea6dc1554352bc46e0;p=qmk_firmware.git diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 5ba59965f..2c5d2a4e7 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,56 +1,54 @@ #include "process_records.h" +#include "custom_keycodes.h" +#include "timer_utils.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) -}; +#ifdef TRILAYER_ENABLED +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} #endif -#if defined(RGB_MATRIX_ENABLE) -extern void eeconfig_update_rgb_matrix_default(void); -#endif +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + static uint16_t reset_timer; -#ifdef TRILAYER_ENABLED -uint32_t layer_state_set_user(uint32_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} +#ifndef TAP_DANCE_ENABLE + if (!process_tap_dance_double(keycode, record)) + return false; #endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint16_t reset_timer; - switch (keycode) { - case RGBRST: + 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; }