4 #include "tap_dances.h"
6 static uint16_t copy_paste_timer;
7 userspace_config_t userspace_config;
12 void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
14 // Add reconfigurable functions here, for keymap customization
15 // This allows for a global, userspace functions, and continued
16 // customization of the keymap. Use _keymap instead of _user
17 // functions in the keymaps
18 __attribute__ ((weak))
19 void matrix_init_keymap(void) {}
21 __attribute__ ((weak))
22 void startup_keymap(void) {}
24 __attribute__ ((weak))
25 void suspend_power_down_keymap(void) {}
27 __attribute__ ((weak))
28 void suspend_wakeup_init_keymap(void) {}
30 __attribute__ ((weak))
31 void matrix_scan_keymap(void) {}
33 __attribute__ ((weak))
34 bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
38 __attribute__ ((weak))
39 bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
44 __attribute__ ((weak))
45 uint32_t layer_state_set_keymap (uint32_t state) {
49 __attribute__ ((weak))
50 uint32_t default_layer_state_set_keymap (uint32_t state) {
54 __attribute__ ((weak))
55 void led_set_keymap(uint8_t usb_led) {}
57 // Call user matrix init, set default RGB colors and then
58 // call the keymap's init function
59 void matrix_init_user(void) {
60 userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);
64 void startup_user (void) {
68 void suspend_power_down_user(void)
70 suspend_power_down_keymap();
73 void suspend_wakeup_init_user(void)
75 suspend_wakeup_init_keymap();
76 #ifdef KEYBOARD_ergodox_ez
81 // No global matrix scan code, so just run keymap's matrix
83 void matrix_scan_user(void) {
84 static bool has_ran_yet;
90 #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
91 run_diablo_macro_check();
92 #endif // TAP_DANCE_ENABLE
97 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
98 /* uint8_t default_layer = 0;
99 default_layer = eeconfig_read_default_layer(); */
102 if (!record->event.pressed) {
103 SEND_STRING(SS_LGUI("c"));
108 if (!record->event.pressed) {
109 SEND_STRING(SS_LGUI("v"));
114 if (!record->event.pressed) {
120 if (!record->event.pressed) {
121 set_single_persistent_default_layer(_SWRKMN);
122 layer_move(default_layer);
123 //ergodox_blink_all_leds();
124 //ergodox_blink_all_leds();
129 if (!record->event.pressed) {
130 set_single_persistent_default_layer(_HWRKMN);
131 layer_move(default_layer);
132 //ergodox_blink_all_leds();
133 //ergodox_blink_all_leds();
138 if (!record->event.pressed) {
139 //ergodox_blink_all_leds();
145 if (!record->event.pressed) {
146 layer_move(default_layer);
147 SEND_STRING(SS_LCTRL(SS_LGUI("q")));
152 #ifdef TAP_DANCE_ENABLE
153 if (record->event.pressed) {
155 for (dtime = 0; dtime < 4; dtime++) {
156 diablo_key_time[dtime] = diablo_times[0];
159 #endif // !TAP_DANCE_ENABLE
163 if (record->event.pressed) {
164 copy_paste_timer = timer_read();
166 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
167 SEND_STRING(SS_LGUI("c"));
169 SEND_STRING(SS_LGUI("v"));
175 return process_record_keymap(keycode, record);