aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c17
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk4
-rw-r--r--keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c616
-rw-r--r--keyboards/handwired/dactyl_manuform/dactyl_manuform.h2
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c67
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h47
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/config.h91
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/info.json (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/info.json)6
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c62
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h)7
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c243
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk)3
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/readme.md (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/readme.md)0
-rw-r--r--keyboards/handwired/tractyl_manuform/4x6_right/rules.mk33
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c35
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h)31
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/config.h (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h)54
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/info.json75
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c63
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/post_config.h)33
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c)46
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk11
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/readme.md21
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/rules.mk (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/rules.mk)10
-rw-r--r--keyboards/handwired/tractyl_manuform/config.h43
-rw-r--r--keyboards/handwired/tractyl_manuform/post_config.h96
-rw-r--r--keyboards/handwired/tractyl_manuform/readme.md159
-rw-r--r--keyboards/handwired/tractyl_manuform/tm_sync.c132
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.c (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c)88
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.h55
-rw-r--r--keyboards/kyria/keymaps/drashna/keymap.c2
-rw-r--r--keyboards/kyria/keymaps/drashna/rules.mk12
-rw-r--r--layouts/community/ergodox/drashna/keymap.c13
-rw-r--r--layouts/community/ergodox/drashna/visualizer.c_old (renamed from layouts/community/ergodox/drashna/visualizer.c)0
-rw-r--r--layouts/community/split_3x6_3/drashna/config.h39
-rw-r--r--layouts/community/split_3x6_3/drashna/keymap.c2
-rw-r--r--users/drashna/config.h167
-rw-r--r--users/drashna/drashna.c31
-rw-r--r--users/drashna/drashna.h9
-rw-r--r--users/drashna/drashna_font.h5
-rw-r--r--users/drashna/drashna_transport.c603
-rw-r--r--users/drashna/oled_stuff.c83
-rw-r--r--users/drashna/oled_stuff.h165
-rw-r--r--users/drashna/process_records.c62
-rw-r--r--users/drashna/process_records.h82
-rw-r--r--users/drashna/rgb_matrix_stuff.c54
-rw-r--r--users/drashna/rgb_stuff.c100
-rw-r--r--users/drashna/rules.mk43
-rw-r--r--users/drashna/tap_dances.c8
-rw-r--r--users/drashna/tap_dances.h2
-rw-r--r--users/drashna/template.c6
-rw-r--r--users/drashna/template.h4
-rw-r--r--users/drashna/transport_sync.c80
-rw-r--r--users/drashna/transport_sync.h (renamed from keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h)6
54 files changed, 1899 insertions, 1829 deletions
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c
deleted file mode 100644
index 037f59af8..000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c
+++ /dev/null
@@ -1,17 +0,0 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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// placeholder
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk
deleted file mode 100644
index 457cda5b0..000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk
+++ /dev/null
@@ -1,4 +0,0 @@
1USER_NAME := drashna
2SRC += ../drashna/keymap.c
3
4include $(KEYBOARD_PATH_1)/keymaps/drashna/rules.mk
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c
deleted file mode 100644
index 1a9aeb2e3..000000000
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c
+++ /dev/null
@@ -1,616 +0,0 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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 <string.h>
18#include <stddef.h>
19
20#include "matrix.h"
21#include QMK_KEYBOARD_H
22
23#define ROWS_PER_HAND (MATRIX_ROWS / 2)
24#define SYNC_TIMER_OFFSET 2
25
26#ifdef RGBLIGHT_ENABLE
27# include "rgblight.h"
28#endif
29
30#ifdef BACKLIGHT_ENABLE
31# include "backlight.h"
32#endif
33
34#ifdef ENCODER_ENABLE
35# include "encoder.h"
36static pin_t encoders_pad[] = ENCODERS_PAD_A;
37# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t))
38#endif
39
40#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
41# include "led_matrix.h"
42#endif
43#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
44# include "rgb_matrix.h"
45#endif
46
47#ifdef POINTING_DEVICE_ENABLE
48static uint16_t device_cpi = 0;
49static int8_t split_mouse_x = 0, split_mouse_y = 0;
50#endif
51
52#ifdef OLED_DRIVER_ENABLE
53# include "oled_driver.h"
54#endif
55
56#if defined(USE_I2C)
57
58# include "i2c_master.h"
59# include "i2c_slave.h"
60
61typedef struct _I2C_slave_buffer_t {
62# ifndef DISABLE_SYNC_TIMER
63 uint32_t sync_timer;
64# endif
65# ifdef SPLIT_TRANSPORT_MIRROR
66 matrix_row_t mmatrix[ROWS_PER_HAND];
67# endif
68 matrix_row_t smatrix[ROWS_PER_HAND];
69# ifdef SPLIT_MODS_ENABLE
70 uint8_t real_mods;
71 uint8_t weak_mods;
72# ifndef NO_ACTION_ONESHOT
73 uint8_t oneshot_mods;
74# endif
75# endif
76# ifdef BACKLIGHT_ENABLE
77 uint8_t backlight_level;
78# endif
79# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
80 rgblight_syncinfo_t rgblight_sync;
81# endif
82# ifdef ENCODER_ENABLE
83 uint8_t encoder_state[NUMBER_OF_ENCODERS];
84# endif
85# ifdef WPM_ENABLE
86 uint8_t current_wpm;
87# endif
88 int8_t mouse_x;
89 int8_t mouse_y;
90 uint16_t device_cpi;
91 bool oled_on;
92 layer_state_t t_layer_state;
93 layer_state_t t_default_layer_state;
94# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
95 led_eeconfig_t led_matrix;
96 bool led_suspend_state;
97# endif
98# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
99 rgb_config_t rgb_matrix;
100 bool rgb_suspend_state;
101# endif
102} __attribute__((packed)) I2C_slave_buffer_t;
103
104static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg;
105
106# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level)
107# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
108# define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix)
109# define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix)
110# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer)
111# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods)
112# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods)
113# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods)
114# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state)
115# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
116# define I2C_MOUSE_X_START offsetof(I2C_slave_buffer_t, mouse_x)
117# define I2C_MOUSE_Y_START offsetof(I2C_slave_buffer_t, mouse_y)
118# define I2C_MOUSE_DPI_START offsetof(I2C_slave_buffer_t, device_cpi)
119# define I2C_OLED_ON_START offsetof(I2C_slave_buffer_t, oled_on)
120# define I2C_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_layer_state)
121# define I2C_DEFAULT_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_default_layer_state)
122# define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix)
123# define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state)
124# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix)
125# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state)
126
127# define TIMEOUT 100
128
129# ifndef SLAVE_I2C_ADDRESS
130# define SLAVE_I2C_ADDRESS 0x32
131# endif
132
133// Get rows from other half over i2c
134bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
135 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT);
136# ifdef SPLIT_TRANSPORT_MIRROR
137 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT);
138# endif
139 // write backlight info
140# ifdef BACKLIGHT_ENABLE
141 uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0;
142 if (level != i2c_buffer->backlight_level) {
143 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIGHT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) {
144 i2c_buffer->backlight_level = level;
145 }
146 }
147# endif
148
149# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
150 if (rgblight_get_change_flags()) {
151 rgblight_syncinfo_t rgblight_sync;
152 rgblight_get_syncinfo(&rgblight_sync);
153 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgblight_sync, sizeof(rgblight_sync), TIMEOUT) >= 0) {
154 rgblight_clear_change_flags();
155 }
156 }
157# endif
158
159# ifdef ENCODER_ENABLE
160 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_ENCODER_START, (void *)i2c_buffer->encoder_state, sizeof(i2c_buffer->encoder_state), TIMEOUT);
161 encoder_update_raw(i2c_buffer->encoder_state);
162# endif
163
164# ifdef WPM_ENABLE
165 uint8_t current_wpm = get_current_wpm();
166 if (current_wpm != i2c_buffer->current_wpm) {
167 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WPM_START, (void *)&current_wpm, sizeof(current_wpm), TIMEOUT) >= 0) {
168 i2c_buffer->current_wpm = current_wpm;
169 }
170 }
171# endif
172
173# ifdef POINTING_DEVICE_ENABLE
174 if (is_keyboard_left()) {
175 report_mouse_t temp_report = pointing_device_get_report();
176 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT);
177 temp_report.x = i2c_buffer->mouse_x;
178 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT);
179 temp_report.y = i2c_buffer->mouse_y;
180 pointing_device_set_report(temp_report);
181
182 if (device_cpi != i2c_buffer->device_cpi) {
183 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_DPI_START, (void *)&device_cpi, sizeof(device_cpi), TIMEOUT) >= 0) {
184 i2c_buffer->device_cpi = device_cpi
185 }
186 }
187 }
188# endif
189
190# ifdef SPLIT_MODS_ENABLE
191 uint8_t real_mods = get_mods();
192 if (real_mods != i2c_buffer->real_mods) {
193 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_REAL_MODS_START, (void *)&real_mods, sizeof(real_mods), TIMEOUT) >= 0) {
194 i2c_buffer->real_mods = real_mods;
195 }
196 }
197
198 uint8_t weak_mods = get_weak_mods();
199 if (weak_mods != i2c_buffer->weak_mods) {
200 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WEAK_MODS_START, (void *)&weak_mods, sizeof(weak_mods), TIMEOUT) >= 0) {
201 i2c_buffer->weak_mods = weak_mods;
202 }
203 }
204
205# ifndef NO_ACTION_ONESHOT
206 uint8_t oneshot_mods = get_oneshot_mods();
207 if (oneshot_mods != i2c_buffer->oneshot_mods) {
208 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_ONESHOT_MODS_START, (void *)&oneshot_mods, sizeof(oneshot_mods), TIMEOUT) >= 0) {
209 i2c_buffer->oneshot_mods = oneshot_mods;
210 }
211 }
212# endif
213# endif
214
215 if (layer_state != i2c_buffer->t_layer_state) {
216 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&layer_state, sizeof(layer_state), TIMEOUT) >= 0) {
217 i2c_buffer->t_layer_state = layer_state;
218 }
219 }
220
221 if (default_layer_state != i2c_buffer->t_default_layer_state) {
222 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_DEFAULT_LAYER_STATE_START, (void *)&default_layer_state, sizeof(default_layer_state), TIMEOUT) >= 0) {
223 i2c_buffer->t_default_layer_state = default_layer_state;
224 }
225 }
226
227# ifdef OLED_DRIVER_ENABLE
228 bool is_oled_on = is_oled_on();
229 if (is_oled_on != i2c_buffer->oled_on) {
230 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&is_oled_on, sizeof(is_oled_on), TIMEOUT) >= 0) {
231 i2c_buffer->oled_on = is_oled_on;
232 }
233 }
234# endif
235
236# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
237 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT);
238 bool suspend_state = led_matrix_get_suspend_state();
239 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT);
240# endif
241# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
242 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT);
243 bool suspend_state = rgb_matrix_get_suspend_state();
244 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT);
245# endif
246
247# ifndef DISABLE_SYNC_TIMER
248 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
249 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT);
250# endif
251
252 return true;
253}
254
255void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
256# ifndef DISABLE_SYNC_TIMER
257 sync_timer_update(i2c_buffer->sync_timer);
258# endif
259 // Copy matrix to I2C buffer
260 memcpy((void *)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix));
261# ifdef SPLIT_TRANSPORT_MIRROR
262 memcpy((void *)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix));
263# endif
264
265// Read Backlight Info
266# ifdef BACKLIGHT_ENABLE
267 backlight_set(i2c_buffer->backlight_level);
268# endif
269
270# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
271 // Update the RGB with the new data
272 if (i2c_buffer->rgblight_sync.status.change_flags != 0) {
273 rgblight_update_sync(&i2c_buffer->rgblight_sync, false);
274 i2c_buffer->rgblight_sync.status.change_flags = 0;
275 }
276# endif
277
278# ifdef ENCODER_ENABLE
279 encoder_state_raw(i2c_buffer->encoder_state);
280# endif
281
282# ifdef WPM_ENABLE
283 set_current_wpm(i2c_buffer->current_wpm);
284# endif
285
286# ifdef POINTING_DEVICE_ENABLE
287 if (!is_keyboard_left()) {
288 static uint16_t cpi;
289 if (cpi != i2c_buffer->device_cpi) {
290 cpi = i2c_buffer->device_cpi;
291 pmw_set_cpi(cpi);
292 }
293 i2c_buffer->mouse_x = split_mouse_x;
294 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT);
295 i2c_buffer->mouse_y = split_mouse_y;
296 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT);
297 }
298
299# endif
300
301# ifdef SPLIT_MODS_ENABLE
302 set_mods(i2c_buffer->real_mods);
303 set_weak_mods(i2c_buffer->weak_mods);
304# ifndef NO_ACTION_ONESHOT
305 set_oneshot_mods(i2c_buffer->oneshot_mods);
306# endif
307# endif
308
309 if (layer_state != i2c_buffer->t_layer_state) {
310 layer_state = i2c_buffer->t_layer_state;
311 }
312 if (default_layer_state != i2c_buffer->t_default_layer_state) {
313 default_layer_state = i2c_buffer->t_default_layer_state;
314 }
315
316# ifdef OLED_DRIVER_ENABLE
317 if (i2c_buffer->oled_on) {
318 oled_on();
319 } else {
320 oled_off();
321 }
322# endif
323
324# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
325 memcpy((void *)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix));
326 led_matrix_set_suspend_state(i2c_buffer->led_suspend_state);
327# endif
328# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
329 memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix));
330 rgb_matrix_set_suspend_state(i2c_buffer->rgb_suspend_state);
331# endif
332}
333
334void transport_master_init(void) { i2c_init(); }
335
336void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); }
337
338#else // USE_SERIAL
339
340# include "serial.h"
341
342typedef struct _Serial_s2m_buffer_t {
343 // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack
344 matrix_row_t smatrix[ROWS_PER_HAND];
345# ifdef ENCODER_ENABLE
346 uint8_t encoder_state[NUMBER_OF_ENCODERS];
347# endif
348 int8_t mouse_x;
349 int8_t mouse_y;
350} __attribute__((packed)) Serial_s2m_buffer_t;
351
352typedef struct _Serial_m2s_buffer_t {
353# ifdef SPLIT_MODS_ENABLE
354 uint8_t real_mods;
355 uint8_t weak_mods;
356# ifndef NO_ACTION_ONESHOT
357 uint8_t oneshot_mods;
358# endif
359# endif
360# ifndef DISABLE_SYNC_TIMER
361 uint32_t sync_timer;
362# endif
363# ifdef SPLIT_TRANSPORT_MIRROR
364 matrix_row_t mmatrix[ROWS_PER_HAND];
365# endif
366# ifdef BACKLIGHT_ENABLE
367 uint8_t backlight_level;
368# endif
369# ifdef WPM_ENABLE
370 uint8_t current_wpm;
371# endif
372 uint16_t device_cpi;
373 bool oled_on;
374 layer_state_t t_layer_state;
375 layer_state_t t_default_layer_state;
376# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
377 led_eeconfig_t led_matrix;
378 bool led_suspend_state;
379# endif
380# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
381 rgb_config_t rgb_matrix;
382 bool rgb_suspend_state;
383# endif
384} __attribute__((packed)) Serial_m2s_buffer_t;
385
386# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
387// When MCUs on both sides drive their respective RGB LED chains,
388// it is necessary to synchronize, so it is necessary to communicate RGB
389// information. In that case, define RGBLIGHT_SPLIT with info on the number
390// of LEDs on each half.
391//
392// Otherwise, if the master side MCU drives both sides RGB LED chains,
393// there is no need to communicate.
394
395typedef struct _Serial_rgblight_t {
396 rgblight_syncinfo_t rgblight_sync;
397} Serial_rgblight_t;
398
399volatile Serial_rgblight_t serial_rgblight = {};
400uint8_t volatile status_rgblight = 0;
401# endif
402
403volatile Serial_s2m_buffer_t serial_s2m_buffer = {};
404volatile Serial_m2s_buffer_t serial_m2s_buffer = {};
405uint8_t volatile status0 = 0;
406
407enum serial_transaction_id {
408 GET_SLAVE_MATRIX = 0,
409# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
410 PUT_RGBLIGHT,
411# endif
412};
413
414SSTD_t transactions[] = {
415 [GET_SLAVE_MATRIX] =
416 {
417 (uint8_t *)&status0,
418 sizeof(serial_m2s_buffer),
419 (uint8_t *)&serial_m2s_buffer,
420 sizeof(serial_s2m_buffer),
421 (uint8_t *)&serial_s2m_buffer,
422 },
423# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
424 [PUT_RGBLIGHT] =
425 {
426 (uint8_t *)&status_rgblight, sizeof(serial_rgblight), (uint8_t *)&serial_rgblight, 0, NULL // no slave to master transfer
427 },
428# endif
429};
430
431void transport_master_init(void) { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); }
432
433void transport_slave_init(void) { soft_serial_target_init(transactions, TID_LIMIT(transactions)); }
434
435# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
436
437// rgblight synchronization information communication.
438
439void transport_rgblight_master(void) {
440 if (rgblight_get_change_flags()) {
441 rgblight_get_syncinfo((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync);
442 if (soft_serial_transaction(PUT_RGBLIGHT) == TRANSACTION_END) {
443 rgblight_clear_change_flags();
444 }
445 }
446}
447
448void transport_rgblight_slave(void) {
449 if (status_rgblight == TRANSACTION_ACCEPTED) {
450 rgblight_update_sync((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync, false);
451 status_rgblight = TRANSACTION_END;
452 }
453}
454
455# else
456# define transport_rgblight_master()
457# define transport_rgblight_slave()
458# endif
459
460bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
461# ifndef SERIAL_USE_MULTI_TRANSACTION
462 if (soft_serial_transaction() != TRANSACTION_END) {
463 return false;
464 }
465# else
466 transport_rgblight_master();
467 if (soft_serial_transaction(GET_SLAVE_MATRIX) != TRANSACTION_END) {
468 return false;
469 }
470# endif
471
472 // TODO: if MATRIX_COLS > 8 change to unpack()
473 for (int i = 0; i < ROWS_PER_HAND; ++i) {
474 slave_matrix[i] = serial_s2m_buffer.smatrix[i];
475# ifdef SPLIT_TRANSPORT_MIRROR
476 serial_m2s_buffer.mmatrix[i] = master_matrix[i];
477# endif
478 }
479
480# ifdef BACKLIGHT_ENABLE
481 // Write backlight level for slave to read
482 serial_m2s_buffer.backlight_level = is_backlight_enabled() ? get_backlight_level() : 0;
483# endif
484
485# ifdef ENCODER_ENABLE
486 encoder_update_raw((uint8_t *)serial_s2m_buffer.encoder_state);
487# endif
488
489# ifdef WPM_ENABLE
490 // Write wpm to slave
491 serial_m2s_buffer.current_wpm = get_current_wpm();
492# endif
493
494# ifdef SPLIT_MODS_ENABLE
495 serial_m2s_buffer.real_mods = get_mods();
496 serial_m2s_buffer.weak_mods = get_weak_mods();
497# ifndef NO_ACTION_ONESHOT
498 serial_m2s_buffer.oneshot_mods = get_oneshot_mods();
499# endif
500# endif
501
502# ifdef POINTING_DEVICE_ENABLE
503 if (is_keyboard_left()) {
504 report_mouse_t temp_report = pointing_device_get_report();
505 temp_report.x = serial_s2m_buffer.mouse_x;
506 temp_report.y = serial_s2m_buffer.mouse_y;
507 pointing_device_set_report(temp_report);
508 serial_m2s_buffer.device_cpi = device_cpi;
509 }
510# endif
511
512 serial_m2s_buffer.t_layer_state = layer_state;
513 serial_m2s_buffer.t_default_layer_state = default_layer_state;
514# ifdef OLED_DRIVER_ENABLE
515 serial_m2s_buffer.oled_on = is_oled_on();
516# endif
517
518# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
519 serial_m2s_buffer.led_matrix = led_matrix_eeconfig;
520 serial_m2s_buffer.led_suspend_state = led_matrix_get_suspend_state();
521# endif
522# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
523 serial_m2s_buffer.rgb_matrix = rgb_matrix_config;
524 serial_m2s_buffer.rgb_suspend_state = rgb_matrix_get_suspend_state();
525# endif
526# ifndef DISABLE_SYNC_TIMER
527 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
528# endif
529 return true;
530}
531
532void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
533 transport_rgblight_slave();
534# ifndef DISABLE_SYNC_TIMER
535 sync_timer_update(serial_m2s_buffer.sync_timer);
536# endif
537
538 // TODO: if MATRIX_COLS > 8 change to pack()
539 for (int i = 0; i < ROWS_PER_HAND; ++i) {
540 serial_s2m_buffer.smatrix[i] = slave_matrix[i];
541# ifdef SPLIT_TRANSPORT_MIRROR
542 master_matrix[i] = serial_m2s_buffer.mmatrix[i];
543# endif
544 }
545
546# ifdef BACKLIGHT_ENABLE
547 backlight_set(serial_m2s_buffer.backlight_level);
548# endif
549
550# ifdef ENCODER_ENABLE
551 encoder_state_raw((uint8_t *)serial_s2m_buffer.encoder_state);
552# endif
553
554# ifdef WPM_ENABLE
555 set_current_wpm(serial_m2s_buffer.current_wpm);
556# endif
557
558# ifdef SPLIT_MODS_ENABLE
559 set_mods(serial_m2s_buffer.real_mods);
560 set_weak_mods(serial_m2s_buffer.weak_mods);
561# ifndef NO_ACTION_ONESHOT
562 set_oneshot_mods(serial_m2s_buffer.oneshot_mods);
563# endif
564# endif
565
566# ifdef POINTING_DEVICE_ENABLE
567 if (!is_keyboard_left()) {
568 static uint16_t cpi;
569 if (cpi != serial_m2s_buffer.device_cpi) {
570 cpi = serial_m2s_buffer.device_cpi;
571 pmw_set_cpi(cpi);
572 }
573 serial_s2m_buffer.mouse_x = split_mouse_x;
574 serial_s2m_buffer.mouse_y = split_mouse_y;
575 }
576# endif
577
578 if (layer_state != serial_m2s_buffer.t_layer_state) {
579 layer_state = serial_m2s_buffer.t_layer_state;
580 }
581 if (default_layer_state != serial_m2s_buffer.t_default_layer_state) {
582 default_layer_state = serial_m2s_buffer.t_default_layer_state;
583 }
584# ifdef OLED_DRIVER_ENABLE
585 if (serial_m2s_buffer.oled_on) {
586 oled_on();
587 } else {
588 oled_off();
589 }
590# endif
591
592# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
593 led_matrix_eeconfig = serial_m2s_buffer.led_matrix;
594 led_matrix_set_suspend_state(serial_m2s_buffer.led_suspend_state);
595# endif
596# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
597 rgb_matrix_config = serial_m2s_buffer.rgb_matrix;
598 rgb_matrix_set_suspend_state(serial_m2s_buffer.rgb_suspend_state);
599# endif
600}
601
602#endif
603
604#ifdef POINTING_DEVICE_ENABLE
605void master_mouse_send(int8_t x, int8_t y) {
606 split_mouse_x = x;
607 split_mouse_y = y;
608}
609void trackball_set_cpi(uint16_t cpi) {
610 if (!is_keyboard_left()) {
611 pmw_set_cpi(cpi);
612 } else {
613 device_cpi = cpi;
614 }
615}
616#endif
diff --git a/keyboards/handwired/dactyl_manuform/dactyl_manuform.h b/keyboards/handwired/dactyl_manuform/dactyl_manuform.h
index 1b6b105ec..f0a7ee2f3 100644
--- a/keyboards/handwired/dactyl_manuform/dactyl_manuform.h
+++ b/keyboards/handwired/dactyl_manuform/dactyl_manuform.h
@@ -16,8 +16,6 @@
16 #include "6x6.h" 16 #include "6x6.h"
17#elif KEYBOARD_handwired_dactyl_manuform_dmote_62key 17#elif KEYBOARD_handwired_dactyl_manuform_dmote_62key
18 #include "62key.h" 18 #include "62key.h"
19#elif KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball
20# include "5x6_right_trackball.h"
21#endif 19#endif
22 20
23#include "quantum.h" 21#include "quantum.h"
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c
new file mode 100644
index 000000000..7ea4d9747
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.c
@@ -0,0 +1,67 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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 "4x6_right.h"
18
19#ifdef RGB_MATRIX_ENABLE
20led_config_t g_led_config = { {
21 { 24, 23, 18, 17, 10, 9 },
22 { 25, 22, 19, 16, 11, 8 },
23 { 26, 21, 20, 15, 12, 7 },
24 { NO_LED, NO_LED, NO_LED, 14, 13, 6 },
25 { NO_LED, NO_LED, NO_LED, 14, 13, 6 },
26 { 51, 50, 45, 44, 37, 36 },
27 { 52, 49, 46, 43, 38, 35 },
28 { 53, 48, 47, 42, 39, 34 },
29 { NO_LED, NO_LED, NO_LED, 41, 40, 33 },
30 { NO_LED, NO_LED, NO_LED, 41, 40, 33 }
31}, {
32 { 85, 16 }, { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 },
33 { 85, 39 }, { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 },
34 { 60, 55 }, { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 },
35 { 16, 42 }, { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 }, { 139, 16 },
36 { 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, { 139, 39 },
37 { 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, { 164, 55 },
38 { 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, { 208, 42 },
39 { 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 }
40}, {
41 2, 2, 2, 2, 2, 2, 1,
42 4, 4, 4, 4, 4, 4, 1,
43 1, 4, 4, 4, 4, 4, 4,
44 4, 4, 4, 1, 1, 1, 2,
45 2, 2, 2, 2, 2, 1, 4,
46 4, 4, 4, 4, 4, 1, 1,
47 4, 4, 4, 4, 4, 4, 4,
48 4, 4, 1, 1, 1
49} };
50#endif
51
52#ifdef SWAP_HANDS_ENABLE
53const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
54 /* Left hand, matrix positions */
55 {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}},
56 {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}},
57 {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}},
58 {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}},
59 {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}},
60 /* Right hand, matrix positions */
61 {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
62 {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
63 {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
64 {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}},
65 {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}
66};
67#endif
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h
new file mode 100644
index 000000000..66b588078
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/4x6_right.h
@@ -0,0 +1,47 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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#pragma once
18
19#include "tractyl_manuform.h"
20#include "quantum.h"
21
22#define ___ KC_NO
23
24// clang-format off
25#define LAYOUT_4x6_right(\
26 L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
27 L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
28 L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
29 L32, L33, R32, R33, \
30 L34, L35, R31, \
31 L44, L45, R41, \
32 L42, L43, R42, R43 \
33 ) \
34 { \
35 { L00, L01, L02, L03, L04, L05 }, \
36 { L10, L11, L12, L13, L14, L15 }, \
37 { L20, L21, L22, L23, L24, L25 }, \
38 { ___, ___, L32, L33, L34, L35 }, \
39 { ___, ___, L42, L43, L44, L45 }, \
40 \
41 { R00, R01, R02, R03, R04, R05 }, \
42 { R10, R11, R12, R13, R14, R15 }, \
43 { R20, R21, R22, R23, R24, R25 }, \
44 { ___, R31, R32, R33, ___, ___ }, \
45 { ___, R41, R42, R43, ___, ___ } \
46}
47// clang-format on
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/config.h
new file mode 100644
index 000000000..05a1c5f3b
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/config.h
@@ -0,0 +1,91 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "config_common.h"
22
23#define PRODUCT_ID 0x3537
24#define DEVICE_VER 0x0001
25#define PRODUCT Tractyl Manuform(4x6)
26
27/* key matrix size */
28// Rows are doubled-up
29#define MATRIX_ROWS 10
30#define MATRIX_COLS 6
31
32// wiring of each half
33#define MATRIX_COL_PINS { C0, C1, C2, C3, C4, C5 }
34#define MATRIX_ROW_PINS { A0, A1, A2, A3, A4 }
35
36#define DIODE_DIRECTION COL2ROW
37
38// WS2812 RGB LED strip input and number of LEDs
39#define RGB_DI_PIN E7
40#define DRIVER_LED_TOTAL 62
41#define RGB_MATRIX_SPLIT { 32, 30 }
42#define RGB_DISABLE_WHEN_USB_SUSPENDED true
43#define RGB_MATRIX_KEYPRESSES
44// #define RGB_MATRIX_KEYRELEASES
45#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
46#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 80
47
48#define SPLIT_TRANSPORT_MIRROR
49#define SPLIT_HAND_PIN A6
50
51
52/* define if matrix has ghost */
53//#define MATRIX_HAS_GHOST
54
55/* number of backlight levels */
56// #define BACKLIGHT_LEVELS 3
57
58// #define DEBUG_LED_PIN D6
59
60#define ROTATIONAL_TRANSFORM_ANGLE -25
61
62/* Bootmagic Lite key configuration */
63#define BOOTMAGIC_LITE_ROW 0
64#define BOOTMAGIC_LITE_COLUMN 0
65#define BOOTMAGIC_LITE_ROW_RIGHT 4
66#define BOOTMAGIC_LITE_COLUMN_RIGHT 5
67
68#define AUDIO_PIN C6
69#define AUDIO_PIN_ALT B7
70
71#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
72#define DYNAMIC_KEYMAP_LAYER_COUNT 16
73#define LAYER_STATE_16BIT
74
75/* serial.c configuration for split keyboard */
76#define SOFT_SERIAL_PIN D3
77#define EE_HANDS
78
79
80/* Set 0 if debouncing isn't needed */
81#define DEBOUNCE 5
82
83/* disable action features */
84//#define NO_ACTION_LAYER
85//#define NO_ACTION_TAPPING
86//#define NO_ACTION_ONESHOT
87#define NO_ACTION_MACRO
88#define NO_ACTION_FUNCTION
89
90#define SERIAL_USE_MULTI_TRANSACTION
91#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/info.json b/keyboards/handwired/tractyl_manuform/4x6_right/info.json
index 8a413ec44..03a570730 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/info.json
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/info.json
@@ -1,11 +1,11 @@
1{ 1{
2 "keyboard_name": "Dactyl Manuform 5x6", 2 "keyboard_name": "Tractyl Manuform 4x6",
3 "url": "", 3 "url": "",
4 "maintainer": "qmk", 4 "maintainer": "drashna",
5 "width": 17, 5 "width": 17,
6 "height": 8, 6 "height": 8,
7 "layouts": { 7 "layouts": {
8 "LAYOUT_5x6_right_trackball": { 8 "LAYOUT_5x6_right": {
9 "layout": [ 9 "layout": [
10 {"label":"L00", "x":0, "y":0}, 10 {"label":"L00", "x":0, "y":0},
11 {"label":"L01", "x":1, "y":0}, 11 {"label":"L01", "x":1, "y":0},
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c
new file mode 100644
index 000000000..d79f60b12
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/default/keymap.c
@@ -0,0 +1,62 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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
18
19enum custom_layers {
20 _QWERTY,
21 _LOWER,
22 _RAISE,
23};
24
25#define RAISE MO(_RAISE)
26#define LOWER MO(_LOWER)
27
28#define RAISE MO(_RAISE)
29#define LOWER MO(_LOWER)
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32
33[_QWERTY] = LAYOUT_4x6_right(
34 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS,
35 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,
36 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_BSLASH,
37 KC_LBRC,KC_RBRC, KC_PLUS, KC_EQL,
38 RAISE, KC_SPC, LOWER,
39 KC_TAB, KC_HOME, KC_ENT,
40 KC_BSPC,KC_GRV, KC_LGUI,KC_DEL
41),
42
43[_LOWER] = LAYOUT_4x6_right(
44 _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, RESET, KC_PLUS,
45 _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4, KC_P5, KC_P6, KC_MINS,KC_PIPE,
46 _______,_______,_______,_______,_______,_______, _______, KC_P1, KC_P2, KC_P3, KC_EQL, KC_UNDS,
47 _______,KC_PSCR, _______, KC_P0,
48 _______,_______, _______,
49 _______,_______, _______,
50 _______,_______, _______,_______
51),
52
53[_RAISE] = LAYOUT_4x6_right(
54 _______,RESET, _______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NLCK,KC_INS, KC_SLCK,KC_MUTE,
55 _______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU,
56 _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD,
57 _______,_______, KC_EQL ,_______,
58 _______,_______, _______,
59 _______,_______, _______,
60 _______,_______, _______,_______
61),
62};
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h
index dedd1f5fe..21bc8e616 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/config.h
@@ -17,13 +17,12 @@
17#pragma once 17#pragma once
18 18
19// #define USE_I2C 19// #define USE_I2C
20#define SELECT_SOFT_SERIAL_SPEED 0 20// #define SELECT_SOFT_SERIAL_SPEED 1
21// #define SERIAL_USE_MULTI_TRANSACTION 21// #define SERIAL_USE_MULTI_TRANSACTION
22#define SPLIT_MODS_ENABLE 22#define SPLIT_MODS_ENABLE
23#define EE_HANDS 23#define EE_HANDS
24 24
25#define TRACKBALL_DPI_OPTIONS \ 25#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 }
26 { 1200, 1800, 2600, 3400 }
27 26
28#define RGBLIGHT_MAX_BRIGHTNESS 60 27#define RGBLIGHT_MAX_BRIGHTNESS 60
29 28
@@ -35,5 +34,3 @@
35 34
36#define OLED_DISPLAY_128X64 35#define OLED_DISPLAY_128X64
37#define OLED_BRIGHTNESS 50 36#define OLED_BRIGHTNESS 50
38
39#define MK_KINETIC_SPEED
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c
new file mode 100644
index 000000000..7e3c356bd
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c
@@ -0,0 +1,243 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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 "drashna.h"
18
19// clang-format off
20#define LAYOUT_4x6_right_wrapper(...) LAYOUT_4x6_right(__VA_ARGS__)
21#define LAYOUT_4x6_right_base( \
22 K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
23 K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
24 K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
25 ) \
26 LAYOUT_4x6_right_wrapper( \
27 SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \
28 LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
29 OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
30 OS_LGUI, OS_LALT, OS_RGUI, OS_RALT, \
31 KC_PSCR, KC_GRV, MEH_T(KC_BTN3), \
32 KC_SPC, OS_LGUI, KC_ENT, \
33 BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \
34 )
35#define LAYOUT_4x6_right_base_wrapper(...) LAYOUT_4x6_right_base(__VA_ARGS__)
36
37
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 [_QWERTY] = LAYOUT_4x6_right_base_wrapper(
40 _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
41 _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
42 _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
43 ),
44
45 [_COLEMAK] = LAYOUT_4x6_right_base_wrapper(
46 _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
47 _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
48 _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
49 ),
50
51 [_DVORAK] = LAYOUT_4x6_right_base_wrapper(
52 _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
53 _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
54 _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
55 ),
56
57 [_WORKMAN] = LAYOUT_4x6_right_base_wrapper(
58 _________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
59 _________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
60 _________________WORKMAN_L3________________, _________________WORKMAN_R3________________
61 ),
62
63 [_NORMAN] = LAYOUT_4x6_right_base_wrapper(
64 _________________NORMAN_L1_________________, _________________NORMAN_L1_________________,
65 _________________NORMAN_L2_________________, _________________NORMAN_R2_________________,
66 _________________NORMAN_L3_________________, _________________NORMAN_R3_________________
67 ),
68
69 [_MALTRON] = LAYOUT_4x6_right_base_wrapper(
70 _________________MALTRON_L1________________, _________________MALTRON_R1________________,
71 _________________MALTRON_L2________________, _________________MALTRON_R2________________,
72 _________________MALTRON_L3________________, _________________MALTRON_R3________________
73 ),
74
75 [_EUCALYN] = LAYOUT_4x6_right_base_wrapper(
76 _________________EUCALYN_L1________________, _________________EUCALYN_R1________________,
77 _________________EUCALYN_L2________________, _________________EUCALYN_R2________________,
78 _________________EUCALYN_L3________________, _________________EUCALYN_R3________________
79 ),
80
81 [_CARPLAX] = LAYOUT_4x6_right_base_wrapper(
82 _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________,
83 _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________,
84 _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________
85 ),
86
87 [_MOUSE] = LAYOUT_4x6_right(
88 _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, DPI_CONFIG, _______,
89 _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______,
90 _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______,
91 _______, _______, _______, _______,
92 _______, _______, _______,
93 _______, _______, _______,
94 _______, _______, _______, _______
95 ),
96 [_GAMEPAD] = LAYOUT_4x6_right(
97 KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______,
98 KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______,
99 KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, _______, _______, _______, _______, _______, _______,
100 KC_I, KC_T, TG_GAME, KC_NO,
101 KC_V, KC_O, _______,
102 KC_SPC, KC_P, _______,
103 KC_H, KC_LGUI, _______, _______
104 ),
105 [_DIABLO] = LAYOUT_4x6_right(
106 KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______,
107 KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______,
108 KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, _______, _______, _______, _______, _______, _______,
109 KC_F, KC_L, KC_NO, TG_DBLO,
110 KC_DIABLO_CLEAR, KC_F, _______,
111 SFT_T(KC_SPC), KC_J, _______,
112 ALT_T(KC_Q), KC_LGUI, _______, _______
113 ),
114 [_LOWER] = LAYOUT_4x6_right_wrapper(
115 KC_F12, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
116 _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
117 _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
118 _______, _______, _______, _______,
119 _______, _______, _______,
120 _______, _______, _______,
121 _______, _______, _______, _______
122 ),
123 [_RAISE] = LAYOUT_4x6_right_wrapper(
124 KC_F12, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_F11,
125 _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
126 _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
127 _______, _______, _______, _______,
128 _______, _______, _______,
129 _______, _______, _______,
130 _______, _______, _______, _______
131 ),
132 [_ADJUST] = LAYOUT_4x6_right_wrapper(
133 KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RST,
134 VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST,
135 UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
136 HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO,
137 HPT_TOG, HPT_BUZ, KC_NUKE,
138 _______, _______, _______,
139 _______, _______, KC_NUKE, _______
140 ),
141};
142// clang-format on
143
144#ifdef POINTING_DEVICE_ENABLE
145static uint16_t mouse_timer = 0;
146static uint16_t mouse_debounce_timer = 0;
147static uint8_t mouse_keycode_tracker = 0;
148bool tap_toggling = false;
149
150void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
151 if ((x || y) && timer_elapsed(mouse_timer) > 125) {
152 mouse_timer = timer_read();
153 if (!layer_state_is(_MOUSE) && !(layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO)) && timer_elapsed(mouse_debounce_timer) > 125) {
154 layer_on(_MOUSE);
155 }
156 }
157
158# ifdef TAPPING_TERM_PER_KEY
159 if (timer_elapsed(mouse_debounce_timer) > get_tapping_term(KC_BTN1, NULL)
160# else
161 if (timer_elapsed(mouse_debounce_timer) > TAPPING_TERM
162# endif
163 || (layer_state_is(_GAMEPAD) || layer_state_is(_DIABLO))) {
164 mouse_report->x = x;
165 mouse_report->y = y;
166 }
167# ifdef OLED_DRIVER_ENABLE
168 if (x || y) oled_timer = timer_read32();
169# endif
170}
171
172void matrix_scan_keymap(void) {
173 if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) {
174 layer_off(_MOUSE);
175 }
176 if (tap_toggling) {
177 if (!layer_state_is(_MOUSE)) {
178 layer_on(_MOUSE);
179 }
180 }
181}
182
183bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
184 switch (keycode) {
185 case TT(_MOUSE): {
186 if (record->event.pressed) {
187 mouse_keycode_tracker++;
188 } else {
189# if TAPPING_TOGGLE != 0
190 if (record->tap.count == TAPPING_TOGGLE) {
191 tap_toggling ^= 1;
192# if TAPPING_TOGGLE == 1
193 if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
194# else
195 if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
196# endif
197 } else {
198 mouse_keycode_tracker--;
199 }
200# endif
201 }
202 mouse_timer = timer_read();
203 break;
204 }
205 case MO(_MOUSE):
206 case DPI_CONFIG:
207 case KC_MS_UP ... KC_MS_WH_RIGHT:
208 record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
209 mouse_timer = timer_read();
210 break;
211 default:
212 if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) {
213 layer_off(_MOUSE);
214 }
215 mouse_keycode_tracker = 0;
216 mouse_debounce_timer = timer_read();
217 break;
218 }
219 return true;
220}
221
222layer_state_t layer_state_set_keymap(layer_state_t state) {
223 if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) {
224 state |= (1UL << _MOUSE);
225 }
226 return state;
227}
228#endif
229
230void matrix_init_keymap(void) {
231#ifdef AUDIO_ENABLE
232 extern audio_config_t audio_config;
233
234 if (!is_keyboard_master()) {
235 audio_stop_all();
236 audio_config.enable = false;
237 }
238#endif
239}
240
241void keyboard_post_init_keymap(void) {
242 matrix_init_keymap();
243}
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk
index 754f0e45d..d658d45bf 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/rules.mk
@@ -1,6 +1,7 @@
1RGBLIGHT_STARTUP_ANIMATION = yes 1RGBLIGHT_STARTUP_ANIMATION = yes
2COMMAND_ENABLE = no
3AUDIO_ENABLE = yes 2AUDIO_ENABLE = yes
3HAPTIC_ENABLE = no
4COMMAND_ENABLE = no
4TAP_DANCE_ENABLE = yes 5TAP_DANCE_ENABLE = yes
5UNICODE_ENABLE = yes 6UNICODE_ENABLE = yes
6OLED_DRIVER_ENABLE = yes 7OLED_DRIVER_ENABLE = yes
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/readme.md b/keyboards/handwired/tractyl_manuform/4x6_right/readme.md
index b6e38dc84..b6e38dc84 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/readme.md
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/readme.md
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk
new file mode 100644
index 000000000..6be8a89f6
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/rules.mk
@@ -0,0 +1,33 @@
1# MCU name
2MCU = at90usb1286
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = yes # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23RGB_MATRIX_ENABLE = no
24RGB_MATRIX_DRIVER = WS2812
25
26
27POINTING_DEVICE_ENABLE = yes
28MOUSE_SHARED_EP = no
29
30SPLIT_KEYBOARD = yes
31
32SRC += drivers/sensors/pmw3360.c
33QUANTUM_LIB_SRC += spi_master.c tm_sync.c
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c
new file mode 100644
index 000000000..1766312e1
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.c
@@ -0,0 +1,35 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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 "5x6_right.h"
18
19#ifdef SWAP_HANDS_ENABLE
20const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
21 /* Left hand, matrix positions */
22 {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}},
23 {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}},
24 {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}},
25 {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}},
26 {{5, 10}, {4, 10}, {3, 10}, {2, 10}, {1, 10}, {0, 10}},
27 {{5, 11}, {4, 11}, {3, 11}, {2, 11}, {1, 11}, {0, 11}},
28 /* Right hand, matrix positions */
29 {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
30 {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
31 {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
32 {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}},
33 {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}},
34 {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}};
35#endif
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
index ed408563f..90dc46d7e 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
@@ -16,16 +16,13 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "dactyl_manuform.h" 19#include "tractyl_manuform.h"
20#include "quantum.h" 20#include "quantum.h"
21#include "spi_master.h"
22#include "drivers/sensors/pmw3360.h"
23#include "pointing_device.h"
24
25 21
26#define ___ KC_NO 22#define ___ KC_NO
27 23
28#define LAYOUT_5x6_right_trackball(\ 24// clang-format off
25#define LAYOUT_5x6_right(\
29 L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ 26 L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
30 L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ 27 L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
31 L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ 28 L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
@@ -50,24 +47,4 @@
50 { ___, R41, R42, R43, ___, ___ }, \ 47 { ___, R41, R42, R43, ___, ___ }, \
51 { ___, R51, R52, R53, ___, ___ } \ 48 { ___, R51, R52, R53, ___, ___ } \
52} 49}
53 50// clang-format on
54
55void process_wheel(report_mouse_t* mouse_report);
56void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v);
57
58typedef union {
59 uint32_t raw;
60 struct {
61 uint8_t dpi_config;
62 };
63} keyboard_config_t;
64
65extern keyboard_config_t keyboard_config;
66
67enum ploopy_keycodes {
68 DPI_CONFIG = SAFE_RANGE,
69 KEYMAP_SAFE_RANGE,
70};
71
72void master_mouse_send(int8_t x, int8_t y);
73void trackball_set_cpi(uint16_t cpi);
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
index bc6d66bb9..9dc46f2e6 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
@@ -20,9 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21#include "config_common.h" 21#include "config_common.h"
22 22
23#define PRODUCT_ID 0x3536 23#define PRODUCT_ID 0x3536
24#define DEVICE_VER 0x0001 24#define DEVICE_VER 0x0001
25#define PRODUCT Tractyl-Manuform (5x6 with right side Trackball) 25#define PRODUCT Tractyl Manuform(5x6)
26 26
27/* key matrix size */ 27/* key matrix size */
28// Rows are doubled-up 28// Rows are doubled-up
@@ -36,37 +36,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36#define DIODE_DIRECTION COL2ROW 36#define DIODE_DIRECTION COL2ROW
37 37
38// WS2812 RGB LED strip input and number of LEDs 38// WS2812 RGB LED strip input and number of LEDs
39#define RGB_DI_PIN E7 39#define RGB_DI_PIN E7
40#define RGBLED_NUM 58 40#define RGBLED_NUM 58
41#define RGBLIGHT_SPLIT 41#define RGBLIGHT_SPLIT
42#define RGBLED_SPLIT { 30 , 28 } 42#define RGBLED_SPLIT { 30, 28 }
43#define RGBLIGHT_SLEEP 43#define RGBLIGHT_SLEEP
44// #define RGBW 44// #define RGBW
45#define RGBLIGHT_LIMIT_VAL 100 45#define RGBLIGHT_LIMIT_VAL 50
46/* define if matrix has ghost */ 46/* define if matrix has ghost */
47//#define MATRIX_HAS_GHOST 47//#define MATRIX_HAS_GHOST
48 48
49/* number of backlight levels */ 49/* number of backlight levels */
50// #define BACKLIGHT_LEVELS 3 50// #define BACKLIGHT_LEVELS 3
51 51
52#define DEBUG_LED_PIN D6 52#define DEBUG_LED_PIN D6
53 53
54#define USB_POLLING_INTERVAL_MS 1 54#define ROTATIONAL_TRANSFORM_ANGLE -25
55
56#define ROTATIONAL_TRANSFORM_ANGLE -25
57 55
58/* Bootmagic Lite key configuration */ 56/* Bootmagic Lite key configuration */
59#define BOOTMAGIC_LITE_ROW 0 57#define BOOTMAGIC_LITE_ROW 0
60#define BOOTMAGIC_LITE_COLUMN 0 58#define BOOTMAGIC_LITE_COLUMN 0
61#define BOOTMAGIC_LITE_ROW_RIGHT 6 59#define BOOTMAGIC_LITE_ROW_RIGHT 6
62#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 60#define BOOTMAGIC_LITE_COLUMN_RIGHT 5
63 61
64#define AUDIO_PIN C6 62#define AUDIO_PIN C6
65#define AUDIO_PIN_ALT B7 63#define AUDIO_PIN_ALT B7
66 64
67#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 65#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
68#define DYNAMIC_KEYMAP_LAYER_COUNT 16 66#define DYNAMIC_KEYMAP_LAYER_COUNT 16
67#define LAYER_STATE_16BIT
69 68
70/* serial.c configuration for split keyboard */ 69/* serial.c configuration for split keyboard */
71#undef SOFT_SERIAL_PIN
72#define SOFT_SERIAL_PIN D2 70#define SOFT_SERIAL_PIN D2
71#define EE_HANDS
72
73#define ENCODERS_PAD_A { D5 }
74#define ENCODERS_PAD_B { D6 }
75#define ENCODER_RESOLUTION 1
76
77/* Set 0 if debouncing isn't needed */
78#define DEBOUNCE 5
79
80/* disable action features */
81//#define NO_ACTION_LAYER
82//#define NO_ACTION_TAPPING
83//#define NO_ACTION_ONESHOT
84#define NO_ACTION_MACRO
85#define NO_ACTION_FUNCTION
86
87#define SERIAL_USE_MULTI_TRANSACTION
88#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/info.json b/keyboards/handwired/tractyl_manuform/5x6_right/info.json
new file mode 100644
index 000000000..b6d4db4e7
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/info.json
@@ -0,0 +1,75 @@
1{
2 "keyboard_name": "Tractyl Manuform 5x6",
3 "url": "",
4 "maintainer": "drashna",
5 "width": 17,
6 "height": 8,
7 "layouts": {
8 "LAYOUT_5x6_right": {
9 "layout": [
10 {"label":"L00", "x":0, "y":0},
11 {"label":"L01", "x":1, "y":0},
12 {"label":"L02", "x":2, "y":0},
13 {"label":"L03", "x":3, "y":0},
14 {"label":"L04", "x":4, "y":0},
15 {"label":"L05", "x":5, "y":0},
16 {"label":"R00", "x":11, "y":0},
17 {"label":"R01", "x":12, "y":0},
18 {"label":"R02", "x":13, "y":0},
19 {"label":"R03", "x":14, "y":0},
20 {"label":"R04", "x":15, "y":0},
21 {"label":"R05", "x":16, "y":0},
22 {"label":"L10", "x":0, "y":1},
23 {"label":"L11", "x":1, "y":1},
24 {"label":"L12", "x":2, "y":1},
25 {"label":"L13", "x":3, "y":1},
26 {"label":"L14", "x":4, "y":1},
27 {"label":"L15", "x":5, "y":1},
28 {"label":"R10", "x":11, "y":1},
29 {"label":"R11", "x":12, "y":1},
30 {"label":"R12", "x":13, "y":1},
31 {"label":"R13", "x":14, "y":1},
32 {"label":"R14", "x":15, "y":1},
33 {"label":"R15", "x":16, "y":1},
34 {"label":"L20", "x":0, "y":2},
35 {"label":"L21", "x":1, "y":2},
36 {"label":"L22", "x":2, "y":2},
37 {"label":"L23", "x":3, "y":2},
38 {"label":"L24", "x":4, "y":2},
39 {"label":"L25", "x":5, "y":2},
40 {"label":"R20", "x":11, "y":2},
41 {"label":"R21", "x":12, "y":2},
42 {"label":"R22", "x":13, "y":2},
43 {"label":"R23", "x":14, "y":2},
44 {"label":"R24", "x":15, "y":2},
45 {"label":"R25", "x":16, "y":2},
46 {"label":"L30", "x":0, "y":3},
47 {"label":"L31", "x":1, "y":3},
48 {"label":"L32", "x":2, "y":3},
49 {"label":"L33", "x":3, "y":3},
50 {"label":"L34", "x":4, "y":3},
51 {"label":"L35", "x":5, "y":3},
52 {"label":"R30", "x":11, "y":3},
53 {"label":"R31", "x":12, "y":3},
54 {"label":"R32", "x":13, "y":3},
55 {"label":"R33", "x":14, "y":3},
56 {"label":"R34", "x":15, "y":3},
57 {"label":"R35", "x":16, "y":3},
58 {"label":"L42", "x":2, "y":4},
59 {"label":"L43", "x":3, "y":4},
60 {"label":"R42", "x":13, "y":4},
61 {"label":"R43", "x":14, "y":4},
62 {"label":"L44", "x":4, "y":5},
63 {"label":"L45", "x":5, "y":5},
64 {"label":"R41", "x":12, "y":5},
65 {"label":"L54", "x":6, "y":6},
66 {"label":"L55", "x":7, "y":6},
67 {"label":"R51", "x":10, "y":6},
68 {"label":"L52", "x":6, "y":7},
69 {"label":"L53", "x":7, "y":7},
70 {"label":"R52", "x":9, "y":7},
71 {"label":"R53", "x":10, "y":7}
72 ]
73 }
74 }
75}
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c
new file mode 100644
index 000000000..30dafdf51
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/default/keymap.c
@@ -0,0 +1,63 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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
18
19enum custom_layers {
20 _QWERTY,
21 _LOWER,
22 _RAISE,
23};
24
25
26#define RAISE MO(_RAISE)
27#define LOWER MO(_LOWER)
28
29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30 [_QWERTY] = LAYOUT_5x6_right(
31 KC_ESC , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_BSPC,
32 KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_MINS,
33 KC_LSFT, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_QUOT,
34 KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_BSLASH,
35 KC_LBRC,KC_RBRC, KC_PLUS, KC_EQL,
36 RAISE,KC_SPC, LOWER,
37 KC_TAB,KC_HOME, KC_DEL,
38 KC_BSPC, KC_GRV, KC_LGUI, KC_ENT
39 ),
40
41 [_LOWER] = LAYOUT_5x6_right(
42 KC_TILD,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_DEL,
43 _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC, KC_P7 , KC_P8 , KC_P9 ,_______,KC_PLUS,
44 _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4 , KC_P5 , KC_P6 ,KC_MINS,KC_PIPE,
45 _______,_______,_______,_______,_______,_______, _______, KC_P1 , KC_P2 , KC_P3 ,KC_EQL ,KC_UNDS,
46 _______,KC_PSCR, _______, KC_P0,
47 _______,_______, _______,
48 _______,_______, _______,
49 _______,_______, _______,_______
50
51 ),
52
53 [_RAISE] = LAYOUT_5x6_right(
54 KC_F12 , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 ,
55 _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NLCK,KC_INS ,KC_SLCK,KC_MUTE,
56 _______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU,
57 _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD,
58 _______,_______, KC_EQL ,_______,
59 _______,_______, _______,
60 _______,_______, _______,
61 _______,_______, _______,_______
62 ),
63};
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/post_config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h
index 40f1029b5..21bc8e616 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/post_config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h
@@ -16,18 +16,21 @@
16 16
17#pragma once 17#pragma once
18 18
19#ifndef MOUSEKEY_WHEEL_DELTA 19// #define USE_I2C
20# define MOUSEKEY_WHEEL_DELTA 1 20// #define SELECT_SOFT_SERIAL_SPEED 1
21#endif 21// #define SERIAL_USE_MULTI_TRANSACTION
22#ifndef MOUSEKEY_WHEEL_DELAY 22#define SPLIT_MODS_ENABLE
23# define MOUSEKEY_WHEEL_DELAY 200 23#define EE_HANDS
24#endif 24
25#ifndef MOUSEKEY_WHEEL_INTERVAL 25#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 }
26# define MOUSEKEY_WHEEL_INTERVAL 50 26
27#endif 27#define RGBLIGHT_MAX_BRIGHTNESS 60
28#ifndef MOUSEKEY_WHEEL_MAX_SPEED 28
29# define MOUSEKEY_WHEEL_MAX_SPEED 8 29#undef DEBOUNCE
30#endif 30#define DEBOUNCE 10
31#ifndef MOUSEKEY_WHEEL_TIME_TO_MAX 31
32# define MOUSEKEY_WHEEL_TIME_TO_MAX 80 32#define SOLENOID_PIN F1
33#endif 33#define SOLENOID_DEFAULT_DWELL 8
34
35#define OLED_DISPLAY_128X64
36#define OLED_BRIGHTNESS 50
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
index b3300daa9..6b6d1ab83 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
@@ -17,75 +17,75 @@
17#include "drashna.h" 17#include "drashna.h"
18 18
19// clang-format off 19// clang-format off
20#define LAYOUT_5x6_right_trackball_wrapper(...) LAYOUT_5x6_right_trackball(__VA_ARGS__) 20#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__)
21#define LAYOUT_5x6_right_trackball_base( \ 21#define LAYOUT_5x6_right_base( \
22 K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ 22 K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
23 K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ 23 K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
24 K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ 24 K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
25 ) \ 25 ) \
26 LAYOUT_5x6_right_trackball_wrapper( \ 26 LAYOUT_5x6_right_wrapper( \
27 KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, \ 27 KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, UC_IRNY, \
28 SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \ 28 SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \
29 LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ 29 LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
30 OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ 30 OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
31 OS_LALT, OS_LGUI, TG_GAME, TG_DBLO, \ 31 OS_LGUI, OS_LALT, OS_RGUI, OS_RALT, \
32 OS_LGUI, KC_GRV, OS_RGUI, \ 32 KC_PSCR, KC_GRV, MEH_T(KC_BTN3), \
33 KC_SPC, OS_LGUI, KC_ENT, \ 33 KC_SPC, OS_LGUI, KC_ENT, \
34 BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \ 34 BK_LWER, TT(_MOUSE), TT(_MOUSE), DL_RAIS \
35 ) 35 )
36#define LAYOUT_5x6_right_trackball_base_wrapper(...) LAYOUT_5x6_right_trackball_base(__VA_ARGS__) 36#define LAYOUT_5x6_right_base_wrapper(...) LAYOUT_5x6_right_base(__VA_ARGS__)
37 37
38 38
39const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 39const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
40 [_QWERTY] = LAYOUT_5x6_right_trackball_base_wrapper( 40 [_QWERTY] = LAYOUT_5x6_right_base_wrapper(
41 _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, 41 _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
42 _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, 42 _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
43 _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ 43 _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
44 ), 44 ),
45 45
46 [_COLEMAK] = LAYOUT_5x6_right_trackball_base_wrapper( 46 [_COLEMAK] = LAYOUT_5x6_right_base_wrapper(
47 _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, 47 _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
48 _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, 48 _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
49 _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ 49 _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
50 ), 50 ),
51 51
52 [_DVORAK] = LAYOUT_5x6_right_trackball_base_wrapper( 52 [_DVORAK] = LAYOUT_5x6_right_base_wrapper(
53 _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, 53 _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
54 _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, 54 _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
55 _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ 55 _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
56 ), 56 ),
57 57
58 [_WORKMAN] = LAYOUT_5x6_right_trackball_base_wrapper( 58 [_WORKMAN] = LAYOUT_5x6_right_base_wrapper(
59 _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, 59 _________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
60 _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, 60 _________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
61 _________________WORKMAN_L3________________, _________________WORKMAN_R3________________ 61 _________________WORKMAN_L3________________, _________________WORKMAN_R3________________
62 ), 62 ),
63 63
64 [_NORMAN] = LAYOUT_5x6_right_trackball_base_wrapper( 64 [_NORMAN] = LAYOUT_5x6_right_base_wrapper(
65 _________________NORMAN_L1_________________, _________________NORMAN_L1_________________, 65 _________________NORMAN_L1_________________, _________________NORMAN_L1_________________,
66 _________________NORMAN_L2_________________, _________________NORMAN_R2_________________, 66 _________________NORMAN_L2_________________, _________________NORMAN_R2_________________,
67 _________________NORMAN_L3_________________, _________________NORMAN_R3_________________ 67 _________________NORMAN_L3_________________, _________________NORMAN_R3_________________
68 ), 68 ),
69 69
70 [_MALTRON] = LAYOUT_5x6_right_trackball_base_wrapper( 70 [_MALTRON] = LAYOUT_5x6_right_base_wrapper(
71 _________________MALTRON_L1________________, _________________MALTRON_R1________________, 71 _________________MALTRON_L1________________, _________________MALTRON_R1________________,
72 _________________MALTRON_L2________________, _________________MALTRON_R2________________, 72 _________________MALTRON_L2________________, _________________MALTRON_R2________________,
73 _________________MALTRON_L3________________, _________________MALTRON_R3________________ 73 _________________MALTRON_L3________________, _________________MALTRON_R3________________
74 ), 74 ),
75 75
76 [_EUCALYN] = LAYOUT_5x6_right_trackball_base_wrapper( 76 [_EUCALYN] = LAYOUT_5x6_right_base_wrapper(
77 _________________EUCALYN_L1________________, _________________EUCALYN_R1________________, 77 _________________EUCALYN_L1________________, _________________EUCALYN_R1________________,
78 _________________EUCALYN_L2________________, _________________EUCALYN_R2________________, 78 _________________EUCALYN_L2________________, _________________EUCALYN_R2________________,
79 _________________EUCALYN_L3________________, _________________EUCALYN_R3________________ 79 _________________EUCALYN_L3________________, _________________EUCALYN_R3________________
80 ), 80 ),
81 81
82 [_CARPLAX] = LAYOUT_5x6_right_trackball_base_wrapper( 82 [_CARPLAX] = LAYOUT_5x6_right_base_wrapper(
83 _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________, 83 _____________CARPLAX_QFMLWY_L1_____________, _____________CARPLAX_QFMLWY_R1_____________,
84 _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________, 84 _____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________,
85 _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________ 85 _____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________
86 ), 86 ),
87 87
88 [_MOUSE] = LAYOUT_5x6_right_trackball( 88 [_MOUSE] = LAYOUT_5x6_right(
89 _______, _______, _______, _______, _______, _______, DPI_CONFIG, _______, _______, _______, _______, _______, 89 _______, _______, _______, _______, _______, _______, DPI_CONFIG, _______, _______, _______, _______, _______,
90 _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, 90 _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______,
91 _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, 91 _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______,
@@ -95,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
95 _______, _______, _______, 95 _______, _______, _______,
96 _______, _______, _______, _______ 96 _______, _______, _______, _______
97 ), 97 ),
98 [_GAMEPAD] = LAYOUT_5x6_right_trackball( 98 [_GAMEPAD] = LAYOUT_5x6_right(
99 KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, DPI_CONFIG, _______, _______, _______, _______, _______, 99 KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, DPI_CONFIG, _______, _______, _______, _______, _______,
100 KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, 100 KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______,
101 KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, 101 KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______,
@@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
105 KC_SPC, KC_P, _______, 105 KC_SPC, KC_P, _______,
106 KC_H, KC_LGUI, _______, _______ 106 KC_H, KC_LGUI, _______, _______
107 ), 107 ),
108 [_DIABLO] = LAYOUT_5x6_right_trackball( 108 [_DIABLO] = LAYOUT_5x6_right(
109 KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, 109 KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
110 KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______, 110 KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______,
111 KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______, 111 KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______,
@@ -115,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
115 SFT_T(KC_SPC), KC_J, _______, 115 SFT_T(KC_SPC), KC_J, _______,
116 ALT_T(KC_Q), KC_LGUI, _______, _______ 116 ALT_T(KC_Q), KC_LGUI, _______, _______
117 ), 117 ),
118 [_LOWER] = LAYOUT_5x6_right_trackball_wrapper( 118 [_LOWER] = LAYOUT_5x6_right_wrapper(
119 KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, 119 KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11,
120 _______, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, 120 _______, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______,
121 _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, 121 _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
@@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
125 _______, _______, _______, 125 _______, _______, _______,
126 _______, _______, _______, _______ 126 _______, _______, _______, _______
127 ), 127 ),
128 [_RAISE] = LAYOUT_5x6_right_trackball_wrapper( 128 [_RAISE] = LAYOUT_5x6_right_wrapper(
129 KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, 129 KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11,
130 KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, 130 KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
131 _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, 131 _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
@@ -135,12 +135,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
135 _______, _______, _______, 135 _______, _______, _______,
136 _______, _______, _______, _______ 136 _______, _______, _______, _______
137 ), 137 ),
138 [_ADJUST] = LAYOUT_5x6_right_trackball_wrapper( 138 [_ADJUST] = LAYOUT_5x6_right_wrapper(
139 KC_MAKE, ___________________BLANK___________________, _________________ADJUST_R1_________________, KC_RST, 139 KC_MAKE, ___________________BLANK___________________, _________________ADJUST_R1_________________, KC_RST,
140 VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST, 140 VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST,
141 _______, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, 141 UC_MOD, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS,
142 _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, 142 _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
143 HPT_DWLI, HPT_DWLD, _______, _______, 143 HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO,
144 HPT_TOG, HPT_BUZ, KC_NUKE, 144 HPT_TOG, HPT_BUZ, KC_NUKE,
145 _______, _______, _______, 145 _______, _______, _______,
146 _______, _______, KC_NUKE, _______ 146 _______, _______, KC_NUKE, _______
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
new file mode 100644
index 000000000..7e0eee8bd
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk
@@ -0,0 +1,11 @@
1RGBLIGHT_ENABLE = yes
2RGBLIGHT_STARTUP_ANIMATION = yes
3AUDIO_ENABLE = yes
4HAPTIC_ENABLE = no
5COMMAND_ENABLE = no
6TAP_DANCE_ENABLE = yes
7UNICODE_ENABLE = yes
8OLED_DRIVER_ENABLE = yes
9WPM_ENABLE = yes
10ENCODER_ENABLE = yes
11# DEBOUNCE_TYPE = sym_eager_pk
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/readme.md b/keyboards/handwired/tractyl_manuform/5x6_right/readme.md
new file mode 100644
index 000000000..b6e38dc84
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/readme.md
@@ -0,0 +1,21 @@
1# Drashna's Dactyl Manuform (5x6) with a right side trackball
2
3![](https://preview.redd.it/zwt91036m3y51.jpg?width=960&crop=smart&auto=webp&s=e030deb7d8285c95a1a30c69a7e7a71f750e87bb)
4
5It's a Dactyl Manuform with an integrated thumb based trackball, using the pmw3360 optical sensor.
6
7It's powered by 2x Teensy++ 2.0's, using Drashna's [Teensy VBUS Hack](https://docs.qmk.fm/#/feature_split_keyboard?id=hardware-considerations-and-mods) for better detection.
8
9
10* Keyboard Maintainer: [Drashna Jael're](https://github.com/drashna)
11* Hardware Supported: [Design files](https://gitlab.com/keyboards1/dm_r_track/-/tree/master/boolean), [Teensy++ 2.0 (2x)](https://www.pjrc.com/store/teensypp.html), [PMW3360 Optical Sensor](https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/)
12
13Make example for this keyboard (after setting up your build environment):
14
15 make handwired/dactyl_manuform/5x6_right_trackball:default
16
17Flashing example for this keyboard:
18
19 make handwired/dactyl_manuform/5x6_right_trackball:default:flash
20
21See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
index 9f4a5ea02..a71929a54 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
@@ -11,21 +11,21 @@ BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys 11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control 12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug 13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration 14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = yes # USB Nkey Rollover 18NKRO_ENABLE = yes # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow 20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth 21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output 22AUDIO_ENABLE = no # Audio output
23SWAP_HANDS_ENABLE = yes 23SWAP_HANDS_ENABLE = yes
24
24POINTING_DEVICE_ENABLE = yes 25POINTING_DEVICE_ENABLE = yes
25MOUSE_SHARED_EP = no 26MOUSE_SHARED_EP = no
26 27
27SPLIT_KEYBOARD = yes 28SPLIT_KEYBOARD = yes
28SPLIT_TRANSPORT = custom
29 29
30SRC += drivers/sensors/pmw3360.c 30SRC += drivers/sensors/pmw3360.c
31QUANTUM_LIB_SRC += pointer_transport.c serial.c i2c_master.c i2c_slave.c spi_master.c 31QUANTUM_LIB_SRC += spi_master.c tm_sync.c
diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h
new file mode 100644
index 000000000..e6ab57da9
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/config.h
@@ -0,0 +1,43 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0x44DD
25#define MANUFACTURER Drashna
26
27/* Set 0 if debouncing isn't needed */
28#define DEBOUNCE 5
29
30#define USB_POLLING_INTERVAL_MS 1
31
32/* disable debug print */
33// #define NO_DEBUG
34
35/* disable print */
36// #define NO_PRINT
37
38/* disable action features */
39//#define NO_ACTION_LAYER
40//#define NO_ACTION_TAPPING
41//#define NO_ACTION_ONESHOT
42#define NO_ACTION_MACRO
43#define NO_ACTION_FUNCTION
diff --git a/keyboards/handwired/tractyl_manuform/post_config.h b/keyboards/handwired/tractyl_manuform/post_config.h
new file mode 100644
index 000000000..147e92873
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/post_config.h
@@ -0,0 +1,96 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21// mouse config
22# ifndef MOUSEKEY_MOVE_DELTA
23# ifndef MK_KINETIC_SPEED
24# define MOUSEKEY_MOVE_DELTA 5
25# else
26# define MOUSEKEY_MOVE_DELTA 25
27# endif
28# endif
29# ifndef MOUSEKEY_DELAY
30# ifndef MK_KINETIC_SPEED
31# define MOUSEKEY_DELAY 300
32# else
33# define MOUSEKEY_DELAY 8
34# endif
35# endif
36# ifndef MOUSEKEY_INTERVAL
37# ifndef MK_KINETIC_SPEED
38# define MOUSEKEY_INTERVAL 50
39# else
40# define MOUSEKEY_INTERVAL 20
41# endif
42# endif
43# ifndef MOUSEKEY_MAX_SPEED
44# define MOUSEKEY_MAX_SPEED 7
45# endif
46# ifndef MOUSEKEY_TIME_TO_MAX
47# define MOUSEKEY_TIME_TO_MAX 60
48# endif
49# ifndef MOUSEKEY_INITIAL_SPEED
50# define MOUSEKEY_INITIAL_SPEED 100
51# endif
52# ifndef MOUSEKEY_BASE_SPEED
53# define MOUSEKEY_BASE_SPEED 1000
54# endif
55# ifndef MOUSEKEY_DECELERATED_SPEED
56# define MOUSEKEY_DECELERATED_SPEED 400
57# endif
58# ifndef MOUSEKEY_ACCELERATED_SPEED
59# define MOUSEKEY_ACCELERATED_SPEED 3000
60# endif
61
62
63// mouse scroll config
64# ifndef MOUSEKEY_WHEEL_DELAY
65# define MOUSEKEY_WHEEL_DELAY 15
66# endif
67# ifndef MOUSEKEY_WHEEL_DELTA
68# define MOUSEKEY_WHEEL_DELTA 1
69# endif
70# ifndef MOUSEKEY_WHEEL_INTERVAL
71# define MOUSEKEY_WHEEL_INTERVAL 50
72# endif
73# ifndef MOUSEKEY_WHEEL_MAX_SPEED
74# define MOUSEKEY_WHEEL_MAX_SPEED 8
75# endif
76# ifndef MOUSEKEY_WHEEL_TIME_TO_MAX
77# define MOUSEKEY_WHEEL_TIME_TO_MAX 80
78# endif
79
80# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS
81# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8
82# endif
83# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS
84# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48
85# endif
86# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS
87# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48
88# endif
89# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS
90# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8
91# endif
92
93
94#ifndef DEBOUNCE
95# define DEBOUNCE 5
96#endif
diff --git a/keyboards/handwired/tractyl_manuform/readme.md b/keyboards/handwired/tractyl_manuform/readme.md
new file mode 100644
index 000000000..3221da0e9
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/readme.md
@@ -0,0 +1,159 @@
1Dactyl Manuform (4x5, 5x6, 5x7, 6x6)
2======
3the [Dactyl-Manuform](https://github.com/tshort/dactyl-keyboard) is a split curved keyboard based on the design of [adereth dactyl](https://github.com/adereth/dactyl-keyboard) and thumb cluster design of the [manuform](https://geekhack.org/index.php?topic=46015.0) keyboard, the hardware is similar to the let's split keyboard. all information needed for making one is in the first link.
4![Imgur](https://i.imgur.com/7y0Vbyd.jpg)
5
6
7## First Time Setup
8
9Download or clone the `qmk_firmware` repo and navigate to its top level directory. Once your build environment is setup, you'll be able to generate the default .hex using:
10
11Depending on your Layout chose one of the follwing commands:
12
13```
14$ make handwired/dactyl_manuform/YOUR_LAYOUT:YOUR_KEYMAP_NAME
15```
16
17example:
18```
19$ make handwired/dactyl_manuform/4x5:default
20```
21
22If everything worked correctly you will see a file:
23
24```
25dactyl_manuform_YOUR_LAYOUT_YOUR_KEYMAP_NAME.hex
26```
27
28For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/docs/faq_keymap.md) in the main readme.md.
29
30
31## Keymaps
32
33### [Keymaps 4x5](/keyboards/handwired/dactyl_manuform/4x5/keymaps/)
34
35#### Default
36Simple QWERTY layout with 3 Layers.
37#### Dvorak
38
39### [Keymaps 5x6](/keyboards/handwired/dactyl_manuform/5x6/keymaps/)
40
41#### Default
42Just a copy of the Impstyle keymap. Feel free to adjust it.
43
44#### Impstyle
45A simple QWERTY keymap with 3 Layers. Both sides are connected via serial and the Left ist the master.
46
47### [Keymaps 5x7 aka almost Ergodox](/keyboards/handwired/dactyl_manuform/5x7/keymaps/)
48#### Default
49Keymap of Loligagger from geekhack.
50
51### [Keymaps 6x6](/keyboards/handwired/dactyl_manuform/6x6/keymaps/)
52
53#### Default
54Simple QWERTY layout with 3 Layers.
55
56## Required Hardware
57
58Apart from diodes and key switches for the keyboard matrix in each half, you
59will need:
60
61* 2 Arduino Pro Micros. You can find these on AliExpress for ≈3.50USD each.
62* 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable
63
64Alternatively, you can use any sort of cable and socket that has at least 3
65wires. If you want to use I2C to communicate between halves, you will need a
66cable with at least 4 wires and 2x 4.7kΩ pull-up resistors
67
68## Optional Hardware
69A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`.
70
71## Wiring
72
73The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e.
74PD0 on the ATmega32u4) between the two Pro Micros.
75
76Next, wire your key matrix to any of the remaining 17 IO pins of the pro micro
77and modify the `matrix.c` accordingly.
78
79The wiring for serial:
80
81![serial wiring](https://i.imgur.com/C3D1GAQ.png)
82
83The wiring for i2c:
84
85![i2c wiring](https://i.imgur.com/Hbzhc6E.png)
86
87The pull-up resistors may be placed on either half. It is also possible
88to use 4 resistors and have the pull-ups in both halves, but this is
89unnecessary in simple use cases.
90
91You can change your configuration between serial and i2c by modifying your `config.h` file.
92
93## Notes on Software Configuration
94
95the keymaps in here are for the 4x5 layout of the keyboard only.
96
97## Flashing
98
99To flash your firmware take a look at: [Flashing Instructions and Bootloader Information](https://docs.qmk.fm/#/flashing)
100
101
102## Choosing which board to plug the USB cable into (choosing Master)
103
104Because the two boards are identical, the firmware has logic to differentiate the left and right board.
105
106It uses two strategies to figure things out: looking at the EEPROM (memory on the chip) or looking if the current board has the usb cable.
107
108The EEPROM approach requires additional setup (flashing the eeprom) but allows you to swap the usb cable to either side.
109
110The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra.
111
112### Setting the left hand as master
113
114If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set.
115
116### Setting the right hand as master
117
118If you always plug the usb cable into the right board, add an extra flag to your `config.h`
119```
120 #define MASTER_RIGHT
121```
122
123### Setting EE_hands to use either hands as master
124
125If you define `EE_HANDS` in your `config.h`, you will need to set the
126EEPROM for the left and right halves.
127
128The EEPROM is used to store whether the
129half is left handed or right handed. This makes it so that the same firmware
130file will run on both hands instead of having to flash left and right handed
131versions of the firmware to each half. To flash the EEPROM file for the left
132half run:
133```
134make handwired/dactyl_promicro:default:dfu-split-left
135make handwired/dactyl_promicro:default:dfu-split-right
136```
137
138After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash.
139
140Note that you need to program both halves, but you have the option of using
141different keymaps for each half. You could program the left half with a QWERTY
142layout and the right half with a Colemak layout using bootmagic's default layout option.
143Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the
144right half is connected.
145
146
147Notes on Using Pro Micro 3.3V
148-----------------------------
149
150Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects
151the frequency on the 3.3V board.
152
153Also, if the slave board is producing weird characters in certain columns,
154update the following line in `matrix.c` to the following:
155
156```
157// wait_us(30); // without this wait read unstable value.
158wait_us(300); // without this wait read unstable value.
159```
diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c
new file mode 100644
index 000000000..f0a611206
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/tm_sync.c
@@ -0,0 +1,132 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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#ifdef SPLIT_TRANSACTION_IDS_KB
18
19# include "tractyl_manuform.h"
20# include "transactions.h"
21# include <string.h>
22# include "drivers/sensors/pmw3360.h"
23
24kb_runtime_config_t kb_state;
25kb_slave_data_t kb_slave;
26
27void slave_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
28 if (target2initiator_buffer_size == sizeof(kb_slave)) {
29 memcpy(target2initiator_buffer, &kb_slave, sizeof(kb_slave));
30 if (kb_slave.mouse_x > 127) {
31 kb_slave.mouse_x -= 127;
32 } else if (kb_slave.mouse_x < -127) {
33 kb_slave.mouse_x += 127;
34 } else {
35 kb_slave.mouse_x = 0;
36 }
37
38 if (kb_slave.mouse_y > 127) {
39 kb_slave.mouse_y -= 127;
40 } else if (kb_slave.mouse_y < -127) {
41 kb_slave.mouse_y += 127;
42 } else {
43 kb_slave.mouse_y = 0;
44 }
45 }
46}
47
48void pointer_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
49 if (initiator2target_buffer_size == sizeof(kb_state)) {
50 memcpy(&kb_state, initiator2target_buffer, sizeof(kb_state));
51 }
52}
53
54void keyboard_post_init_kb(void) {
55 // Register keyboard state sync split transaction
56 transaction_register_rpc(RPC_ID_STATE_SYNC, pointer_state_sync);
57 transaction_register_rpc(RPC_ID_SLAVE_STATE, slave_state_sync);
58
59 keyboard_post_init_user();
60}
61
62void kb_state_update(void) {
63# ifdef POINTING_DEVICE_ENABLE
64 if (is_keyboard_master() && !is_keyboard_left()) {
65 static uint16_t cpi = 0;
66 if (cpi != kb_state.device_cpi) {
67 cpi = kb_state.device_cpi;
68 pmw_set_cpi(cpi);
69 }
70 }
71# endif
72}
73
74void kb_post_state_update(void) {
75# ifdef POINTING_DEVICE_ENABLE
76 if (is_keyboard_master() && is_keyboard_left()) {
77 report_mouse_t temp_report = pointing_device_get_report();
78 temp_report.x = kb_slave.mouse_x;
79 temp_report.y = kb_slave.mouse_y;
80 pointing_device_set_report(temp_report);
81 }
82# endif
83}
84
85void kb_state_sync(void) {
86 if (is_keyboard_master()) {
87 // Keep track of the last state, so that we can tell if we need to propagate to slave
88 static kb_runtime_config_t last_kb_state;
89 static uint32_t last_sync = 0;
90 static uint32_t mouse_sync = 0;
91 bool needs_sync = false;
92
93 // Check if the state values are different
94 if (memcmp(&kb_state, &last_kb_state, sizeof(kb_runtime_config_t))) {
95 needs_sync = true;
96 memcpy(&last_kb_state, &kb_state, sizeof(kb_runtime_config_t));
97 }
98 // Send to slave every 500ms regardless of state change
99 if (timer_elapsed32(last_sync) > 500) {
100 needs_sync = true;
101 }
102
103 // Perform the sync if requested
104 if (needs_sync) {
105 if (transaction_rpc_send(RPC_ID_STATE_SYNC, sizeof(kb_runtime_config_t), &kb_state)) {
106 last_sync = timer_read32();
107 }
108 }
109
110 if (is_keyboard_left()) {
111 if (timer_elapsed32(mouse_sync) >= 5) {
112 // always sync slave data, since it may contain device reports.
113 if (transaction_rpc_recv(RPC_ID_SLAVE_STATE, sizeof(kb_slave_data_t), &kb_slave)) {
114 if (kb_slave.mouse_x >= -127 && kb_slave.mouse_x <= 127 && kb_slave.mouse_y >= -127 && kb_slave.mouse_y <= 127) {
115 mouse_sync = timer_read32();
116 }
117 }
118 }
119 }
120 }
121}
122
123void housekeeping_task_kb(void) {
124 // Update kb_state so we can send to slave
125 kb_state_update();
126
127 // Data sync from master to slave
128 kb_state_sync();
129
130 kb_post_state_update();
131}
132#endif
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
index 4048fb233..49a833682 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
@@ -1,4 +1,4 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> 1/* Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 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 4 * it under the terms of the GNU General Public License as published by
@@ -14,10 +14,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "5x6_right_trackball.h" 17#include "tractyl_manuform.h"
18#include "transactions.h"
19#include <string.h>
20#include "drivers/sensors/pmw3360.h"
18 21
19#ifndef TRACKBALL_DPI_OPTIONS 22#ifndef TRACKBALL_DPI_OPTIONS
20# define TRACKBALL_DPI_OPTIONS { 1200, 1600, 2400 } 23# define TRACKBALL_DPI_OPTIONS \
24 { 1200, 1600, 2400 }
21# ifndef TRACKBALL_DPI_DEFAULT 25# ifndef TRACKBALL_DPI_DEFAULT
22# define TRACKBALL_DPI_DEFAULT 1 26# define TRACKBALL_DPI_DEFAULT 1
23# endif 27# endif
@@ -26,12 +30,15 @@
26# define TRACKBALL_DPI_DEFAULT 0 30# define TRACKBALL_DPI_DEFAULT 0
27#endif 31#endif
28 32
33extern kb_runtime_config_t kb_state;
34extern kb_slave_data_t kb_slave;
35
29keyboard_config_t keyboard_config; 36keyboard_config_t keyboard_config;
30uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS; 37uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS;
31#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t)) 38#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
32 39
33bool BurstState = false; // init burst state for Trackball module 40bool BurstState = false; // init burst state for Trackball module
34uint16_t MotionStart = 0; // Timer for accel, 0 is resting state 41uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
35 42
36__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { 43__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
37 mouse_report->x = x; 44 mouse_report->x = x;
@@ -53,12 +60,8 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
53 MotionStart = timer_read(); 60 MotionStart = timer_read();
54 } 61 }
55 62
56 if (debug_mouse) { 63 if (debug_mouse) { dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart); }
57 dprintf("Delt] d: %d t: %u\n", abs(data.dx) + abs(data.dy), MotionStart); 64 if (debug_mouse) { dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy); }
58 }
59 if (debug_mouse) {
60 dprintf("Pre ] X: %d, Y: %d\n", data.dx, data.dy);
61 }
62#if defined(PROFILE_LINEAR) 65#if defined(PROFILE_LINEAR)
63 float scale = float(timer_elaspsed(MotionStart)) / 1000.0; 66 float scale = float(timer_elaspsed(MotionStart)) / 1000.0;
64 data.dx *= scale; 67 data.dx *= scale;
@@ -85,7 +88,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
85 88
86#ifdef POINTING_DEVICE_ENABLE 89#ifdef POINTING_DEVICE_ENABLE
87 if (keycode == DPI_CONFIG && record->event.pressed) { 90 if (keycode == DPI_CONFIG && record->event.pressed) {
88 if ((get_mods()|get_oneshot_mods()) & MOD_MASK_SHIFT) { 91 if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) {
89 keyboard_config.dpi_config = (keyboard_config.dpi_config - 1) % DPI_OPTION_SIZE; 92 keyboard_config.dpi_config = (keyboard_config.dpi_config - 1) % DPI_OPTION_SIZE;
90 } else { 93 } else {
91 keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE; 94 keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
@@ -146,19 +149,11 @@ void pointing_device_init(void) {
146 trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); 149 trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
147} 150}
148 151
149static bool has_report_changed(report_mouse_t new, report_mouse_t old) { 152static bool has_report_changed(report_mouse_t new, report_mouse_t old) { return (new.buttons != old.buttons) || (new.x&& new.x != old.x) || (new.y&& new.y != old.y) || (new.h&& new.h != old.h) || (new.v&& new.v != old.v); }
150 return (new.buttons != old.buttons) ||
151 (new.x && new.x != old.x) ||
152 (new.y && new.y != old.y) ||
153 (new.h && new.h != old.h) ||
154 (new.v && new.v != old.v);
155}
156 153
157void pointing_device_task(void) { 154void pointing_device_task(void) {
158 report_mouse_t mouse_report = pointing_device_get_report(); 155 report_mouse_t mouse_report = pointing_device_get_report();
159 if (!is_keyboard_left()) { 156 if (!is_keyboard_left()) { process_mouse(&mouse_report); }
160 process_mouse(&mouse_report);
161 }
162 157
163 pointing_device_set_report(mouse_report); 158 pointing_device_set_report(mouse_report);
164 pointing_device_send(); 159 pointing_device_send();
@@ -178,24 +173,20 @@ void matrix_init_kb(void) {
178 // is safe to just read DPI setting since matrix init 173 // is safe to just read DPI setting since matrix init
179 // comes before pointing device init. 174 // comes before pointing device init.
180 keyboard_config.raw = eeconfig_read_kb(); 175 keyboard_config.raw = eeconfig_read_kb();
181 if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { 176 if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { eeconfig_init_kb(); }
182 eeconfig_init_kb();
183 }
184 matrix_init_user(); 177 matrix_init_user();
185} 178}
186 179
187#ifdef POINTING_DEVICE_ENABLE 180#ifdef POINTING_DEVICE_ENABLE
188void pointing_device_send(void) { 181void pointing_device_send(void) {
189 static report_mouse_t old_report = {}; 182 static report_mouse_t old_report = {};
190 report_mouse_t mouseReport = pointing_device_get_report(); 183 report_mouse_t mouseReport = pointing_device_get_report();
191 if (is_keyboard_master()) { 184 if (is_keyboard_master()) {
192 int8_t x = mouseReport.x, y = mouseReport.y; 185 int8_t x = mouseReport.x, y = mouseReport.y;
193 mouseReport.x = 0; 186 mouseReport.x = 0;
194 mouseReport.y = 0; 187 mouseReport.y = 0;
195 process_mouse_user(&mouseReport, x, y); 188 process_mouse_user(&mouseReport, x, y);
196 if (has_report_changed(mouseReport, old_report)) { 189 if (has_report_changed(mouseReport, old_report)) { host_mouse_send(&mouseReport); }
197 host_mouse_send(&mouseReport);
198 }
199 } else { 190 } else {
200 master_mouse_send(mouseReport.x, mouseReport.y); 191 master_mouse_send(mouseReport.x, mouseReport.y);
201 } 192 }
@@ -203,26 +194,25 @@ void pointing_device_send(void) {
203 mouseReport.y = 0; 194 mouseReport.y = 0;
204 mouseReport.v = 0; 195 mouseReport.v = 0;
205 mouseReport.h = 0; 196 mouseReport.h = 0;
206 old_report = mouseReport; 197 old_report = mouseReport;
207 pointing_device_set_report(mouseReport); 198 pointing_device_set_report(mouseReport);
208} 199}
209#endif 200#endif
210 201
211#ifdef SWAP_HANDS_ENABLE 202#ifdef POINTING_DEVICE_ENABLE
212const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { 203void master_mouse_send(int8_t x, int8_t y) {
213 /* Left hand, matrix positions */ 204#ifdef SPLIT_TRANSACTION_IDS_KB
214 {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}}, 205 kb_slave.mouse_x += x;
215 {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}}, 206 kb_slave.mouse_y += y;
216 {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}}, 207#endif
217 {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}}, 208}
218 {{5, 10}, {4, 10}, {3, 10}, {2, 10}, {1, 10}, {0, 10}}, 209void trackball_set_cpi(uint16_t cpi) {
219 {{5, 11}, {4, 11}, {3, 11}, {2, 11}, {1, 11}, {0, 11}}, 210 if (!is_keyboard_left()) {
220 /* Right hand, matrix positions */ 211 pmw_set_cpi(cpi);
221 {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, 212 } else {
222 {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, 213#ifdef SPLIT_TRANSACTION_IDS_KB
223 {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, 214 kb_state.device_cpi = cpi;
224 {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, 215#endif
225 {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, 216 }
226 {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}} 217}
227};
228#endif 218#endif
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
new file mode 100644
index 000000000..151e496fc
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
@@ -0,0 +1,55 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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#pragma once
18
19#include "quantum.h"
20#include "pointing_device.h"
21
22#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
23# include "5x6_right.h"
24#elif defined(KEYBOARD_handwired_tractyl_manuform_4x6_right)
25# include "4x6_right.h"
26#endif
27
28void process_mouse(report_mouse_t* mouse_report);
29void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
30
31typedef union {
32 uint32_t raw;
33 struct {
34 uint8_t dpi_config;
35 };
36} keyboard_config_t;
37
38extern keyboard_config_t keyboard_config;
39
40enum ploopy_keycodes {
41 DPI_CONFIG = SAFE_RANGE,
42 KEYMAP_SAFE_RANGE,
43};
44
45void master_mouse_send(int8_t x, int8_t y);
46void trackball_set_cpi(uint16_t cpi);
47
48typedef struct {
49 uint16_t device_cpi;
50} kb_runtime_config_t;
51
52typedef struct {
53 int16_t mouse_x;
54 int16_t mouse_y;
55} kb_slave_data_t;
diff --git a/keyboards/kyria/keymaps/drashna/keymap.c b/keyboards/kyria/keymaps/drashna/keymap.c
index 4563a3c62..14287d0ec 100644
--- a/keyboards/kyria/keymaps/drashna/keymap.c
+++ b/keyboards/kyria/keymaps/drashna/keymap.c
@@ -131,7 +131,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
131// clang-format on 131// clang-format on
132 132
133#ifdef OLED_DRIVER_ENABLE 133#ifdef OLED_DRIVER_ENABLE
134oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } 134oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_180; }
135#endif 135#endif
136 136
137#ifdef ENCODER_ENABLE 137#ifdef ENCODER_ENABLE
diff --git a/keyboards/kyria/keymaps/drashna/rules.mk b/keyboards/kyria/keymaps/drashna/rules.mk
index fb3c1cf84..4036f9145 100644
--- a/keyboards/kyria/keymaps/drashna/rules.mk
+++ b/keyboards/kyria/keymaps/drashna/rules.mk
@@ -3,19 +3,13 @@ ENCODER_ENABLE = yes # ENables the use of one or more encoders
3RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow 3RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
4RGBLIGHT_STARTUP_ANIMATION = no 4RGBLIGHT_STARTUP_ANIMATION = no
5 5
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration 6BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
7MOUSEKEY_ENABLE = no # Mouse keys 7MOUSEKEY_ENABLE = no # Mouse keys
8EXTRAKEY_ENABLE = yes # Audio control and System control 8EXTRAKEY_ENABLE = yes # Audio control and System control
9CONSOLE_ENABLE = no # Console for debug 9CONSOLE_ENABLE = no # Console for debug
10COMMAND_ENABLE = no # Commands for debug and configuration 10COMMAND_ENABLE = no # Commands for debug and configuration
11NKRO_ENABLE = no # USB Nkey Rollover 11NKRO_ENABLE = yes # USB Nkey Rollover
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default 12UNICODE_ENABLE = yes # Unicode
13MIDI_ENABLE = no # MIDI support
14UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
16AUDIO_ENABLE = no # Audio output on port C6
17BOOTLOADER = atmel-dfu 13BOOTLOADER = atmel-dfu
18 14
19# SPLIT_TRANSPORT = mirror
20
21# TAP_DANCE_ENABLE = yes 15# TAP_DANCE_ENABLE = yes
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c
index 3e1460606..600e29020 100644
--- a/layouts/community/ergodox/drashna/keymap.c
+++ b/layouts/community/ergodox/drashna/keymap.c
@@ -19,7 +19,7 @@
19#ifdef UNICODEMAP_ENABLE 19#ifdef UNICODEMAP_ENABLE
20# include "drashna_unicode.h" 20# include "drashna_unicode.h"
21#endif // UNICODEMAP_ENABLE 21#endif // UNICODEMAP_ENABLE
22 22#include "drivers/sensors/pimoroni_trackball.h"
23enum more_custom_keycodes { 23enum more_custom_keycodes {
24 KC_SWAP_NUM = NEW_SAFE_RANGE, 24 KC_SWAP_NUM = NEW_SAFE_RANGE,
25 PM_SCROLL, 25 PM_SCROLL,
@@ -317,13 +317,14 @@ void shutdown_keymap(void) {
317 317
318static bool mouse_button_one, trackball_button_one; 318static bool mouse_button_one, trackball_button_one;
319 319
320void trackball_check_click(bool pressed, report_mouse_t* mouse) { 320void trackball_register_button(bool pressed, enum mouse_buttons button) {
321 if (mouse_button_one | pressed) { 321 report_mouse_t currentReport = pointing_device_get_report();
322 mouse->buttons |= MOUSE_BTN1; 322 if (pressed) {
323 currentReport.buttons |= button;
323 } else { 324 } else {
324 mouse->buttons &= ~MOUSE_BTN1; 325 currentReport.buttons &= ~button;
325 } 326 }
326 trackball_button_one = pressed; 327 pointing_device_set_report(currentReport);
327} 328}
328#endif 329#endif
329 330
diff --git a/layouts/community/ergodox/drashna/visualizer.c b/layouts/community/ergodox/drashna/visualizer.c_old
index 6b1c3ff49..6b1c3ff49 100644
--- a/layouts/community/ergodox/drashna/visualizer.c
+++ b/layouts/community/ergodox/drashna/visualizer.c_old
diff --git a/layouts/community/split_3x6_3/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h
index cc53d4c36..4a094e195 100644
--- a/layouts/community/split_3x6_3/drashna/config.h
+++ b/layouts/community/split_3x6_3/drashna/config.h
@@ -31,11 +31,11 @@
31 31
32#ifdef RGBLIGHT_ENABLE 32#ifdef RGBLIGHT_ENABLE
33# undef RGBLED_NUM 33# undef RGBLED_NUM
34# define RGBLED_NUM 27 34# define RGBLED_NUM 27
35 35
36# define RGBLIGHT_HUE_STEP 8 36# define RGBLIGHT_HUE_STEP 8
37# define RGBLIGHT_SAT_STEP 8 37# define RGBLIGHT_SAT_STEP 8
38# define RGBLIGHT_VAL_STEP 5 38# define RGBLIGHT_VAL_STEP 5
39# define RGBLIGHT_LIMIT_VAL 120 39# define RGBLIGHT_LIMIT_VAL 120
40#endif 40#endif
41 41
@@ -44,37 +44,36 @@
44# undef RGB_DI_PIN 44# undef RGB_DI_PIN
45# define RGB_DI_PIN A3 45# define RGB_DI_PIN A3
46# endif 46# endif
47# define RGB_MATRIX_KEYPRESSES // reacts to keypresses 47# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
48// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) 48// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
49// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects 49// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
50# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended 50# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
51// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) 51// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
52// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) 52// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
53# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 53# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
54# define RGB_MATRIX_HUE_STEP 8 54# define RGB_MATRIX_HUE_STEP 8
55# define RGB_MATRIX_SAT_STEP 8 55# define RGB_MATRIX_SAT_STEP 8
56# define RGB_MATRIX_VAL_STEP 5 56# define RGB_MATRIX_VAL_STEP 5
57# define RGB_MATRIX_SPD_STEP 10 57# define RGB_MATRIX_SPD_STEP 10
58#endif 58#endif
59 59
60#ifdef CONVERT_TO_PROTON_C 60#ifdef CONVERT_TO_PROTON_C
61# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 61# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2
62# define WS2812_PWM_CHANNEL 4 // default: 2 62# define WS2812_PWM_CHANNEL 4 // default: 2
63# define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 63# define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
64# define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. 64# define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
65# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. 65# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
66# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. 66# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU.
67 67
68# undef SOFT_SERIAL_PIN 68# undef SOFT_SERIAL_PIN
69# define SOFT_SERIAL_PIN D3 69# define SOFT_SERIAL_PIN D3
70# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 70# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
71# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 71# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
72 72
73// #define INIT_EE_HANDS_LEFT 73// #define INIT_EE_HANDS_LEFT
74// #define INIT_EE_HANDS_RIGHT 74// #define INIT_EE_HANDS_RIGHT
75#endif 75#endif
76 76
77
78#if defined(AUDIO_ENABLE) && !defined(CONVERT_TO_PROTON_C) 77#if defined(AUDIO_ENABLE) && !defined(CONVERT_TO_PROTON_C)
79# define AUDIO_PIN B6 78# define AUDIO_PIN B6
80# define NO_MUSIC_MODE 79# define NO_MUSIC_MODE
diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c
index 5a2d2f2e2..e46b626ef 100644
--- a/layouts/community/split_3x6_3/drashna/keymap.c
+++ b/layouts/community/split_3x6_3/drashna/keymap.c
@@ -114,7 +114,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
114// clang-format on 114// clang-format on
115 115
116#ifdef OLED_DRIVER_ENABLE 116#ifdef OLED_DRIVER_ENABLE
117oled_rotation_t oled_init_user(oled_rotation_t rotation) { 117oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
118 return OLED_ROTATION_270; 118 return OLED_ROTATION_270;
119} 119}
120#endif 120#endif
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 796485689..445e18082 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -17,34 +17,49 @@
17#pragma once 17#pragma once
18 18
19// Use custom magic number so that when switching branches, EEPROM always gets reset 19// Use custom magic number so that when switching branches, EEPROM always gets reset
20#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339 20#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339
21 21
22/* Set Polling rate to 1000Hz */ 22/* Set Polling rate to 1000Hz */
23#define USB_POLLING_INTERVAL_MS 1 23#define USB_POLLING_INTERVAL_MS 1
24 24
25#if defined(SPLIT_KEYBOARD) 25#if defined(SPLIT_KEYBOARD)
26# define SPLIT_MODS_ENABLE 26# define SPLIT_MODS_ENABLE
27# define SPLIT_TRANSPORT_MIRROR 27# define SPLIT_LAYER_STATE_ENABLE
28# define SPLIT_LED_STATE_ENABLE
29
30// # define SPLIT_TRANSPORT_MIRROR
28# define SERIAL_USE_MULTI_TRANSACTION 31# define SERIAL_USE_MULTI_TRANSACTION
29// # define SPLIT_NUM_TRANSACTIONS_KB 2 32# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC
30#endif 33#endif
31 34
32#ifdef AUDIO_ENABLE 35#ifdef AUDIO_ENABLE
33
34# define AUDIO_CLICKY 36# define AUDIO_CLICKY
35# define STARTUP_SONG SONG(RICK_ROLL)
36# define GOODBYE_SONG SONG(SONIC_RING)
37# define DEFAULT_LAYER_SONGS \
38 { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
39
40# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f 37# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
41 38
42# define UNICODE_SONG_MAC SONG(RICK_ROLL) 39# ifdef USER_SONG_LIST
43# define UNICODE_SONG_LNX SONG(RICK_ROLL) 40# define STARTUP_SONG SONG(RICK_ROLL)
44# define UNICODE_SONG_WIN SONG(RICK_ROLL) 41# define GOODBYE_SONG SONG(SONIC_RING)
45# define UNICODE_SONG_BSD SONG(RICK_ROLL) 42# define DEFAULT_LAYER_SONGS \
46# define UNICODE_SONG_WINC SONG(RICK_ROLL) 43 { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
47#endif // !AUDIO_ENABLE 44# define UNICODE_SONG_MAC SONG(MARIO_THEME)
45# define UNICODE_SONG_LNX SONG(MARIO_POWERUP)
46# define UNICODE_SONG_WIN SONG(MARIO_ONEUP)
47# define UNICODE_SONG_BSD SONG(RICK_ROLL)
48# define UNICODE_SONG_WINC SONG(RICK_ROLL)
49# else
50# define STARTUP_SONG SONG(STARTUP_SOUND)
51# define GOODBYE_SONG SONG(GOODBYE_SOUND)
52# define DEFAULT_LAYER_SONGS \
53 { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) }
54# define UNICODE_SONG_MAC SONG(QWERTY_SOUND)
55# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND)
56# define UNICODE_SONG_WIN SONG(DVORAK_SOUND)
57# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND)
58# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND)
59# endif
60#endif // !AUDIO_ENABLE
61
62#define UNICODE_SELECTED_MODES UC_WIN, UC_MAC
48 63
49#ifdef RGBLIGHT_ENABLE 64#ifdef RGBLIGHT_ENABLE
50# define RGBLIGHT_SLEEP 65# define RGBLIGHT_SLEEP
@@ -56,18 +71,16 @@
56# else 71# else
57# define RGBLIGHT_ANIMATIONS 72# define RGBLIGHT_ANIMATIONS
58# endif 73# endif
59# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 74# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250
60# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1/24 75# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24
61#endif // RGBLIGHT_ENABLE 76#endif // RGBLIGHT_ENABLE
62 77
63#ifdef RGB_MATRIX_ENABLE 78#ifdef RGB_MATRIX_ENABLE
64# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) 79# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot)
65// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) 80// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened)
66# define RGB_MATRIX_FRAMEBUFFER_EFFECTS 81# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
67// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects 82// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
68# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended 83// # define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
69// # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
70// # define EECONFIG_RGB_MATRIX (uint32_t *)16
71 84
72# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) && !defined(KEYBOARD_launchpad) 85# if defined(__AVR__) && !defined(__AVR_AT90USB1286__) && !defined(KEYBOARD_launchpad)
73# define DISABLE_RGB_MATRIX_ALPHAS_MODS 86# define DISABLE_RGB_MATRIX_ALPHAS_MODS
@@ -107,8 +120,8 @@
107# define DISABLE_RGB_MATRIX_MULTISPLASH 120# define DISABLE_RGB_MATRIX_MULTISPLASH
108# define DISABLE_RGB_MATRIX_SOLID_SPLASH 121# define DISABLE_RGB_MATRIX_SOLID_SPLASH
109# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH 122# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
110# endif // AVR 123# endif // AVR
111#endif // RGB_MATRIX_ENABLE 124#endif // RGB_MATRIX_ENABLE
112 125
113#ifdef OLED_DRIVER_ENABLE 126#ifdef OLED_DRIVER_ENABLE
114# ifdef SPLIT_KEYBOARD 127# ifdef SPLIT_KEYBOARD
@@ -120,7 +133,7 @@
120# ifdef OLED_FONT_H 133# ifdef OLED_FONT_H
121# undef OLED_FONT_H 134# undef OLED_FONT_H
122# endif 135# endif
123# define OLED_FONT_H "drashna_font.h" 136# define OLED_FONT_H "drashna_font.h"
124# define OLED_FONT_END 255 137# define OLED_FONT_END 255
125// # define OLED_FONT_5X5 138// # define OLED_FONT_5X5
126// # define OLED_FONT_AZTECH 139// # define OLED_FONT_AZTECH
@@ -135,16 +148,16 @@
135 148
136#ifndef ONESHOT_TAP_TOGGLE 149#ifndef ONESHOT_TAP_TOGGLE
137# define ONESHOT_TAP_TOGGLE 2 150# define ONESHOT_TAP_TOGGLE 2
138#endif // !ONESHOT_TAP_TOGGLE 151#endif // !ONESHOT_TAP_TOGGLE
139 152
140#ifndef ONESHOT_TIMEOUT 153#ifndef ONESHOT_TIMEOUT
141# define ONESHOT_TIMEOUT 3000 154# define ONESHOT_TIMEOUT 3000
142#endif // !ONESHOT_TIMEOUT 155#endif // !ONESHOT_TIMEOUT
143 156
144#ifdef QMK_KEYS_PER_SCAN 157#ifdef QMK_KEYS_PER_SCAN
145# undef QMK_KEYS_PER_SCAN 158# undef QMK_KEYS_PER_SCAN
146# define QMK_KEYS_PER_SCAN 2 159# define QMK_KEYS_PER_SCAN 2
147#endif // !QMK_KEYS_PER_SCAN 160#endif // !QMK_KEYS_PER_SCAN
148 161
149// this makes it possible to do rolling combos (zx) with keys that 162// this makes it possible to do rolling combos (zx) with keys that
150// convert to other keys on hold (z becomes ctrl when you hold it, 163// convert to other keys on hold (z becomes ctrl when you hold it,
@@ -152,8 +165,8 @@
152// actually sends Ctrl-x. That's bad.) 165// actually sends Ctrl-x. That's bad.)
153#define IGNORE_MOD_TAP_INTERRUPT 166#define IGNORE_MOD_TAP_INTERRUPT
154#undef PERMISSIVE_HOLD 167#undef PERMISSIVE_HOLD
155//#define TAPPING_FORCE_HOLD 168//#define TAPPING_FORCE_HOLD_PER_KEY
156//#define RETRO_TAPPING 169//#define RETRO_TAPPING_PER_KEY
157#ifndef KEYBOARD_kyria_rev1 170#ifndef KEYBOARD_kyria_rev1
158# define TAPPING_TERM_PER_KEY 171# define TAPPING_TERM_PER_KEY
159#endif 172#endif
@@ -166,7 +179,7 @@
166 179
167#ifdef TAPPING_TERM 180#ifdef TAPPING_TERM
168# undef TAPPING_TERM 181# undef TAPPING_TERM
169#endif // TAPPING_TERM 182#endif // TAPPING_TERM
170#if defined(KEYBOARD_ergodox_ez) 183#if defined(KEYBOARD_ergodox_ez)
171# define TAPPING_TERM 185 184# define TAPPING_TERM 185
172#elif defined(KEYBOARD_crkbd) 185#elif defined(KEYBOARD_crkbd)
@@ -185,14 +198,16 @@
185# undef LOCKING_RESYNC_ENABLE 198# undef LOCKING_RESYNC_ENABLE
186#endif 199#endif
187 200
201#define LAYER_STATE_16BIT
202
188#ifdef CONVERT_TO_PROTON_C 203#ifdef CONVERT_TO_PROTON_C
189// pins that are available but not present on Pro Micro 204// pins that are available but not present on Pro Micro
190# define A3 PAL_LINE(GPIOA, 3) 205# define A3 PAL_LINE(GPIOA, 3)
191# define A4 PAL_LINE(GPIOA, 4) 206# define A4 PAL_LINE(GPIOA, 4)
192# define A5 PAL_LINE(GPIOA, 5) 207# define A5 PAL_LINE(GPIOA, 5)
193# define A6 PAL_LINE(GPIOA, 6) 208# define A6 PAL_LINE(GPIOA, 6)
194# define A7 PAL_LINE(GPIOA, 7) 209# define A7 PAL_LINE(GPIOA, 7)
195# define A8 PAL_LINE(GPIOA, 8) 210# define A8 PAL_LINE(GPIOA, 8)
196# define A13 PAL_LINE(GPIOA, 13) 211# define A13 PAL_LINE(GPIOA, 13)
197# define A14 PAL_LINE(GPIOA, 14) 212# define A14 PAL_LINE(GPIOA, 14)
198# define A15 PAL_LINE(GPIOA, 15) 213# define A15 PAL_LINE(GPIOA, 15)
@@ -203,3 +218,79 @@
203# define C14 PAL_LINE(GPIOC, 14) 218# define C14 PAL_LINE(GPIOC, 14)
204# define C15 PAL_LINE(GPIOC, 15) 219# define C15 PAL_LINE(GPIOC, 15)
205#endif 220#endif
221
222#ifdef MOUSEKEY_ENABLE
223// mouse movement config
224# ifdef MK_3_SPEED
225# undef MK_3_SPEED
226# endif
227# define MK_KINETIC_SPEED
228# ifdef MK_KINETIC_SPEED
229# ifndef MOUSEKEY_DELAY
230# define MOUSEKEY_DELAY 8
231# endif
232# ifndef MOUSEKEY_INTERVAL
233# define MOUSEKEY_INTERVAL 20
234# endif
235# ifdef MOUSEKEY_MOVE_DELTA
236# define MOUSEKEY_MOVE_DELTA 25
237# endif
238# else
239# ifndef MOUSEKEY_DELAY
240# define MOUSEKEY_DELAY 300
241# endif
242# ifndef MOUSEKEY_INTERVAL
243# define MOUSEKEY_INTERVAL 50
244# endif
245# ifndef MOUSEKEY_MOVE_DELTA
246# define MOUSEKEY_MOVE_DELTA 5
247# endif
248# endif
249# ifndef MOUSEKEY_MAX_SPEED
250# define MOUSEKEY_MAX_SPEED 7
251# endif
252# ifndef MOUSEKEY_TIME_TO_MAX
253# define MOUSEKEY_TIME_TO_MAX 60
254# endif
255# ifndef MOUSEKEY_INITIAL_SPEED
256# define MOUSEKEY_INITIAL_SPEED 100
257# endif
258# ifndef MOUSEKEY_BASE_SPEED
259# define MOUSEKEY_BASE_SPEED 1000
260# endif
261# ifndef MOUSEKEY_DECELERATED_SPEED
262# define MOUSEKEY_DECELERATED_SPEED 400
263# endif
264# ifndef MOUSEKEY_ACCELERATED_SPEED
265# define MOUSEKEY_ACCELERATED_SPEED 3000
266# endif
267// mouse scroll config
268# ifndef MOUSEKEY_WHEEL_DELAY
269# define MOUSEKEY_WHEEL_DELAY 15
270# endif
271# ifndef MOUSEKEY_WHEEL_DELTA
272# define MOUSEKEY_WHEEL_DELTA 1
273# endif
274# ifndef MOUSEKEY_WHEEL_INTERVAL
275# define MOUSEKEY_WHEEL_INTERVAL 50
276# endif
277# ifndef MOUSEKEY_WHEEL_MAX_SPEED
278# define MOUSEKEY_WHEEL_MAX_SPEED 8
279# endif
280# ifndef MOUSEKEY_WHEEL_TIME_TO_MAX
281# define MOUSEKEY_WHEEL_TIME_TO_MAX 80
282# endif
283// mouse scroll kinetic config
284# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS
285# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8
286# endif
287# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS
288# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48
289# endif
290# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS
291# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48
292# endif
293# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS
294# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8
295# endif
296#endif // MOUSEKEY_ENABLE
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index a49373726..b54d0cfcc 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -86,6 +86,9 @@ void keyboard_post_init_user(void) {
86#if defined(RGB_MATRIX_ENABLE) 86#if defined(RGB_MATRIX_ENABLE)
87 keyboard_post_init_rgb_matrix(); 87 keyboard_post_init_rgb_matrix();
88#endif 88#endif
89#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER)
90 keyboard_post_init_transport_sync();
91#endif
89 keyboard_post_init_keymap(); 92 keyboard_post_init_keymap();
90} 93}
91 94
@@ -100,12 +103,12 @@ void shutdown_user(void) {
100 rgblight_enable_noeeprom(); 103 rgblight_enable_noeeprom();
101 rgblight_mode_noeeprom(1); 104 rgblight_mode_noeeprom(1);
102 rgblight_setrgb_red(); 105 rgblight_setrgb_red();
103#endif // RGBLIGHT_ENABLE 106#endif // RGBLIGHT_ENABLE
104#ifdef RGB_MATRIX_ENABLE 107#ifdef RGB_MATRIX_ENABLE
105 rgb_matrix_set_color_all(0xFF, 0x00, 0x00); 108 rgb_matrix_set_color_all(0xFF, 0x00, 0x00);
106 rgb_matrix_update_pwm_buffers(); 109 rgb_matrix_update_pwm_buffers();
107 110
108#endif // RGB_MATRIX_ENABLE 111#endif // RGB_MATRIX_ENABLE
109 shutdown_keymap(); 112 shutdown_keymap();
110} 113}
111 114
@@ -120,7 +123,11 @@ void suspend_power_down_user(void) {
120 123
121__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} 124__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
122 125
123void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } 126void suspend_wakeup_init_user(void) {
127 if (layer_state_is(_GAMEPAD)) { layer_off(_GAMEPAD); }
128 if (layer_state_is(_DIABLO)) { layer_off(_DIABLO); }
129 suspend_wakeup_init_keymap();
130}
124 131
125__attribute__((weak)) void matrix_scan_keymap(void) {} 132__attribute__((weak)) void matrix_scan_keymap(void) {}
126 133
@@ -135,13 +142,13 @@ void matrix_scan_user(void) {
135 startup_user(); 142 startup_user();
136 } 143 }
137 144
138#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. 145#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
139 run_diablo_macro_check(); 146 run_diablo_macro_check();
140#endif // TAP_DANCE_ENABLE 147#endif // TAP_DANCE_ENABLE
141 148
142#if defined(RGBLIGHT_ENABLE) 149#if defined(RGBLIGHT_ENABLE)
143 matrix_scan_rgb_light(); 150 matrix_scan_rgb_light();
144#endif // RGBLIGHT_ENABLE 151#endif // RGBLIGHT_ENABLE
145#if defined(RGB_MATRIX_ENABLE) 152#if defined(RGB_MATRIX_ENABLE)
146 matrix_scan_rgb_matrix(); 153 matrix_scan_rgb_matrix();
147#endif 154#endif
@@ -160,15 +167,13 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state)
160// on layer change, no matter where the change was initiated 167// on layer change, no matter where the change was initiated
161// Then runs keymap's layer change check 168// Then runs keymap's layer change check
162layer_state_t layer_state_set_user(layer_state_t state) { 169layer_state_t layer_state_set_user(layer_state_t state) {
163 if (!is_keyboard_master()) { 170 if (!is_keyboard_master()) { return state; }
164 return state;
165 }
166 171
167 state = layer_state_set_keymap(state); 172 state = layer_state_set_keymap(state);
168 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); 173 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
169#if defined(RGBLIGHT_ENABLE) 174#if defined(RGBLIGHT_ENABLE)
170 state = layer_state_set_rgb_light(state); 175 state = layer_state_set_rgb_light(state);
171#endif // RGBLIGHT_ENABLE 176#endif // RGBLIGHT_ENABLE
172#if defined(AUDIO_ENABLE) && !defined(__arm__) 177#if defined(AUDIO_ENABLE) && !defined(__arm__)
173 static bool is_gamepad_on = false; 178 static bool is_gamepad_on = false;
174 if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) { 179 if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) {
@@ -187,15 +192,13 @@ __attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t
187 192
188// Runs state check and changes underglow color and animation 193// Runs state check and changes underglow color and animation
189layer_state_t default_layer_state_set_user(layer_state_t state) { 194layer_state_t default_layer_state_set_user(layer_state_t state) {
190 if (!is_keyboard_master()) { 195 if (!is_keyboard_master()) { return state; }
191 return state;
192 }
193 196
194 state = default_layer_state_set_keymap(state); 197 state = default_layer_state_set_keymap(state);
195#if 0 198#if 0
196# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) 199# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
197 state = default_layer_state_set_rgb(state); 200 state = default_layer_state_set_rgb(state);
198# endif // RGBLIGHT_ENABLE 201# endif // RGBLIGHT_ENABLE
199#endif 202#endif
200 return state; 203 return state;
201} 204}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index e37c73bb2..f1d756f74 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -22,7 +22,7 @@
22#include "process_records.h" 22#include "process_records.h"
23#ifdef TAP_DANCE_ENABLE 23#ifdef TAP_DANCE_ENABLE
24# include "tap_dances.h" 24# include "tap_dances.h"
25#endif // TAP_DANCE_ENABLE 25#endif // TAP_DANCE_ENABLE
26#if defined(RGBLIGHT_ENABLE) 26#if defined(RGBLIGHT_ENABLE)
27# include "rgb_stuff.h" 27# include "rgb_stuff.h"
28#endif 28#endif
@@ -35,6 +35,9 @@
35#if defined(PIMORONI_TRACKBALL_ENABLE) 35#if defined(PIMORONI_TRACKBALL_ENABLE)
36# include "drivers/sensors/pimoroni_trackball.h" 36# include "drivers/sensors/pimoroni_trackball.h"
37#endif 37#endif
38#ifdef SPLIT_KEYBOARD
39# include "transport_sync.h"
40#endif
38 41
39/* Define layer names */ 42/* Define layer names */
40enum userspace_layers { 43enum userspace_layers {
@@ -98,12 +101,12 @@ We use custom codes here, so we can substitute the right stuff
98# define KC_D3_2 TD(TD_D3_2) 101# define KC_D3_2 TD(TD_D3_2)
99# define KC_D3_3 TD(TD_D3_3) 102# define KC_D3_3 TD(TD_D3_3)
100# define KC_D3_4 TD(TD_D3_4) 103# define KC_D3_4 TD(TD_D3_4)
101#else // TAP_DANCE_ENABLE 104#else // TAP_DANCE_ENABLE
102# define KC_D3_1 KC_1 105# define KC_D3_1 KC_1
103# define KC_D3_2 KC_2 106# define KC_D3_2 KC_2
104# define KC_D3_3 KC_3 107# define KC_D3_3 KC_3
105# define KC_D3_4 KC_4 108# define KC_D3_4 KC_4
106#endif // TAP_DANCE_ENABLE 109#endif // TAP_DANCE_ENABLE
107 110
108#if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE) 111#if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE)
109void master_mouse_send(int8_t x, int8_t y); 112void master_mouse_send(int8_t x, int8_t y);
diff --git a/users/drashna/drashna_font.h b/users/drashna/drashna_font.h
index 6a3865a44..46ebf3710 100644
--- a/users/drashna/drashna_font.h
+++ b/users/drashna/drashna_font.h
@@ -5,8 +5,9 @@
5 5
6#include "progmem.h" 6#include "progmem.h"
7 7
8// clang-format off
8static const unsigned char font[] PROGMEM = { 9static const unsigned char font[] PROGMEM = {
9 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 0 10 0x07, 0x08, 0x7F, 0x08, 0x07, 0x00, // 0x00 0
10 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, // 0x01 1 11 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, // 0x01 1
11 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, // 0x02 2 12 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, // 0x02 2
12 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, // 0x03 3 ♥ 13 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, // 0x03 3 ♥
@@ -1304,3 +1305,5 @@ static const unsigned char font[] PROGMEM = {
1304 1305
1305#endif 1306#endif
1306 }; 1307 };
1308
1309// clang-format on
diff --git a/users/drashna/drashna_transport.c b/users/drashna/drashna_transport.c
deleted file mode 100644
index 9df11c9bd..000000000
--- a/users/drashna/drashna_transport.c
+++ /dev/null
@@ -1,603 +0,0 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
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 <string.h>
18#include <stddef.h>
19
20#include "matrix.h"
21#include QMK_KEYBOARD_H
22
23#define ROWS_PER_HAND (MATRIX_ROWS / 2)
24#define SYNC_TIMER_OFFSET 2
25
26#ifdef RGBLIGHT_ENABLE
27# include "rgblight.h"
28#endif
29
30#ifdef BACKLIGHT_ENABLE
31# include "backlight.h"
32#endif
33
34#ifdef ENCODER_ENABLE
35# include "encoder.h"
36static pin_t encoders_pad[] = ENCODERS_PAD_A;
37# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t))
38#endif
39
40#ifdef POINTING_DEVICE_ENABLE
41static uint16_t device_cpi = 0;
42static int8_t split_mouse_x = 0, split_mouse_y = 0;
43#endif
44
45#ifdef OLED_DRIVER_ENABLE
46# include "oled_driver.h"
47#endif
48
49#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
50# include "led_matrix.h"
51#endif
52#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
53# include "rgb_matrix.h"
54#endif
55
56#if defined(USE_I2C)
57
58# include "i2c_master.h"
59# include "i2c_slave.h"
60
61typedef struct _I2C_slave_buffer_t {
62# ifndef DISABLE_SYNC_TIMER
63 uint32_t sync_timer;
64# endif
65# ifdef SPLIT_TRANSPORT_MIRROR
66 matrix_row_t mmatrix[ROWS_PER_HAND];
67# endif
68 matrix_row_t smatrix[ROWS_PER_HAND];
69# ifdef SPLIT_MODS_ENABLE
70 uint8_t real_mods;
71 uint8_t weak_mods;
72# ifndef NO_ACTION_ONESHOT
73 uint8_t oneshot_mods;
74# endif
75# endif
76# ifdef BACKLIGHT_ENABLE
77 uint8_t backlight_level;
78# endif
79# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
80 rgblight_syncinfo_t rgblight_sync;
81# endif
82# ifdef ENCODER_ENABLE
83 uint8_t encoder_state[NUMBER_OF_ENCODERS];
84# endif
85# ifdef WPM_ENABLE
86 uint8_t current_wpm;
87# endif
88# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
89 led_eeconfig_t led_matrix;
90 bool led_suspend_state;
91# endif
92# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
93 rgb_config_t rgb_matrix;
94 bool rgb_suspend_state;
95# endif
96 int8_t mouse_x;
97 int8_t mouse_y;
98 uint16_t device_cpi;
99 bool oled_on;
100 layer_state_t t_layer_state;
101 layer_state_t t_default_layer_state;
102} __attribute__((packed)) I2C_slave_buffer_t;
103
104static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg;
105
106# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level)
107# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
108# define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix)
109# define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix)
110# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer)
111# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods)
112# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods)
113# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods)
114# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state)
115# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
116# define I2C_MOUSE_X_START offsetof(I2C_slave_buffer_t, mouse_x)
117# define I2C_MOUSE_Y_START offsetof(I2C_slave_buffer_t, mouse_y)
118# define I2C_MOUSE_DPI_START offsetof(I2C_slave_buffer_t, device_cpi)
119# define I2C_OLED_ON_START offsetof(I2C_slave_buffer_t, oled_on)
120# define I2C_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_layer_state)
121# define I2C_DEFAULT_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_default_layer_state)
122# define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix)
123# define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state)
124# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix)
125# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state)
126
127# define TIMEOUT 100
128
129# ifndef SLAVE_I2C_ADDRESS
130# define SLAVE_I2C_ADDRESS 0x32
131# endif
132
133// Get rows from other half over i2c
134bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
135 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT);
136# ifdef SPLIT_TRANSPORT_MIRROR
137 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT);
138# endif
139 // write backlight info
140# ifdef BACKLIGHT_ENABLE
141 uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0;
142 if (level != i2c_buffer->backlight_level) {
143 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIGHT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) {
144 i2c_buffer->backlight_level = level;
145 }
146 }
147# endif
148
149# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
150 if (rgblight_get_change_flags()) {
151 rgblight_syncinfo_t rgblight_sync;
152 rgblight_get_syncinfo(&rgblight_sync);
153 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgblight_sync, sizeof(rgblight_sync), TIMEOUT) >= 0) {
154 rgblight_clear_change_flags();
155 }
156 }
157# endif
158
159# ifdef ENCODER_ENABLE
160 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_ENCODER_START, (void *)i2c_buffer->encoder_state, sizeof(i2c_buffer->encoder_state), TIMEOUT);
161 encoder_update_raw(i2c_buffer->encoder_state);
162# endif
163
164# ifdef WPM_ENABLE
165 uint8_t current_wpm = get_current_wpm();
166 if (current_wpm != i2c_buffer->current_wpm) {
167 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WPM_START, (void *)&current_wpm, sizeof(current_wpm), TIMEOUT) >= 0) {
168 i2c_buffer->current_wpm = current_wpm;
169 }
170 }
171# endif
172
173# ifdef POINTING_DEVICE_ENABLE
174 if (is_keyboard_left()) {
175 report_mouse_t temp_report = pointing_device_get_report();
176 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT);
177 temp_report.x = i2c_buffer->mouse_x;
178 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT);
179 temp_report.y = i2c_buffer->mouse_y;
180 pointing_device_set_report(temp_report);
181
182 if (device_cpi != i2c_buffer->device_cpi) {
183 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_DPI_START, (void *)&device_cpi, sizeof(device_cpi), TIMEOUT) >= 0) {
184 i2c_buffer->device_cpi = device_cpi
185 }
186 }
187 }
188# endif
189
190# ifdef SPLIT_MODS_ENABLE
191 uint8_t real_mods = get_mods();
192 if (real_mods != i2c_buffer->real_mods) {
193 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_REAL_MODS_START, (void *)&real_mods, sizeof(real_mods), TIMEOUT) >= 0) {
194 i2c_buffer->real_mods = real_mods;
195 }
196 }
197
198 uint8_t weak_mods = get_weak_mods();
199 if (weak_mods != i2c_buffer->weak_mods) {
200 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WEAK_MODS_START, (void *)&weak_mods, sizeof(weak_mods), TIMEOUT) >= 0) {
201 i2c_buffer->weak_mods = weak_mods;
202 }
203 }
204
205# ifndef NO_ACTION_ONESHOT
206 uint8_t oneshot_mods = get_oneshot_mods();
207 if (oneshot_mods != i2c_buffer->oneshot_mods) {
208 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_ONESHOT_MODS_START, (void *)&oneshot_mods, sizeof(oneshot_mods), TIMEOUT) >= 0) {
209 i2c_buffer->oneshot_mods = oneshot_mods;
210 }
211 }
212# endif
213# endif
214
215 if (layer_state != i2c_buffer->t_layer_state) {
216 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&layer_state, sizeof(layer_state), TIMEOUT) >= 0) {
217 i2c_buffer->t_layer_state = layer_state;
218 }
219 }
220
221 if (default_layer_state != i2c_buffer->t_default_layer_state) {
222 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_DEFAULT_LAYER_STATE_START, (void *)&default_layer_state, sizeof(default_layer_state), TIMEOUT) >= 0) {
223 i2c_buffer->t_default_layer_state = default_layer_state;
224 }
225 }
226
227# ifdef OLED_DRIVER_ENABLE
228 bool is_oled_on = is_oled_on();
229 if (is_oled_on != i2c_buffer->oled_on) {
230 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&is_oled_on, sizeof(is_oled_on), TIMEOUT) >= 0) {
231 i2c_buffer->oled_on = is_oled_on;
232 }
233 }
234# endif
235
236# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
237 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT);
238 bool suspend_state = led_matrix_get_suspend_state();
239 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT);
240# endif
241# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
242 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT);
243 bool suspend_state = rgb_matrix_get_suspend_state();
244 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT);
245# endif
246
247# ifndef DISABLE_SYNC_TIMER
248 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
249 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT);
250# endif
251
252 return true;
253}
254
255void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
256# ifndef DISABLE_SYNC_TIMER
257 sync_timer_update(i2c_buffer->sync_timer);
258# endif
259 // Copy matrix to I2C buffer
260 memcpy((void *)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix));
261# ifdef SPLIT_TRANSPORT_MIRROR
262 memcpy((void *)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix));
263# endif
264
265// Read Backlight Info
266# ifdef BACKLIGHT_ENABLE
267 backlight_set(i2c_buffer->backlight_level);
268# endif
269
270# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
271 // Update the RGB with the new data
272 if (i2c_buffer->rgblight_sync.status.change_flags != 0) {
273 rgblight_update_sync(&i2c_buffer->rgblight_sync, false);
274 i2c_buffer->rgblight_sync.status.change_flags = 0;
275 }
276# endif
277
278# ifdef ENCODER_ENABLE
279 encoder_state_raw(i2c_buffer->encoder_state);
280# endif
281
282# ifdef WPM_ENABLE
283 set_current_wpm(i2c_buffer->current_wpm);
284# endif
285
286# ifdef POINTING_DEVICE_ENABLE
287 if (!is_keyboard_left()) {
288 static uint16_t cpi;
289 if (cpi != i2c_buffer->device_cpi) {
290 cpi = i2c_buffer->device_cpi;
291 pmw_set_cpi(cpi);
292 }
293 i2c_buffer->mouse_x = split_mouse_x;
294 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT);
295 i2c_buffer->mouse_y = split_mouse_y;
296 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT);
297 }
298
299# endif
300
301# ifdef SPLIT_MODS_ENABLE
302 set_mods(i2c_buffer->real_mods);
303 set_weak_mods(i2c_buffer->weak_mods);
304# ifndef NO_ACTION_ONESHOT
305 set_oneshot_mods(i2c_buffer->oneshot_mods);
306# endif
307# endif
308
309 if (layer_state != i2c_buffer->t_layer_state) {
310 layer_state = i2c_buffer->t_layer_state;
311 }
312 if (default_layer_state != i2c_buffer->t_default_layer_state) {
313 default_layer_state = i2c_buffer->t_default_layer_state;
314 }
315
316# ifdef OLED_DRIVER_ENABLE
317 if (i2c_buffer->oled_on) {
318 oled_on();
319 } else {
320 oled_off();
321 }
322# endif
323
324# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
325 memcpy((void *)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix));
326 led_matrix_set_suspend_state(i2c_buffer->led_suspend_state);
327# endif
328# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
329 memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix));
330 rgb_matrix_set_suspend_state(i2c_buffer->rgb_suspend_state);
331# endif
332}
333
334void transport_master_init(void) { i2c_init(); }
335
336void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); }
337
338#else // USE_SERIAL
339
340# include "serial.h"
341
342typedef struct _Serial_s2m_buffer_t {
343 // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack
344 matrix_row_t smatrix[ROWS_PER_HAND];
345# ifdef ENCODER_ENABLE
346 uint8_t encoder_state[NUMBER_OF_ENCODERS];
347# endif
348 int8_t mouse_x;
349 int8_t mouse_y;
350} __attribute__((packed)) Serial_s2m_buffer_t;
351
352typedef struct _Serial_m2s_buffer_t {
353# ifdef SPLIT_MODS_ENABLE
354 uint8_t real_mods;
355 uint8_t weak_mods;
356# ifndef NO_ACTION_ONESHOT
357 uint8_t oneshot_mods;
358# endif
359# endif
360# ifndef DISABLE_SYNC_TIMER
361 uint32_t sync_timer;
362# endif
363# ifdef SPLIT_TRANSPORT_MIRROR
364 matrix_row_t mmatrix[ROWS_PER_HAND];
365# endif
366# ifdef BACKLIGHT_ENABLE
367 uint8_t backlight_level;
368# endif
369# ifdef WPM_ENABLE
370 uint8_t current_wpm;
371# endif
372 uint16_t device_cpi;
373 bool oled_on;
374 layer_state_t t_layer_state;
375 layer_state_t t_default_layer_state;
376# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
377 led_eeconfig_t led_matrix;
378 bool led_suspend_state;
379# endif
380# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
381 rgb_config_t rgb_matrix;
382 bool rgb_suspend_state;
383# endif
384} __attribute__((packed)) Serial_m2s_buffer_t;
385
386# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
387// When MCUs on both sides drive their respective RGB LED chains,
388// it is necessary to synchronize, so it is necessary to communicate RGB
389// information. In that case, define RGBLIGHT_SPLIT with info on the number
390// of LEDs on each half.
391//
392// Otherwise, if the master side MCU drives both sides RGB LED chains,
393// there is no need to communicate.
394
395typedef struct _Serial_rgblight_t {
396 rgblight_syncinfo_t rgblight_sync;
397} Serial_rgblight_t;
398
399volatile Serial_rgblight_t serial_rgblight = {};
400uint8_t volatile status_rgblight = 0;
401# endif
402
403volatile Serial_s2m_buffer_t serial_s2m_buffer = {};
404volatile Serial_m2s_buffer_t serial_m2s_buffer = {};
405uint8_t volatile status0 = 0;
406
407enum serial_transaction_id {
408 GET_SLAVE_MATRIX = 0,
409# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
410 PUT_RGBLIGHT,
411# endif
412};
413
414SSTD_t transactions[] = {
415 [GET_SLAVE_MATRIX] =
416 {
417 (uint8_t *)&status0,
418 sizeof(serial_m2s_buffer),
419 (uint8_t *)&serial_m2s_buffer,
420 sizeof(serial_s2m_buffer),
421 (uint8_t *)&serial_s2m_buffer,
422 },
423# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
424 [PUT_RGBLIGHT] =
425 {
426 (uint8_t *)&status_rgblight, sizeof(serial_rgblight), (uint8_t *)&serial_rgblight, 0, NULL // no slave to master transfer
427 },
428# endif
429};
430
431void transport_master_init(void) { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); }
432
433void transport_slave_init(void) { soft_serial_target_init(transactions, TID_LIMIT(transactions)); }
434
435# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
436
437// rgblight synchronization information communication.
438
439void transport_rgblight_master(void) {
440 if (rgblight_get_change_flags()) {
441 rgblight_get_syncinfo((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync);
442 if (soft_serial_transaction(PUT_RGBLIGHT) == TRANSACTION_END) {
443 rgblight_clear_change_flags();
444 }
445 }
446}
447
448void transport_rgblight_slave(void) {
449 if (status_rgblight == TRANSACTION_ACCEPTED) {
450 rgblight_update_sync((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync, false);
451 status_rgblight = TRANSACTION_END;
452 }
453}
454
455# else
456# define transport_rgblight_master()
457# define transport_rgblight_slave()
458# endif
459
460bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
461# ifndef SERIAL_USE_MULTI_TRANSACTION
462 if (soft_serial_transaction() != TRANSACTION_END) {
463 return false;
464 }
465# else
466 transport_rgblight_master();
467 if (soft_serial_transaction(GET_SLAVE_MATRIX) != TRANSACTION_END) {
468 return false;
469 }
470# endif
471
472 // TODO: if MATRIX_COLS > 8 change to unpack()
473 for (int i = 0; i < ROWS_PER_HAND; ++i) {
474 slave_matrix[i] = serial_s2m_buffer.smatrix[i];
475# ifdef SPLIT_TRANSPORT_MIRROR
476 serial_m2s_buffer.mmatrix[i] = master_matrix[i];
477# endif
478 }
479
480# ifdef BACKLIGHT_ENABLE
481 // Write backlight level for slave to read
482 serial_m2s_buffer.backlight_level = is_backlight_enabled() ? get_backlight_level() : 0;
483# endif
484
485# ifdef ENCODER_ENABLE
486 encoder_update_raw((uint8_t *)serial_s2m_buffer.encoder_state);
487# endif
488
489# ifdef WPM_ENABLE
490 // Write wpm to slave
491 serial_m2s_buffer.current_wpm = get_current_wpm();
492# endif
493
494# ifdef SPLIT_MODS_ENABLE
495 serial_m2s_buffer.real_mods = get_mods();
496 serial_m2s_buffer.weak_mods = get_weak_mods();
497# ifndef NO_ACTION_ONESHOT
498 serial_m2s_buffer.oneshot_mods = get_oneshot_mods();
499# endif
500# endif
501
502# ifdef POINTING_DEVICE_ENABLE
503 if (is_keyboard_left()) {
504 report_mouse_t temp_report = pointing_device_get_report();
505 temp_report.x = serial_s2m_buffer.mouse_x;
506 temp_report.y = serial_s2m_buffer.mouse_y;
507 pointing_device_set_report(temp_report);
508 serial_m2s_buffer.device_cpi = device_cpi;
509 }
510# endif
511
512 serial_m2s_buffer.t_layer_state = layer_state;
513 serial_m2s_buffer.t_default_layer_state = default_layer_state;
514# ifdef OLED_DRIVER_ENABLE
515 serial_m2s_buffer.oled_on = is_oled_on();
516# endif
517
518# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
519 serial_m2s_buffer.led_matrix = led_matrix_eeconfig;
520 serial_m2s_buffer.led_suspend_state = led_matrix_get_suspend_state();
521# endif
522# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
523 serial_m2s_buffer.rgb_matrix = rgb_matrix_config;
524 serial_m2s_buffer.rgb_suspend_state = rgb_matrix_get_suspend_state();
525# endif
526
527# ifndef DISABLE_SYNC_TIMER
528 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
529# endif
530 return true;
531}
532
533void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
534 transport_rgblight_slave();
535# ifndef DISABLE_SYNC_TIMER
536 sync_timer_update(serial_m2s_buffer.sync_timer);
537# endif
538
539 // TODO: if MATRIX_COLS > 8 change to pack()
540 for (int i = 0; i < ROWS_PER_HAND; ++i) {
541 serial_s2m_buffer.smatrix[i] = slave_matrix[i];
542# ifdef SPLIT_TRANSPORT_MIRROR
543 master_matrix[i] = serial_m2s_buffer.mmatrix[i];
544# endif
545 }
546
547# ifdef BACKLIGHT_ENABLE
548 backlight_set(serial_m2s_buffer.backlight_level);
549# endif
550
551# ifdef ENCODER_ENABLE
552 encoder_state_raw((uint8_t *)serial_s2m_buffer.encoder_state);
553# endif
554
555# ifdef WPM_ENABLE
556 set_current_wpm(serial_m2s_buffer.current_wpm);
557# endif
558
559# ifdef SPLIT_MODS_ENABLE
560 set_mods(serial_m2s_buffer.real_mods);
561 set_weak_mods(serial_m2s_buffer.weak_mods);
562# ifndef NO_ACTION_ONESHOT
563 set_oneshot_mods(serial_m2s_buffer.oneshot_mods);
564# endif
565# endif
566
567# ifdef POINTING_DEVICE_ENABLE
568 if (!is_keyboard_left()) {
569 static uint16_t cpi;
570 if (cpi != serial_m2s_buffer.device_cpi) {
571 cpi = serial_m2s_buffer.device_cpi;
572 pmw_set_cpi(cpi);
573 }
574 serial_s2m_buffer.mouse_x = split_mouse_x;
575 serial_s2m_buffer.mouse_y = split_mouse_y;
576 }
577# endif
578
579 if (layer_state != serial_m2s_buffer.t_layer_state) {
580 layer_state = serial_m2s_buffer.t_layer_state;
581 }
582 if (default_layer_state != serial_m2s_buffer.t_default_layer_state) {
583 default_layer_state = serial_m2s_buffer.t_default_layer_state;
584 }
585# ifdef OLED_DRIVER_ENABLE
586 if (serial_m2s_buffer.oled_on) {
587 oled_on();
588 } else {
589 oled_off();
590 }
591# endif
592
593# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
594 led_matrix_eeconfig = serial_m2s_buffer.led_matrix;
595 led_matrix_set_suspend_state(serial_m2s_buffer.led_suspend_state);
596# endif
597# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
598 rgb_matrix_config = serial_m2s_buffer.rgb_matrix;
599 rgb_matrix_set_suspend_state(serial_m2s_buffer.rgb_suspend_state);
600# endif
601}
602
603#endif
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
index 98e467d93..253c5181e 100644
--- a/users/drashna/oled_stuff.c
+++ b/users/drashna/oled_stuff.c
@@ -25,7 +25,7 @@
25#endif 25#endif
26 26
27uint32_t oled_timer = 0; 27uint32_t oled_timer = 0;
28static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"}; 28static char keylog_str[KEYLOGGER_LENGTH + 1] = { 0 };
29static uint16_t log_timer = 0; 29static uint16_t log_timer = 0;
30 30
31// clang-format off 31// clang-format off
@@ -57,12 +57,12 @@ void add_keylog(uint16_t keycode) {
57 keycode = 0; 57 keycode = 0;
58 } 58 }
59 59
60 for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) { 60 for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) {
61 keylog_str[i] = keylog_str[i - 1]; 61 keylog_str[i-1] = keylog_str[i];
62 } 62 }
63 63
64 if (keycode < (sizeof(code_to_name) / sizeof(char))) { 64 if (keycode < (sizeof(code_to_name) / sizeof(char))) {
65 keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); 65 keylog_str[(KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]);
66 } 66 }
67 67
68 log_timer = timer_read(); 68 log_timer = timer_read();
@@ -92,30 +92,14 @@ void render_keylogger_status(void) {
92void render_default_layer_state(void) { 92void render_default_layer_state(void) {
93 oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); 93 oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
94 switch (get_highest_layer(default_layer_state)) { 94 switch (get_highest_layer(default_layer_state)) {
95 case _QWERTY: 95 case _QWERTY: oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false); break;
96 oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false); 96 case _COLEMAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false); break;
97 break; 97 case _DVORAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); break;
98 case _COLEMAK: 98 case _WORKMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false); break;
99 oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false); 99 case _NORMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false); break;
100 break; 100 case _MALTRON: oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false); break;
101 case _DVORAK: 101 case _EUCALYN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false); break;
102 oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); 102 case _CARPLAX: oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false); break;
103 break;
104 case _WORKMAN:
105 oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false);
106 break;
107 case _NORMAN:
108 oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false);
109 break;
110 case _MALTRON:
111 oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false);
112 break;
113 case _EUCALYN:
114 oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false);
115 break;
116 case _CARPLAX:
117 oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false);
118 break;
119 } 103 }
120#ifdef OLED_DISPLAY_128X64 104#ifdef OLED_DISPLAY_128X64
121 oled_advance_page(true); 105 oled_advance_page(true);
@@ -159,12 +143,12 @@ void render_keylock_status(uint8_t led_usb_state) {
159} 143}
160void render_matrix_scan_rate(void) { 144void render_matrix_scan_rate(void) {
161#ifdef DEBUG_MATRIX_SCAN_RATE 145#ifdef DEBUG_MATRIX_SCAN_RATE
162 char matrix_rate[5]; 146 char matrix_rate[5];
163 uint16_t n = get_matrix_scan_rate(); 147 uint16_t n = get_matrix_scan_rate();
164 matrix_rate[4] = '\0'; 148 matrix_rate[4] = '\0';
165 matrix_rate[3] = '0' + n % 10; 149 matrix_rate[3] = '0' + n % 10;
166 matrix_rate[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 150 matrix_rate[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
167 matrix_rate[1] = n / 10 ? '0' + n / 10 : ' '; 151 matrix_rate[1] = n / 10 ? '0' + n / 10 : ' ';
168 matrix_rate[0] = ' '; 152 matrix_rate[0] = ' ';
169 oled_write_P(PSTR("MS:"), false); 153 oled_write_P(PSTR("MS:"), false);
170 oled_write(matrix_rate, false); 154 oled_write(matrix_rate, false);
@@ -284,6 +268,10 @@ void render_user_status(void) {
284 oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false); 268 oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false);
285 static const char PROGMEM nukem_good[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}}; 269 static const char PROGMEM nukem_good[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}};
286 oled_write_P(nukem_good[0], userspace_config.nuke_switch); 270 oled_write_P(nukem_good[0], userspace_config.nuke_switch);
271#if defined(UNICODE_ENABLE)
272 static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
273 oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false);
274#endif
287#if defined(OLED_DISPLAY_128X64) 275#if defined(OLED_DISPLAY_128X64)
288 oled_advance_page(true); 276 oled_advance_page(true);
289#endif 277#endif
@@ -306,34 +294,34 @@ void render_wpm(void) {
306 char wpm_counter[4]; 294 char wpm_counter[4];
307 wpm_counter[3] = '\0'; 295 wpm_counter[3] = '\0';
308 wpm_counter[2] = '0' + n % 10; 296 wpm_counter[2] = '0' + n % 10;
309 wpm_counter[1] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 297 wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
310 wpm_counter[0] = n / 10 ? '0' + n / 10 : ' '; 298 wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
311# else 299# else
312 char wpm_counter[6]; 300 char wpm_counter[6];
313 wpm_counter[5] = '\0'; 301 wpm_counter[5] = '\0';
314 wpm_counter[4] = '0' + n % 10; 302 wpm_counter[4] = '0' + n % 10;
315 wpm_counter[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 303 wpm_counter[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
316 wpm_counter[2] = n / 10 ? '0' + n / 10 : ' '; 304 wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
317 wpm_counter[1] = ' '; 305 wpm_counter[1] = ' ';
318 wpm_counter[0] = ' '; 306 wpm_counter[0] = ' ';
319 # endif 307# endif
320 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); 308 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
321 oled_write(wpm_counter, false); 309 oled_write(wpm_counter, false);
322#endif 310#endif
323} 311}
324 312
325#ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball 313#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
326extern keyboard_config_t keyboard_config; 314extern keyboard_config_t keyboard_config;
327extern uint16_t dpi_array[]; 315extern uint16_t dpi_array[];
328 316
329void render_pointing_dpi_status(void) { 317void render_pointing_dpi_status(void) {
330 char dpi_status[6]; 318 char dpi_status[6];
331 uint16_t n = dpi_array[keyboard_config.dpi_config]; 319 uint16_t n = dpi_array[keyboard_config.dpi_config];
332 dpi_status[5] = '\0'; 320 dpi_status[5] = '\0';
333 dpi_status[4] = '0' + n % 10; 321 dpi_status[4] = '0' + n % 10;
334 dpi_status[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 322 dpi_status[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
335 dpi_status[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 323 dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
336 dpi_status[1] = n / 10 ? '0' + n / 10 : ' '; 324 dpi_status[1] = n / 10 ? '0' + n / 10 : ' ';
337 dpi_status[0] = ' '; 325 dpi_status[0] = ' ';
338 oled_write_P(PSTR(" DPI: "), false); 326 oled_write_P(PSTR(" DPI: "), false);
339 oled_write(dpi_status, false); 327 oled_write(dpi_status, false);
@@ -360,7 +348,7 @@ void render_status_main(void) {
360# else 348# else
361 render_wpm(); 349 render_wpm();
362# endif 350# endif
363# ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball 351# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
364 render_pointing_dpi_status(); 352 render_pointing_dpi_status();
365# endif 353# endif
366 oled_write_P(PSTR("\n"), false); 354 oled_write_P(PSTR("\n"), false);
@@ -375,6 +363,15 @@ void render_status_main(void) {
375 render_keylogger_status(); 363 render_keylogger_status();
376} 364}
377 365
366__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; }
367
368oled_rotation_t oled_init_user(oled_rotation_t rotation) {
369 for (uint8_t i = 0; i < (KEYLOGGER_LENGTH - 1); i++) {
370 add_keylog(0);
371 }
372 return oled_init_keymap(rotation);
373}
374
378void oled_task_user(void) { 375void oled_task_user(void) {
379 update_log(); 376 update_log();
380 377
@@ -385,7 +382,7 @@ void oled_task_user(void) {
385 } else { 382 } else {
386 oled_on(); 383 oled_on();
387 } 384 }
388 render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) 385 render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
389 } else { 386 } else {
390 render_status_secondary(); 387 render_status_secondary();
391 } 388 }
diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h
index 1f4440bd4..ad9cf09ed 100644
--- a/users/drashna/oled_stuff.h
+++ b/users/drashna/oled_stuff.h
@@ -19,97 +19,98 @@
19#include "quantum.h" 19#include "quantum.h"
20#include "oled_driver.h" 20#include "oled_driver.h"
21 21
22void oled_driver_render_logo(void); 22void oled_driver_render_logo(void);
23bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); 23bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
24oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
24extern uint32_t oled_timer; 25extern uint32_t oled_timer;
25 26
26#ifdef OLED_DISPLAY_128X64 27#ifdef OLED_DISPLAY_128X64
27# define OLED_RENDER_KEYLOGGER "Keylogger: " 28# define OLED_RENDER_KEYLOGGER "Keylogger: "
28 29
29# define OLED_RENDER_LAYOUT_NAME "Layout: " 30# define OLED_RENDER_LAYOUT_NAME "Layout: "
30# define OLED_RENDER_LAYOUT_QWERTY "Qwerty" 31# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
31# define OLED_RENDER_LAYOUT_COLEMAK "Colemak" 32# define OLED_RENDER_LAYOUT_COLEMAK "Colemak"
32# define OLED_RENDER_LAYOUT_DVORAK "Dvorak" 33# define OLED_RENDER_LAYOUT_DVORAK "Dvorak"
33# define OLED_RENDER_LAYOUT_WORKMAN "Workman" 34# define OLED_RENDER_LAYOUT_WORKMAN "Workman"
34# define OLED_RENDER_LAYOUT_NORMAN "Norman" 35# define OLED_RENDER_LAYOUT_NORMAN "Norman"
35# define OLED_RENDER_LAYOUT_MALTRON "Matron" 36# define OLED_RENDER_LAYOUT_MALTRON "Matron"
36# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn" 37# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn"
37# define OLED_RENDER_LAYOUT_CARPLAX "Carplax" 38# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"
38 39
39# define OLED_RENDER_LAYER_NAME "Layer:" 40# define OLED_RENDER_LAYER_NAME "Layer:"
40# define OLED_RENDER_LAYER_LOWER "Lower" 41# define OLED_RENDER_LAYER_LOWER "Lower"
41# define OLED_RENDER_LAYER_RAISE "Raise" 42# define OLED_RENDER_LAYER_RAISE "Raise"
42# define OLED_RENDER_LAYER_ADJUST "Adjust" 43# define OLED_RENDER_LAYER_ADJUST "Adjust"
43# define OLED_RENDER_LAYER_MODS "Mods" 44# define OLED_RENDER_LAYER_MODS "Mods"
44 45
45# define OLED_RENDER_LOCK_NAME "Lock: " 46# define OLED_RENDER_LOCK_NAME "Lock: "
46# define OLED_RENDER_LOCK_NUML "NUML" 47# define OLED_RENDER_LOCK_NUML "NUML"
47# define OLED_RENDER_LOCK_CAPS "CAPS" 48# define OLED_RENDER_LOCK_CAPS "CAPS"
48# define OLED_RENDER_LOCK_SCLK "SCLK" 49# define OLED_RENDER_LOCK_SCLK "SCLK"
49 50
50# define OLED_RENDER_MODS_NAME "Mods:" 51# define OLED_RENDER_MODS_NAME "Mods:"
51# define OLED_RENDER_MODS_SFT "Sft" 52# define OLED_RENDER_MODS_SFT "Sft"
52# define OLED_RENDER_MODS_CTL "Ctl" 53# define OLED_RENDER_MODS_CTL "Ctl"
53# define OLED_RENDER_MODS_ALT "Alt" 54# define OLED_RENDER_MODS_ALT "Alt"
54# define OLED_RENDER_MODS_GUI "GUI" 55# define OLED_RENDER_MODS_GUI "GUI"
55 56
56# define OLED_RENDER_BOOTMAGIC_NAME "Boot " 57# define OLED_RENDER_BOOTMAGIC_NAME "Boot "
57# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" 58# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
58# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" 59# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
59# define OLED_RENDER_BOOTMAGIC_GRV "GRV" 60# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
60# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT" 61# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
61# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" 62# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
62# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" 63# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
63 64
64# define OLED_RENDER_USER_NAME "USER:" 65# define OLED_RENDER_USER_NAME "USER:"
65# define OLED_RENDER_USER_ANIM "Anim" 66# define OLED_RENDER_USER_ANIM "Anim"
66# define OLED_RENDER_USER_LAYR "Layr" 67# define OLED_RENDER_USER_LAYR "Layr"
67# define OLED_RENDER_USER_NUKE "Nuke" 68# define OLED_RENDER_USER_NUKE "Nuke"
68 69
69# define OLED_RENDER_WPM_COUNTER "WPM: " 70# define OLED_RENDER_WPM_COUNTER "WPM: "
70#else 71#else
71# define OLED_RENDER_KEYLOGGER "KLogr" 72# define OLED_RENDER_KEYLOGGER "KLogr"
72 73
73# define OLED_RENDER_LAYOUT_NAME "Lyout" 74# define OLED_RENDER_LAYOUT_NAME "Lyout"
74# define OLED_RENDER_LAYOUT_QWERTY " QRTY" 75# define OLED_RENDER_LAYOUT_QWERTY " QRTY"
75# define OLED_RENDER_LAYOUT_COLEMAK " COLE" 76# define OLED_RENDER_LAYOUT_COLEMAK " COLE"
76# define OLED_RENDER_LAYOUT_DVORAK " DVRK" 77# define OLED_RENDER_LAYOUT_DVORAK " DVRK"
77# define OLED_RENDER_LAYOUT_WORKMAN " WKMN" 78# define OLED_RENDER_LAYOUT_WORKMAN " WKMN"
78# define OLED_RENDER_LAYOUT_NORMAN " NORM" 79# define OLED_RENDER_LAYOUT_NORMAN " NORM"
79# define OLED_RENDER_LAYOUT_MALTRON " MLTN" 80# define OLED_RENDER_LAYOUT_MALTRON " MLTN"
80# define OLED_RENDER_LAYOUT_EUCALYN " ECLN" 81# define OLED_RENDER_LAYOUT_EUCALYN " ECLN"
81# define OLED_RENDER_LAYOUT_CARPLAX " CRPX" 82# define OLED_RENDER_LAYOUT_CARPLAX " CRPX"
82 83
83# define OLED_RENDER_LAYER_NAME "LAYER" 84# define OLED_RENDER_LAYER_NAME "LAYER"
84# define OLED_RENDER_LAYER_LOWER "Lower" 85# define OLED_RENDER_LAYER_LOWER "Lower"
85# define OLED_RENDER_LAYER_RAISE "Raise" 86# define OLED_RENDER_LAYER_RAISE "Raise"
86# define OLED_RENDER_LAYER_ADJUST "Adjst" 87# define OLED_RENDER_LAYER_ADJUST "Adjst"
87# define OLED_RENDER_LAYER_MODS " Mods" 88# define OLED_RENDER_LAYER_MODS " Mods"
88 89
89# define OLED_RENDER_LOCK_NAME "Lock:" 90# define OLED_RENDER_LOCK_NAME "Lock:"
90# define OLED_RENDER_LOCK_NUML "NumL" 91# define OLED_RENDER_LOCK_NUML "NumL"
91# define OLED_RENDER_LOCK_CAPS "CapL" 92# define OLED_RENDER_LOCK_CAPS "CapL"
92# define OLED_RENDER_LOCK_SCLK "ScrL" 93# define OLED_RENDER_LOCK_SCLK "ScrL"
93 94
94# define OLED_RENDER_MODS_NAME "Mods: " 95# define OLED_RENDER_MODS_NAME "Mods: "
95# define OLED_RENDER_MODS_SFT "Shft" 96# define OLED_RENDER_MODS_SFT "Shft"
96# define OLED_RENDER_MODS_CTL "Ctrl" 97# define OLED_RENDER_MODS_CTL "Ctrl"
97# define OLED_RENDER_MODS_ALT "Alt\n" 98# define OLED_RENDER_MODS_ALT "Alt\n"
98# define OLED_RENDER_MODS_GUI "GUI\n" 99# define OLED_RENDER_MODS_GUI "GUI\n"
99 100
100# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK" 101# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK"
101# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" 102# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
102# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" 103# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
103# define OLED_RENDER_BOOTMAGIC_GRV "GRV" 104# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
104# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT" 105# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
105# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" 106# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
106# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" 107# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
107 108
108# define OLED_RENDER_USER_NAME "USER:" 109# define OLED_RENDER_USER_NAME "USER:"
109# define OLED_RENDER_USER_ANIM "Anim" 110# define OLED_RENDER_USER_ANIM "Anim"
110# define OLED_RENDER_USER_LAYR "Layr" 111# define OLED_RENDER_USER_LAYR "Layr"
111# define OLED_RENDER_USER_NUKE "Nuke" 112# define OLED_RENDER_USER_NUKE "Nuke"
112 113
113# define OLED_RENDER_WPM_COUNTER "WPM: " 114# define OLED_RENDER_WPM_COUNTER "WPM: "
114 115
115#endif 116#endif
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index ef901226e..124354a5b 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -29,10 +29,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
29 // If console is enabled, it will print the matrix position and status of each key pressed 29 // If console is enabled, it will print the matrix position and status of each key pressed
30#ifdef KEYLOGGER_ENABLE 30#ifdef KEYLOGGER_ENABLE
31 uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); 31 uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
32#endif // KEYLOGGER_ENABLE 32#endif // KEYLOGGER_ENABLE
33#ifdef OLED_DRIVER_ENABLE 33#ifdef OLED_DRIVER_ENABLE
34 process_record_user_oled(keycode, record); 34 process_record_user_oled(keycode, record);
35#endif // OLED 35#endif // OLED
36 36
37 if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record) 37 if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
38#ifdef RGB_MATRIX_ENABLE 38#ifdef RGB_MATRIX_ENABLE
@@ -59,7 +59,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
59 } 59 }
60 break; 60 break;
61 61
62 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader 62 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
63 if (!record->event.pressed) { 63 if (!record->event.pressed) {
64#ifndef MAKE_BOOTLOADER 64#ifndef MAKE_BOOTLOADER
65 uint8_t temp_mod = mod_config(get_mods()); 65 uint8_t temp_mod = mod_config(get_mods());
@@ -90,56 +90,44 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
90 90
91 break; 91 break;
92 92
93 case VRSN: // Prints firmware version 93 case VRSN: // Prints firmware version
94 if (record->event.pressed) { 94 if (record->event.pressed) { send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); }
95 send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
96 }
97 break; 95 break;
98 96
99 case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them 97 case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
100#ifdef TAP_DANCE_ENABLE 98#ifdef TAP_DANCE_ENABLE
101 if (record->event.pressed) { 99 if (record->event.pressed) {
102 for (uint8_t index = 0; index < 4; index++) { 100 for (uint8_t index = 0; index < 4; index++) { diablo_timer[index].key_interval = 0; }
103 diablo_timer[index].key_interval = 0;
104 }
105 } 101 }
106#endif // TAP_DANCE_ENABLE 102#endif // TAP_DANCE_ENABLE
107 break; 103 break;
108 104
109 case KC_CCCV: // One key copy/paste 105 case KC_CCCV: // One key copy/paste
110 if (record->event.pressed) { 106 if (record->event.pressed) {
111 copy_paste_timer = timer_read(); 107 copy_paste_timer = timer_read();
112 } else { 108 } else {
113 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy 109 if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
114 tap_code16(LCTL(KC_C)); 110 tap_code16(LCTL(KC_C));
115 } else { // Tap, paste 111 } else { // Tap, paste
116 tap_code16(LCTL(KC_V)); 112 tap_code16(LCTL(KC_V));
117 } 113 }
118 } 114 }
119 break; 115 break;
120#ifdef UNICODE_ENABLE 116#ifdef UNICODE_ENABLE
121 case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ 117 case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
122 if (record->event.pressed) { 118 if (record->event.pressed) { send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); }
123 send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
124 }
125 break; 119 break;
126 case UC_TABL: // ┬─┬ノ( º _ ºノ) 120 case UC_TABL: // ┬─┬ノ( º _ ºノ)
127 if (record->event.pressed) { 121 if (record->event.pressed) { send_unicode_string("┬─┬ノ( º _ ºノ)"); }
128 send_unicode_string("┬─┬ノ( º _ ºノ)");
129 }
130 break; 122 break;
131 case UC_SHRG: // ¯\_(ツ)_/¯ 123 case UC_SHRG: // ¯\_(ツ)_/¯
132 if (record->event.pressed) { 124 if (record->event.pressed) { send_unicode_string("¯\\_(ツ)_/¯"); }
133 send_unicode_string("¯\\_(ツ)_/¯");
134 }
135 break; 125 break;
136 case UC_DISA: // ಠ_ಠ 126 case UC_DISA: // ಠ_ಠ
137 if (record->event.pressed) { 127 if (record->event.pressed) { send_unicode_string("ಠ_ಠ"); }
138 send_unicode_string("ಠ_ಠ");
139 }
140 break; 128 break;
141#endif 129#endif
142 case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal 130 case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
143#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) 131#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
144 if (record->event.pressed) { 132 if (record->event.pressed) {
145 userspace_config.rgb_layer_change ^= 1; 133 userspace_config.rgb_layer_change ^= 1;
@@ -149,14 +137,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
149# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) 137# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
150 rgblight_enable_noeeprom(); 138 rgblight_enable_noeeprom();
151# endif 139# endif
152 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) 140 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
153# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) 141# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
154 } else { 142 } else {
155 rgblight_disable_noeeprom(); 143 rgblight_disable_noeeprom();
156# endif 144# endif
157 } 145 }
158 } 146 }
159#endif // RGBLIGHT_ENABLE 147#endif // RGBLIGHT_ENABLE
160 break; 148 break;
161 149
162#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) 150#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
@@ -176,7 +164,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
176 } 164 }
177 return false; 165 return false;
178 break; 166 break;
179 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions 167 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
180 if (record->event.pressed) { 168 if (record->event.pressed) {
181 bool is_eeprom_updated; 169 bool is_eeprom_updated;
182# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) 170# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
@@ -194,9 +182,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
194 is_eeprom_updated = true; 182 is_eeprom_updated = true;
195 } 183 }
196# endif 184# endif
197 if (is_eeprom_updated) { 185 if (is_eeprom_updated) { eeconfig_update_user(userspace_config.raw); }
198 eeconfig_update_user(userspace_config.raw);
199 }
200 } 186 }
201#endif 187#endif
202 } 188 }
diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h
index f60e6d7eb..f65cfc03c 100644
--- a/users/drashna/process_records.h
+++ b/users/drashna/process_records.h
@@ -17,58 +17,58 @@
17#pragma once 17#pragma once
18#include "drashna.h" 18#include "drashna.h"
19 19
20#if defined(KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball) 20#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
21# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE 21# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
22#else 22#else
23# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE 23# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
24#endif 24#endif
25 25
26enum userspace_custom_keycodes { 26enum userspace_custom_keycodes {
27 VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info 27 VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info
28 KC_QWERTY, // Sets default layer to QWERTY 28 KC_QWERTY, // Sets default layer to QWERTY
29 KC_COLEMAK, // Sets default layer to COLEMAK 29 KC_COLEMAK, // Sets default layer to COLEMAK
30 KC_DVORAK, // Sets default layer to DVORAK 30 KC_DVORAK, // Sets default layer to DVORAK
31 KC_WORKMAN, // Sets default layer to WORKMAN 31 KC_WORKMAN, // Sets default layer to WORKMAN
32 KC_DIABLO_CLEAR, // Clears all Diablo Timers 32 KC_DIABLO_CLEAR, // Clears all Diablo Timers
33 KC_MAKE, // Run keyboard's customized make command 33 KC_MAKE, // Run keyboard's customized make command
34 KC_RGB_T, // Toggles RGB Layer Indication mode 34 KC_RGB_T, // Toggles RGB Layer Indication mode
35 RGB_IDL, // RGB Idling animations 35 RGB_IDL, // RGB Idling animations
36 KC_SECRET_1, // test1 36 KC_SECRET_1, // test1
37 KC_SECRET_2, // test2 37 KC_SECRET_2, // test2
38 KC_SECRET_3, // test3 38 KC_SECRET_3, // test3
39 KC_SECRET_4, // test4 39 KC_SECRET_4, // test4
40 KC_SECRET_5, // test5 40 KC_SECRET_5, // test5
41 KC_CCCV, // Hold to copy, tap to paste 41 KC_CCCV, // Hold to copy, tap to paste
42 KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! 42 KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
43 UC_FLIP, // (ಠ痊ಠ)┻━┻ 43 UC_FLIP, // (ಠ痊ಠ)┻━┻
44 UC_TABL, // ┬─┬ノ( º _ ºノ) 44 UC_TABL, // ┬─┬ノ( º _ ºノ)
45 UC_SHRG, // ¯\_(ツ)_/¯ 45 UC_SHRG, // ¯\_(ツ)_/¯
46 UC_DISA, // ಠ_ಠ 46 UC_DISA, // ಠ_ಠ
47 NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes 47 NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
48}; 48};
49 49
50bool process_record_secrets(uint16_t keycode, keyrecord_t *record); 50bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
51bool process_record_keymap(uint16_t keycode, keyrecord_t *record); 51bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
52 52
53#define LOWER MO(_LOWER) 53#define LOWER MO(_LOWER)
54#define RAISE MO(_RAISE) 54#define RAISE MO(_RAISE)
55#define ADJUST MO(_ADJUST) 55#define ADJUST MO(_ADJUST)
56#define TG_MODS OS_TOGG 56#define TG_MODS OS_TOGG
57#define TG_GAME TG(_GAMEPAD) 57#define TG_GAME TG(_GAMEPAD)
58#define TG_DBLO TG(_DIABLO) 58#define TG_DBLO TG(_DIABLO)
59#define OS_LWR OSL(_LOWER) 59#define OS_LWR OSL(_LOWER)
60#define OS_RSE OSL(_RAISE) 60#define OS_RSE OSL(_RAISE)
61 61
62#define KC_SEC1 KC_SECRET_1 62#define KC_SEC1 KC_SECRET_1
63#define KC_SEC2 KC_SECRET_2 63#define KC_SEC2 KC_SECRET_2
64#define KC_SEC3 KC_SECRET_3 64#define KC_SEC3 KC_SECRET_3
65#define KC_SEC4 KC_SECRET_4 65#define KC_SEC4 KC_SECRET_4
66#define KC_SEC5 KC_SECRET_5 66#define KC_SEC5 KC_SECRET_5
67 67
68#define QWERTY KC_QWERTY 68#define QWERTY KC_QWERTY
69#define DVORAK KC_DVORAK 69#define DVORAK KC_DVORAK
70#define COLEMAK KC_COLEMAK 70#define COLEMAK KC_COLEMAK
71#define WORKMAN KC_WORKMAN 71#define WORKMAN KC_WORKMAN
72 72
73#define KC_RESET RESET 73#define KC_RESET RESET
74#define KC_RST KC_RESET 74#define KC_RST KC_RESET
@@ -77,9 +77,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
77# define KC_C1R3 SH_T(KC_TAB) 77# define KC_C1R3 SH_T(KC_TAB)
78#elif defined(DRASHNA_LP) 78#elif defined(DRASHNA_LP)
79# define KC_C1R3 TG(_GAMEPAD) 79# define KC_C1R3 TG(_GAMEPAD)
80#else // SWAP_HANDS_ENABLE 80#else // SWAP_HANDS_ENABLE
81# define KC_C1R3 KC_TAB 81# define KC_C1R3 KC_TAB
82#endif // SWAP_HANDS_ENABLE 82#endif // SWAP_HANDS_ENABLE
83 83
84#define BK_LWER LT(_LOWER, KC_BSPC) 84#define BK_LWER LT(_LOWER, KC_BSPC)
85#define SP_LWER LT(_LOWER, KC_SPC) 85#define SP_LWER LT(_LOWER, KC_SPC)
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c
index 9e9e1e427..9fbe6214b 100644
--- a/users/drashna/rgb_matrix_stuff.c
+++ b/users/drashna/rgb_matrix_stuff.c
@@ -28,33 +28,27 @@ static uint32_t hypno_timer;
28 28
29void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) { 29void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) {
30 HSV hsv = {hue, sat, val}; 30 HSV hsv = {hue, sat, val};
31 if (hsv.v > rgb_matrix_get_val()) { 31 if (hsv.v > rgb_matrix_get_val()) { hsv.v = rgb_matrix_get_val(); }
32 hsv.v = rgb_matrix_get_val();
33 }
34 32
35 switch (mode) { 33 switch (mode) {
36 case 1: // breathing 34 case 1: // breathing
37 { 35 {
38 uint16_t time = scale16by8(g_rgb_timer, speed / 8); 36 uint16_t time = scale16by8(g_rgb_timer, speed / 8);
39 hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); 37 hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
40 RGB rgb = hsv_to_rgb(hsv); 38 RGB rgb = hsv_to_rgb(hsv);
41 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { 39 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
42 if (HAS_FLAGS(g_led_config.flags[i], led_type)) { 40 if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); }
43 RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
44 } 41 }
42 break;
45 } 43 }
46 break; 44 default: // Solid Color
47 } 45 {
48 default: // Solid Color 46 RGB rgb = hsv_to_rgb(hsv);
49 { 47 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
50 RGB rgb = hsv_to_rgb(hsv); 48 if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); }
51 for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
52 if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
53 RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
54 } 49 }
50 break;
55 } 51 }
56 break;
57 }
58 } 52 }
59} 53}
60 54
@@ -62,38 +56,30 @@ __attribute__((weak)) void rgb_matrix_indicator_keymap(void) {}
62 56
63void matrix_scan_rgb_matrix(void) { 57void matrix_scan_rgb_matrix(void) {
64#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 58#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
65 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) { 59 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) { rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); }
66 rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
67 }
68#endif 60#endif
69 rgb_matrix_indicator_keymap(); 61 rgb_matrix_indicator_keymap();
70} 62}
71 63
72void keyboard_post_init_rgb_matrix(void) { 64void keyboard_post_init_rgb_matrix(void) {
73#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 65#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
74 if (userspace_config.rgb_matrix_idle_anim) { 66 if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); }
75 rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
76 }
77#endif 67#endif
78} 68}
79 69
80bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { 70bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
81#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 71#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
82 hypno_timer = sync_timer_read32(); 72 hypno_timer = sync_timer_read32();
83 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { 73 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); }
84 rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
85 }
86#endif 74#endif
87 switch (keycode) { 75 switch (keycode) {
88 case RGB_IDL: // This allows me to use underglow as layer indication, or as normal 76 case RGB_IDL: // This allows me to use underglow as layer indication, or as normal
89#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 77#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
90 if (record->event.pressed) { 78 if (record->event.pressed) {
91 userspace_config.rgb_matrix_idle_anim ^= 1; 79 userspace_config.rgb_matrix_idle_anim ^= 1;
92 dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); 80 dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
93 eeconfig_update_user(userspace_config.raw); 81 eeconfig_update_user(userspace_config.raw);
94 if (userspace_config.rgb_matrix_idle_anim) { 82 if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); }
95 rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
96 }
97 } 83 }
98#endif 84#endif
99 break; 85 break;
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 6723ad4bf..1665638cf 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -28,7 +28,7 @@ void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight
28static rgblight_fadeout lights[RGBLED_NUM]; 28static rgblight_fadeout lights[RGBLED_NUM];
29 29
30/* Handler for fading/twinkling effect */ 30/* Handler for fading/twinkling effect */
31void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive 31void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
32 bool litup = false; 32 bool litup = false;
33 33
34 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) { 34 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
@@ -38,21 +38,15 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rg
38 38
39 if (light->life) { 39 if (light->life) {
40 light->life -= 1; 40 light->life -= 1;
41 if (get_highest_layer(layer_state) == 0) { 41 if (get_highest_layer(layer_state) == 0) { sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); }
42 sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
43 }
44 light->timer = sync_timer_read(); 42 light->timer = sync_timer_read();
45 } else { 43 } else {
46 if (light->enabled && get_highest_layer(layer_state) == 0) { 44 if (light->enabled && get_highest_layer(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); }
47 rgblight_sethsv_default_helper(light_index);
48 }
49 litup = light->enabled = false; 45 litup = light->enabled = false;
50 } 46 }
51 } 47 }
52 } 48 }
53 if (litup && get_highest_layer(layer_state) == 0) { 49 if (litup && get_highest_layer(layer_state) == 0) { rgblight_set(); }
54 rgblight_set();
55 }
56} 50}
57 51
58/* Triggers a LED to fade/twinkle. 52/* Triggers a LED to fade/twinkle.
@@ -98,9 +92,7 @@ void start_rgb_light(void) {
98bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { 92bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
99 uint16_t temp_keycode = keycode; 93 uint16_t temp_keycode = keycode;
100 // Filter out the actual keycode from MT and LT keys. 94 // Filter out the actual keycode from MT and LT keys.
101 if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { 95 if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { temp_keycode &= 0xFF; }
102 temp_keycode &= 0xFF;
103 }
104 96
105 switch (temp_keycode) { 97 switch (temp_keycode) {
106# ifdef RGBLIGHT_TWINKLE 98# ifdef RGBLIGHT_TWINKLE
@@ -110,11 +102,9 @@ bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
110 case KC_KP_SLASH ... KC_KP_DOT: 102 case KC_KP_SLASH ... KC_KP_DOT:
111 case KC_F13 ... KC_F24: 103 case KC_F13 ... KC_F24:
112 case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: 104 case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
113 if (record->event.pressed) { 105 if (record->event.pressed) { start_rgb_light(); }
114 start_rgb_light();
115 }
116 break; 106 break;
117# endif // RGBLIGHT_TWINKLE 107# endif // RGBLIGHT_TWINKLE
118 } 108 }
119 return true; 109 return true;
120} 110}
@@ -129,9 +119,7 @@ static uint16_t rgblight_startup_loop_timer;
129void keyboard_post_init_rgb_light(void) { 119void keyboard_post_init_rgb_light(void) {
130# if defined(RGBLIGHT_STARTUP_ANIMATION) 120# if defined(RGBLIGHT_STARTUP_ANIMATION)
131 is_enabled = rgblight_is_enabled(); 121 is_enabled = rgblight_is_enabled();
132 if (userspace_config.rgb_layer_change) { 122 if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }
133 rgblight_enable_noeeprom();
134 }
135 if (rgblight_is_enabled()) { 123 if (rgblight_is_enabled()) {
136 layer_state_set_rgb_light(layer_state); 124 layer_state_set_rgb_light(layer_state);
137 old_hue = rgblight_get_hue(); 125 old_hue = rgblight_get_hue();
@@ -145,7 +133,7 @@ void keyboard_post_init_rgb_light(void) {
145void matrix_scan_rgb_light(void) { 133void matrix_scan_rgb_light(void) {
146# ifdef RGBLIGHT_TWINKLE 134# ifdef RGBLIGHT_TWINKLE
147 scan_rgblight_fadeout(); 135 scan_rgblight_fadeout();
148# endif // RGBLIGHT_ENABLE 136# endif // RGBLIGHT_ENABLE
149 137
150# if defined(RGBLIGHT_STARTUP_ANIMATION) 138# if defined(RGBLIGHT_STARTUP_ANIMATION)
151 if (is_rgblight_startup && is_keyboard_master()) { 139 if (is_rgblight_startup && is_keyboard_master()) {
@@ -156,12 +144,8 @@ void matrix_scan_rgb_light(void) {
156 rgblight_startup_loop_timer = sync_timer_read(); 144 rgblight_startup_loop_timer = sync_timer_read();
157 if (counter == 255) { 145 if (counter == 255) {
158 is_rgblight_startup = false; 146 is_rgblight_startup = false;
159 if (!is_enabled) { 147 if (!is_enabled) { rgblight_disable_noeeprom(); }
160 rgblight_disable_noeeprom(); 148 if (userspace_config.rgb_layer_change) { layer_state_set_rgb_light(layer_state); }
161 }
162 if (userspace_config.rgb_layer_change) {
163 layer_state_set_rgb_light(layer_state);
164 }
165 } 149 }
166 } 150 }
167 } 151 }
@@ -179,55 +163,25 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) {
179 if (userspace_config.rgb_layer_change) { 163 if (userspace_config.rgb_layer_change) {
180 switch (get_highest_layer(state | default_layer_state)) { 164 switch (get_highest_layer(state | default_layer_state)) {
181 case _MACROS: // mouse 165 case _MACROS: // mouse
182 if (!layer_state_cmp(state, _GAMEPAD) && !layer_state_cmp(state, _DIABLO)) { 166 if (!layer_state_cmp(state, _GAMEPAD) && !layer_state_cmp(state, _DIABLO)) { rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3); }
183 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3);
184 }
185 break;
186 case _MEDIA:
187 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1);
188 break;
189 case _GAMEPAD:
190 rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2);
191 break;
192 case _DIABLO:
193 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3);
194 break;
195 case _RAISE:
196 rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3);
197 break;
198 case _LOWER:
199 rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3);
200 break;
201 case _ADJUST:
202 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2);
203 break;
204 case _COLEMAK:
205 rgblight_set_hsv_and_mode(HSV_MAGENTA, RGBLIGHT_MODE_STATIC_LIGHT);
206 break;
207 case _DVORAK:
208 rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, RGBLIGHT_MODE_STATIC_LIGHT);
209 break;
210 case _WORKMAN:
211 rgblight_set_hsv_and_mode(HSV_GOLDENROD, RGBLIGHT_MODE_STATIC_LIGHT);
212 break;
213 case _NORMAN:
214 rgblight_set_hsv_and_mode(HSV_CORAL, RGBLIGHT_MODE_STATIC_LIGHT);
215 break;
216 case _MALTRON:
217 rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_STATIC_LIGHT);
218 break;
219 case _EUCALYN:
220 rgblight_set_hsv_and_mode(HSV_PINK, RGBLIGHT_MODE_STATIC_LIGHT);
221 break;
222 case _CARPLAX:
223 rgblight_set_hsv_and_mode(HSV_BLUE, RGBLIGHT_MODE_STATIC_LIGHT);
224 break;
225 default:
226 rgblight_set_hsv_and_mode(HSV_CYAN, RGBLIGHT_MODE_STATIC_LIGHT);
227 break; 167 break;
168 case _MEDIA: rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1); break;
169 case _GAMEPAD: rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2); break;
170 case _DIABLO: rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3); break;
171 case _RAISE: rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3); break;
172 case _LOWER: rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3); break;
173 case _ADJUST: rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); break;
174 case _COLEMAK: rgblight_set_hsv_and_mode(HSV_MAGENTA, RGBLIGHT_MODE_STATIC_LIGHT); break;
175 case _DVORAK: rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, RGBLIGHT_MODE_STATIC_LIGHT); break;
176 case _WORKMAN: rgblight_set_hsv_and_mode(HSV_GOLDENROD, RGBLIGHT_MODE_STATIC_LIGHT); break;
177 case _NORMAN: rgblight_set_hsv_and_mode(HSV_CORAL, RGBLIGHT_MODE_STATIC_LIGHT); break;
178 case _MALTRON: rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_STATIC_LIGHT); break;
179 case _EUCALYN: rgblight_set_hsv_and_mode(HSV_PINK, RGBLIGHT_MODE_STATIC_LIGHT); break;
180 case _CARPLAX: rgblight_set_hsv_and_mode(HSV_BLUE, RGBLIGHT_MODE_STATIC_LIGHT); break;
181 default: rgblight_set_hsv_and_mode(HSV_CYAN, RGBLIGHT_MODE_STATIC_LIGHT); break;
228 } 182 }
229 } 183 }
230# endif // RGBLIGHT_ENABLE 184# endif // RGBLIGHT_ENABLE
231 185
232 return state; 186 return state;
233} 187}
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index fa4fb2420..b9156f6a4 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -80,28 +80,29 @@ endif
80 80
81CUSTOM_SPLIT_TRANSPORT ?= yes 81CUSTOM_SPLIT_TRANSPORT ?= yes
82ifeq ($(strip $(SPLIT_KEYBOARD)), yes) 82ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
83 ifneq ($(strip $(SPLIT_TRANSPORT)), custom) 83 QUANTUM_LIB_SRC += transport_sync.c
84 ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT)), yes) 84 # ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
85 SPLIT_TRANSPORT = custom 85 # ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT)), yes)
86 QUANTUM_LIB_SRC += drashna_transport.c 86 # SPLIT_TRANSPORT = custom
87 OPT_DEFS += -DDRASHNA_CUSTOM_TRANSPORT 87 # QUANTUM_LIB_SRC += drashna_transport.c
88 # Unused functions are pruned away, which is why we can add multiple drivers here without bloat. 88 # OPT_DEFS += -DDRASHNA_CUSTOM_TRANSPORT
89 ifeq ($(PLATFORM),AVR) 89 # # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
90 ifneq ($(NO_I2C),yes) 90 # ifeq ($(PLATFORM),AVR)
91 QUANTUM_LIB_SRC += i2c_master.c \ 91 # ifneq ($(NO_I2C),yes)
92 i2c_slave.c 92 # QUANTUM_LIB_SRC += i2c_master.c \
93 endif 93 # i2c_slave.c
94 endif 94 # endif
95 # endif
95 96
96 SERIAL_DRIVER ?= bitbang 97 # SERIAL_DRIVER ?= bitbang
97 OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]')) 98 # OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]'))
98 ifeq ($(strip $(SERIAL_DRIVER)), bitbang) 99 # ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
99 QUANTUM_LIB_SRC += serial.c 100 # QUANTUM_LIB_SRC += serial.c
100 else 101 # else
101 QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c 102 # QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
102 endif 103 # endif
103 endif 104 # endif
104 endif 105 # endif
105endif 106endif
106 107
107# DEBUG_MATRIX_SCAN_RATE_ENABLE = api 108# DEBUG_MATRIX_SCAN_RATE_ENABLE = api
diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c
index 01873489d..6b27afc5a 100644
--- a/users/drashna/tap_dances.c
+++ b/users/drashna/tap_dances.c
@@ -26,7 +26,7 @@ uint8_t diablo_times[] = {0, 1, 3, 5, 10, 30};
26 26
27// Cycle through the times for the macro, starting at 0, for disabled. 27// Cycle through the times for the macro, starting at 0, for disabled.
28void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { 28void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) {
29 diable_keys_t *diablo_keys = (diable_keys_t *)user_data; 29 diable_keys_t *diablo_keys = (diable_keys_t *)user_data;
30 // Sets the keycode based on the index 30 // Sets the keycode based on the index
31 diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; 31 diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode;
32 32
@@ -34,7 +34,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) {
34 if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) { 34 if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) {
35 diablo_timer[diablo_keys->index].key_interval = 0; 35 diablo_timer[diablo_keys->index].key_interval = 0;
36 reset_tap_dance(state); 36 reset_tap_dance(state);
37 } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) 37 } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one)
38 diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1]; 38 diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1];
39 } 39 }
40} 40}
@@ -64,9 +64,7 @@ void run_diablo_macro_check(void) {
64 // reset the timer, since enough time has passed 64 // reset the timer, since enough time has passed
65 diablo_timer[index].timer = timer_read(); 65 diablo_timer[index].timer = timer_read();
66 // send keycode ONLY if we're on the diablo layer. 66 // send keycode ONLY if we're on the diablo layer.
67 if (IS_LAYER_ON(_DIABLO)) { 67 if (IS_LAYER_ON(_DIABLO)) { tap_code(diablo_timer[index].keycode); }
68 tap_code(diablo_timer[index].keycode);
69 }
70 } 68 }
71 } 69 }
72} 70}
diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h
index 7f73f2803..182cc6756 100644
--- a/users/drashna/tap_dances.h
+++ b/users/drashna/tap_dances.h
@@ -43,4 +43,4 @@ enum {
43 TD_D3_4 43 TD_D3_4
44}; 44};
45// clang-format on 45// clang-format on
46#endif // TAP_DANCE_ENABLE 46#endif // TAP_DANCE_ENABLE
diff --git a/users/drashna/template.c b/users/drashna/template.c
index f98964ae4..636955c43 100644
--- a/users/drashna/template.c
+++ b/users/drashna/template.c
@@ -54,9 +54,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
54 break; 54 break;
55 55
56 case VRSN: 56 case VRSN:
57 if (record->event.pressed) { 57 if (record->event.pressed) { SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); }
58 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
59 }
60 return false; 58 return false;
61 break; 59 break;
62 } 60 }
@@ -89,7 +87,7 @@ __attribute__((weak)) void startup_keymap(void) {}
89void startup_user(void) { 87void startup_user(void) {
90#ifdef RGBLIGHT_ENABLE 88#ifdef RGBLIGHT_ENABLE
91 matrix_init_rgb(); 89 matrix_init_rgb();
92#endif // RGBLIGHT_ENABLE 90#endif // RGBLIGHT_ENABLE
93 startup_keymap(); 91 startup_keymap();
94} 92}
95 93
diff --git a/users/drashna/template.h b/users/drashna/template.h
index cb1ad75d8..e00a0530e 100644
--- a/users/drashna/template.h
+++ b/users/drashna/template.h
@@ -24,8 +24,8 @@
24#define BASE 0 24#define BASE 0
25 25
26enum custom_keycodes { 26enum custom_keycodes {
27 VRSN = SAFE_RANGE, // can always be here 27 VRSN = SAFE_RANGE, // can always be here
28 KC_MAKE, 28 KC_MAKE,
29 KC_RESET, 29 KC_RESET,
30 NEWPLACEHOLDER // use "NEWPLACEHOLDER for keymap specific codes 30 NEWPLACEHOLDER // use "NEWPLACEHOLDER for keymap specific codes
31}; 31};
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c
new file mode 100644
index 000000000..baa1f7651
--- /dev/null
+++ b/users/drashna/transport_sync.c
@@ -0,0 +1,80 @@
1#ifdef SPLIT_TRANSACTION_IDS_USER
2#include "transport_sync.h"
3#include "transactions.h"
4#include <string.h>
5
6typedef struct {
7 bool oled_on;
8 uint16_t keymap_config;
9} user_runtime_config_t;
10
11user_runtime_config_t user_state;
12
13void user_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
14 if (initiator2target_buffer_size == sizeof(user_state)) {
15 memcpy(&user_state, initiator2target_buffer, initiator2target_buffer_size);
16 }
17}
18
19void keyboard_post_init_transport_sync(void) {
20 // Register keyboard state sync split transaction
21 transaction_register_rpc(RPC_ID_USER_STATE_SYNC, user_sync);
22}
23
24void user_state_update(void) {
25 if (is_keyboard_master()) {
26
27#ifdef OLED_DRIVER_ENABLE
28 user_state.oled_on = is_oled_on();
29#endif
30
31 user_state.keymap_config = keymap_config.raw;
32 } else {
33#ifdef OLED_DRIVER_ENABLE
34 if (user_state.oled_on) {
35 oled_on();
36 } else {
37 oled_off();
38 }
39#endif
40 if (keymap_config.raw != user_state.keymap_config) {
41 keymap_config.raw = user_state.keymap_config;
42 }
43 }
44}
45
46void user_state_sync(void) {
47 if (is_keyboard_master()) {
48 // Keep track of the last state, so that we can tell if we need to propagate to slave
49 static user_runtime_config_t last_user_state;
50 static uint32_t last_sync;
51 bool needs_sync = false;
52
53 // Check if the state values are different
54 if (memcmp(&user_state, &last_user_state, sizeof(user_state))) {
55 needs_sync = true;
56 memcpy(&last_user_state, &user_state, sizeof(user_state));
57 }
58
59 // Send to slave every 500ms regardless of state change
60 if (timer_elapsed32(last_sync) > 250) {
61 needs_sync = true;
62 }
63
64 // Perform the sync if requested
65 if (needs_sync) {
66 if (transaction_rpc_send(RPC_ID_USER_STATE_SYNC, sizeof(user_state), &user_state)) {
67 last_sync = timer_read32();
68 }
69 }
70 }
71}
72
73void housekeeping_task_user(void) {
74 // Update kb_state so we can send to slave
75 user_state_update();
76
77 // Data sync from master to slave
78 user_state_sync();
79}
80#endif
diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h b/users/drashna/transport_sync.h
index 5bad6bcab..e2b3eae76 100644
--- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h
+++ b/users/drashna/transport_sync.h
@@ -1,3 +1,4 @@
1
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> 2/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 * 3 *
3 * This program is free software: you can redistribute it and/or modify 4 * This program is free software: you can redistribute it and/or modify
@@ -14,9 +15,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 16 */
16 17
17
18
19#pragma once 18#pragma once
20 19
20#include "drashna.h"
21 21
22#include "../drashna/config.h" 22void keyboard_post_init_transport_sync(void);