aboutsummaryrefslogtreecommitdiff
path: root/users/bocaj/tap_dances.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/bocaj/tap_dances.c')
-rw-r--r--users/bocaj/tap_dances.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/users/bocaj/tap_dances.c b/users/bocaj/tap_dances.c
deleted file mode 100644
index a9628a345..000000000
--- a/users/bocaj/tap_dances.c
+++ /dev/null
@@ -1,64 +0,0 @@
1#include "tap_dances.h"
2
3
4//define diablo macro timer variables
5uint16_t diablo_timer[4];
6uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
7uint8_t diablo_key_time[4];
8
9// has the correct number of seconds elapsed (as defined by diablo_times)
10bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
11
12// Cycle through the times for the macro, starting at 0, for disabled.
13// Max of six values, so don't exceed
14void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
15 if (state->count >= 7) {
16 diablo_key_time[diablo_key] = diablo_times[0];
17 reset_tap_dance(state);
18 } else {
19 diablo_key_time[diablo_key] = diablo_times[state->count - 1];
20 }
21}
22
23// Would rather have one function for all of this, but no idea how to do that...
24void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); }
25void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); }
26void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); }
27void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); }
28
29//Tap Dance Definitions
30qk_tap_dance_action_t tap_dance_actions[] = {
31 // tap once to disable, and more to enable timed micros
32 [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
33 [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
34 [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
35 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
36};
37
38// Sends the key press to system, but only if on the Diablo layer
39void send_diablo_keystroke(uint8_t diablo_key) {
40 if (biton32(layer_state) == _DIABLO) {
41 switch (diablo_key) {
42 case 0:
43 tap(KC_1); break;
44 case 1:
45 tap(KC_2); break;
46 case 2:
47 tap(KC_3); break;
48 case 3:
49 tap(KC_4); break;
50 }
51 }
52}
53
54// Checks each of the 4 timers/keys to see if enough time has elapsed
55// Runs the "send string" command if enough time has passed, and resets the timer.
56void run_diablo_macro_check(void) {
57 uint8_t dtime;
58 for (dtime = 0; dtime < 4; dtime++) {
59 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
60 diablo_timer[dtime] = timer_read();
61 send_diablo_keystroke(dtime);
62 }
63 }
64}