aboutsummaryrefslogtreecommitdiff
path: root/keyboards/handwired
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-12-29 20:17:34 -0800
committerGitHub <noreply@github.com>2021-12-29 20:17:34 -0800
commitc4551d7ef1ed2c1069f23cc8499b7c7fc30f3ecf (patch)
tree67dc381a45d59626132c4c59b71c4b36fa971f8b /keyboards/handwired
parent1a8a842cfb3e87a82afb57ba29ca59c5fa6fe97b (diff)
downloadqmk_firmware-c4551d7ef1ed2c1069f23cc8499b7c7fc30f3ecf.tar.gz
qmk_firmware-c4551d7ef1ed2c1069f23cc8499b7c7fc30f3ecf.zip
[Keymap] Reorganization, cleanup and readmes for drashna code (#15617)
Diffstat (limited to 'keyboards/handwired')
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c100
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk46
2 files changed, 33 insertions, 113 deletions
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c
index 78a7db67a..290ea22c5 100644
--- a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c
@@ -115,103 +115,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
115 ), 115 ),
116}; 116};
117// clang-format on 117// clang-format on
118
119#ifdef POINTING_DEVICE_ENABLE
120static uint16_t mouse_timer = 0;
121static uint16_t mouse_debounce_timer = 0;
122static uint8_t mouse_keycode_tracker = 0;
123bool tap_toggling = false;
124
125void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
126 if ((x || y) && timer_elapsed(mouse_timer) > 125) {
127 mouse_timer = timer_read();
128 if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) {
129 layer_on(_MOUSE);
130 }
131 }
132
133# ifdef TAPPING_TERM_PER_KEY
134 if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL)
135# else
136 if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM
137# endif
138 || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) {
139 mouse_report->x = x;
140 mouse_report->y = y;
141 }
142# ifdef OLED_ENABLE
143 if (x || y) oled_timer = timer_read32();
144# endif
145}
146
147void matrix_scan_keymap(void) {
148 if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) {
149 layer_off(_MOUSE);
150 }
151 if (tap_toggling) {
152 if (!layer_state_is(_MOUSE)) {
153 layer_on(_MOUSE);
154 }
155 }
156}
157
158bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
159 switch (keycode) {
160 case TT(_MOUSE):
161 {
162 if (record->event.pressed) {
163 mouse_keycode_tracker++;
164 } else {
165# if TAPPING_TOGGLE != 0
166 if (record->tap.count == TAPPING_TOGGLE) {
167 tap_toggling ^= 1;
168# if TAPPING_TOGGLE == 1
169 if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
170# else
171 if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
172# endif
173 } else {
174 mouse_keycode_tracker--;
175 }
176# endif
177 }
178 mouse_timer = timer_read();
179 break;
180 }
181 case MO(_MOUSE):
182 case DPI_CONFIG:
183 case KC_MS_UP ... KC_MS_WH_RIGHT:
184 record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
185 mouse_timer = timer_read();
186 break;
187 default:
188 if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) {
189 layer_off(_MOUSE);
190 }
191 mouse_keycode_tracker = 0;
192 mouse_debounce_timer = timer_read();
193 break;
194 }
195 return true;
196}
197
198layer_state_t layer_state_set_keymap(layer_state_t state) {
199 if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) {
200 state |= (1UL << _MOUSE);
201 }
202 return state;
203}
204#endif
205
206void matrix_init_keymap(void) {
207#ifdef AUDIO_ENABLE
208 extern audio_config_t audio_config;
209
210 if (!is_keyboard_master()) {
211 audio_stop_all();
212 audio_config.enable = false;
213 }
214#endif
215}
216
217void keyboard_post_init_keymap(void) { matrix_init_keymap(); }
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
index 9b9032837..0765bb2c6 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
@@ -1,14 +1,34 @@
1RGBLIGHT_ENABLE = yes 1COMMAND_ENABLE = no
2RGBLIGHT_STARTUP_ANIMATION = yes 2RGBLIGHT_ENABLE = yes
3AUDIO_ENABLE = yes 3RGBLIGHT_STARTUP_ANIMATION = yes
4HAPTIC_ENABLE = no 4AUDIO_ENABLE = yes
5COMMAND_ENABLE = no 5HAPTIC_ENABLE = no
6TAP_DANCE_ENABLE = yes 6TAP_DANCE_ENABLE = yes
7UNICODE_ENABLE = yes 7OLED_ENABLE = yes
8OLED_ENABLE = yes 8WPM_ENABLE = yes
9WPM_ENABLE = yes 9ENCODER_ENABLE = yes
10ENCODER_ENABLE = yes 10ENCODER_MAP_ENABLE = yes
11ENCODER_MAP_ENABLE = yes 11AUTOCORRECTION_ENABLE = yes
12# DEBOUNCE_TYPE = sym_eager_pk 12CAPS_WORD_ENABLE = yes
13 13
14LTO_SUPPORTED = no 14ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c)
15 RGBLIGHT_ENABLE = no
16 AUDIO_ENABLE = no
17 HAPTIC_ENABLE = no
18 TAP_DANCE_ENABLE = no
19 OLED_ENABLE = no
20 WPM_ENABLE = no
21 ENCODER_ENABLE = no
22 AUTOCORRECTION_ENABLE = no
23 LTO_SUPPORTED = yes
24 SWAP_HANDS_ENABLE = no
25 CUSTOM_UNICODE_ENABLE = no
26 CAPS_WORD_ENABLE = no
27 BOOTLOADER = qmk-hid
28 BOOTLOADER_SIZE = 512
29endif
30ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/teensy2pp)
31 AUTOCORRECTION_ENABLE = no
32 CAPS_WORD_ENABLE = yes
33endif
34# DEBOUNCE_TYPE = sym_eager_pk