diff options
Diffstat (limited to 'users/xulkal/process_records.c')
-rw-r--r-- | users/xulkal/process_records.c | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 5ba59965f..115623caa 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c | |||
@@ -1,56 +1,58 @@ | |||
1 | #include "process_records.h" | 1 | #include "process_records.h" |
2 | 2 | #include "custom_keycodes.h" | |
3 | #ifdef TAP_DANCE_ENABLE | 3 | #include "timer_utils.h" |
4 | //Tap Dance Definitions | ||
5 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
6 | [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), | ||
7 | [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), | ||
8 | [TAP_TAB] = ACTION_TAP_DANCE_DOUBLE (KC_TAB, LSFT(KC_TAB)), | ||
9 | [CTRL_MINUS] = ACTION_TAP_DANCE_DOUBLE (KC_LCTL, KC_MINS), | ||
10 | [CTRL_PLUS] = ACTION_TAP_DANCE_DOUBLE (KC_RCTL, KC_EQL) | ||
11 | }; | ||
12 | #endif | ||
13 | 4 | ||
14 | #if defined(RGB_MATRIX_ENABLE) | 5 | #if defined(RGB_MATRIX_ENABLE) |
15 | extern void eeconfig_update_rgb_matrix_default(void); | 6 | extern void eeconfig_update_rgb_matrix_default(void); |
16 | #endif | 7 | #endif |
17 | 8 | ||
18 | #ifdef TRILAYER_ENABLED | 9 | #ifdef TRILAYER_ENABLED |
19 | uint32_t layer_state_set_user(uint32_t state) { | 10 | uint32_t layer_state_set_user(uint32_t state) |
20 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | 11 | { |
12 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
21 | } | 13 | } |
22 | #endif | 14 | #endif |
23 | 15 | ||
24 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 16 | bool process_record_user(uint16_t keycode, keyrecord_t *record) |
25 | static uint16_t reset_timer; | 17 | { |
26 | switch (keycode) { | 18 | static uint16_t reset_timer; |
27 | case RGBRST: | 19 | |
20 | #ifndef TAP_DANCE_ENABLE | ||
21 | if (!process_tap_dance_double(keycode, record)) | ||
22 | return false; | ||
23 | #endif | ||
24 | |||
25 | switch (keycode) | ||
26 | { | ||
27 | case RGBRST: | ||
28 | { | ||
28 | #if defined(RGBLIGHT_ENABLE) | 29 | #if defined(RGBLIGHT_ENABLE) |
29 | if (record->event.pressed) { | 30 | if (record->event.pressed) |
30 | eeconfig_update_rgblight_default(); | 31 | { |
31 | rgblight_enable(); | 32 | eeconfig_update_rgblight_default(); |
32 | } | 33 | rgblight_enable(); |
34 | } | ||
33 | #elif defined(RGB_MATRIX_ENABLE) | 35 | #elif defined(RGB_MATRIX_ENABLE) |
34 | if (record->event.pressed) { | 36 | if (record->event.pressed) |
35 | eeconfig_update_rgb_matrix_default(); | 37 | eeconfig_update_rgb_matrix_default(); |
36 | } | ||
37 | #endif | 38 | #endif |
38 | return false; | 39 | } |
39 | case RESET: | 40 | return false; |
40 | if (record->event.pressed) { | 41 | case RESET: |
41 | reset_timer = timer_read(); | 42 | { |
42 | } else { | 43 | if (record->event.pressed) |
43 | if (timer_elapsed(reset_timer) >= 500) { | 44 | reset_timer = timer_read() + 500; |
44 | reset_keyboard(); | 45 | else if (timer_expired(reset_timer)) |
45 | } | 46 | reset_keyboard(); |
46 | } | 47 | } |
47 | return false; | 48 | return false; |
48 | } | 49 | } |
49 | 50 | ||
50 | return process_record_keymap(keycode, record); | 51 | return process_record_keymap(keycode, record); |
51 | } | 52 | } |
52 | 53 | ||
53 | __attribute__ ((weak)) | 54 | __attribute__ ((weak)) |
54 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | 55 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) |
55 | return true; | 56 | { |
57 | return true; | ||
56 | } | 58 | } |