diff options
Diffstat (limited to 'users/replicaJunction/replicaJunction.c')
-rw-r--r-- | users/replicaJunction/replicaJunction.c | 164 |
1 files changed, 20 insertions, 144 deletions
diff --git a/users/replicaJunction/replicaJunction.c b/users/replicaJunction/replicaJunction.c index f0bc59d25..55d8b7716 100644 --- a/users/replicaJunction/replicaJunction.c +++ b/users/replicaJunction/replicaJunction.c | |||
@@ -1,149 +1,25 @@ | |||
1 | /* Copyright 2021 Joshua T. | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include QMK_KEYBOARD_H | ||
1 | #include "replicaJunction.h" | 18 | #include "replicaJunction.h" |
2 | #include "version.h" | ||
3 | |||
4 | #ifdef TAP_DANCE_ENABLE | ||
5 | void dance_layer(qk_tap_dance_state_t *state, void *user_data) | ||
6 | { | ||
7 | uint8_t layer = biton32(layer_state); | ||
8 | |||
9 | if (state->count >= 5) | ||
10 | { | ||
11 | // 5 or more taps resets the keyboard | ||
12 | reset_keyboard(); | ||
13 | } | ||
14 | #ifdef L_QWERTY | ||
15 | else if (state->count == 3) | ||
16 | { | ||
17 | // Triple tap changes to QWERTY layer | ||
18 | if (layer == L_QWERTY) | ||
19 | { | ||
20 | layer_off(L_QWERTY); | ||
21 | } | ||
22 | else | ||
23 | { | ||
24 | layer_on(L_QWERTY); | ||
25 | } | ||
26 | } | ||
27 | #endif | ||
28 | #ifdef L_NUM | ||
29 | else if (state->count == 2) | ||
30 | { | ||
31 | // Double tap toggles Number layer | ||
32 | if (layer == L_NUM) | ||
33 | { | ||
34 | layer_off(L_NUM); | ||
35 | } | ||
36 | else | ||
37 | { | ||
38 | layer_on(L_NUM); | ||
39 | } | ||
40 | } | ||
41 | #endif | ||
42 | else | ||
43 | { | ||
44 | // Single tap sends Escape, and also turns off layers | ||
45 | // That's mostly in case I get stuck and forget where I am | ||
46 | #ifdef L_NUM | ||
47 | layer_off(L_NUM); | ||
48 | #endif | ||
49 | #ifdef L_EXTEND | ||
50 | layer_off(L_EXTEND); | ||
51 | #endif | ||
52 | #ifdef L_SYMBOL | ||
53 | layer_off(L_SYMBOL); | ||
54 | #endif | ||
55 | #ifdef L_QWERTY | ||
56 | layer_off(L_QWERTY); | ||
57 | #endif | ||
58 | register_code(KC_ESC); | ||
59 | unregister_code(KC_ESC); | ||
60 | } | ||
61 | }; | ||
62 | |||
63 | // Tap Dance Definitions | ||
64 | // Note - this needs to come AFTER the function is declared | ||
65 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
66 | [TD_LAYER_TOGGLE] = ACTION_TAP_DANCE_FN(dance_layer) | ||
67 | }; | ||
68 | |||
69 | #endif // TAP_DANCE_ENABLE | ||
70 | |||
71 | // These functions can be overridden in individual keymap files. | ||
72 | // This allows a user function to be shared for all my keyboards, while each | ||
73 | // keyboard can also have a keyboard-specific section. | ||
74 | |||
75 | // Note that keymaps don't need to override these if there's nothing to | ||
76 | // override them with. | ||
77 | __attribute__ ((weak)) | ||
78 | void matrix_init_keymap(void) {} | ||
79 | 19 | ||
80 | __attribute__ ((weak)) | 20 | __attribute__ ((weak)) |
81 | void matrix_scan_keymap(void) {} | 21 | void keyboard_post_init_user_kb(void) { } |
82 | 22 | ||
83 | __attribute__ ((weak)) | 23 | void keyboard_post_init_user(void) { |
84 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | 24 | keyboard_post_init_user_kb(); |
85 | return true; | ||
86 | }; | ||
87 | |||
88 | // Runs just one time when the keyboard initializes. | ||
89 | void matrix_init_user(void) { | ||
90 | #ifdef UNICODEMAP_ENABLE | ||
91 | // Set Unicode input to use WinCompose | ||
92 | // https://github.com/samhocevar/wincompose | ||
93 | set_unicode_input_mode(UC_WINC); | ||
94 | #endif // UNICODEMAP_ENABLE | ||
95 | |||
96 | matrix_init_keymap(); | ||
97 | }; | ||
98 | |||
99 | // Runs constantly in the background, in a loop. | ||
100 | void matrix_scan_user(void) { | ||
101 | matrix_scan_keymap(); | ||
102 | } | 25 | } |
103 | |||
104 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
105 | if (record->event.pressed) | ||
106 | return true; | ||
107 | |||
108 | switch(keycode) | ||
109 | { | ||
110 | case RJ_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader | ||
111 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP | ||
112 | #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) | ||
113 | ":dfu" | ||
114 | #elif defined(BOOTLOADER_HALFKAY) | ||
115 | ":teensy" | ||
116 | #elif defined(BOOTLOADER_CATERINA) | ||
117 | ":avrdude" | ||
118 | #endif // bootloader options | ||
119 | //SS_TAP(X_ENTER) | ||
120 | ); | ||
121 | return false; | ||
122 | case RJ_QMKV: | ||
123 | SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | ||
124 | return false; | ||
125 | case RJ_EQ: | ||
126 | SEND_STRING("=="); | ||
127 | return false; | ||
128 | case RJ_NEQ: | ||
129 | SEND_STRING("!="); | ||
130 | return false; | ||
131 | case RJ_GEQ: | ||
132 | SEND_STRING(">="); | ||
133 | return false; | ||
134 | case RJ_LEQ: | ||
135 | SEND_STRING("<="); | ||
136 | return false; | ||
137 | case RJ_GEQR: | ||
138 | SEND_STRING("=>"); | ||
139 | return false; | ||
140 | case RJ_DUND: | ||
141 | SEND_STRING("$_"); | ||
142 | return false; | ||
143 | case RJ_SELS: | ||
144 | SEND_STRING("select *"); | ||
145 | return false; | ||
146 | } | ||
147 | |||
148 | return process_record_keymap(keycode, record); | ||
149 | }; | ||