Skip to content

Commit 4461355

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents ccc2030 + 5b5b364 commit 4461355

File tree

17 files changed

+459
-98
lines changed

17 files changed

+459
-98
lines changed

keyboards/handwired/tractyl_manuform/5x6_right/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5151
#define NO_ACTION_FUNCTION
5252

5353
#define OLED_DISPLAY_128X64
54+
55+
#define POINTING_DEVICE_TASK_THROTTLE
56+
#define POINTING_DEVICE_RIGHT

keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BOOTLOADER = stm32-dfu
66

77
KEYBOARD_SHARED_EP = yes
88
CONSOLE_ENABLE = yes
9-
MOUSE_SHARED_EP = no
9+
MOUSE_SHARED_EP = yes
1010

1111
EEPROM_DRIVER = spi
1212
WS2812_DRIVER = pwm

keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
#define TRACKBALL_DPI_OPTIONS { 1200, 1800, 2600, 3400 }
2020

2121
#define DEBOUNCE 45
22+
#define ENCODER_DEFAULT_POS 0x3

keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
125125
_______, _______, _______, _______
126126
),
127127
[_ADJUST] = LAYOUT_5x6_right_wrapper(
128-
KC_MAKE, ___________________BLANK___________________, _________________ADJUST_R1_________________, KC_RST,
128+
KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE, KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST,
129129
VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST,
130130
KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS,
131131
UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
@@ -407,9 +407,9 @@ void oled_driver_render_logo_left(void) {
407407
render_kitty();
408408

409409
oled_set_cursor(6, 0);
410-
oled_write_P(PSTR(" Tractyl "), true);
410+
oled_write_P(PSTR(" Tractyl "), false);
411411
oled_set_cursor(6, 1);
412-
oled_write_P(PSTR(" Manuform "), true);
412+
oled_write_P(PSTR(" Manuform "), false);
413413
oled_set_cursor(6, 2);
414414
# if defined(WPM_ENABLE)
415415
render_wpm(1);

keyboards/handwired/tractyl_manuform/5x6_right/rules.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SWAP_HANDS_ENABLE = yes
1717

1818
POINTING_DEVICE_ENABLE = yes
1919
POINTING_DEVICE_DRIVER = pmw3360
20-
MOUSE_SHARED_EP = no
20+
MOUSE_SHARED_EP = yes
2121

2222
SPLIT_KEYBOARD = yes
2323

keyboards/handwired/tractyl_manuform/tm_sync.c

Lines changed: 102 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,29 @@
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616

17-
#include "tractyl_manuform.h"
17+
#include QMK_KEYBOARD_H
18+
#include "pointing_device.h"
1819
#include "transactions.h"
1920
#include <string.h>
21+
#ifdef MOUSEKEY_ENABLE
22+
# include "mousekey.h"
23+
#endif
2024

21-
kb_config_data_t kb_config;
22-
kb_mouse_report_t sync_mouse_report;
25+
// typedef struct {
26+
// uint16_t device_cpi;
27+
// } kb_config_data_t;
28+
29+
kb_config_data_t kb_config;
30+
static report_mouse_t shared_mouse_report;
31+
extern const pointing_device_driver_t pointing_device_driver;
2332

2433
void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
25-
if (target2initiator_buffer_size == sizeof(sync_mouse_report)) {
26-
memcpy(target2initiator_buffer, &sync_mouse_report, sizeof(sync_mouse_report));
27-
}
28-
sync_mouse_report.x = 0;
29-
sync_mouse_report.y = 0;
34+
shared_mouse_report = pointing_device_driver.get_report(shared_mouse_report);
35+
memcpy(target2initiator_buffer, &shared_mouse_report, sizeof(report_mouse_t));
36+
shared_mouse_report.x = 0;
37+
shared_mouse_report.y = 0;
38+
shared_mouse_report.h = 0;
39+
shared_mouse_report.v = 0;
3040
}
3141

3242
void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
@@ -38,12 +48,15 @@ void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* in
3848
// Check if the state values are different
3949
if (cpi != kb_config.device_cpi) {
4050
cpi = kb_config.device_cpi;
51+
if (!is_keyboard_left()) {
52+
pointing_device_set_cpi(cpi);
53+
}
4154
}
4255
}
4356

4457
void keyboard_pre_init_sync(void) {
4558
memset(&kb_config, 0, sizeof(kb_config));
46-
memset(&sync_mouse_report, 0, sizeof(sync_mouse_report));
59+
memset(&shared_mouse_report, 0, sizeof(shared_mouse_report));
4760
}
4861

4962
void keyboard_post_init_sync(void) {
@@ -84,3 +97,83 @@ void trackball_set_cpi(uint16_t cpi) {
8497
pointing_device_set_cpi(cpi);
8598
}
8699
}
100+
101+
void pointing_device_task(void) {
102+
if (!is_keyboard_master()) {
103+
return;
104+
}
105+
106+
#if defined(POINTING_DEVICE_TASK_THROTTLE)
107+
static uint32_t last_exec = 0;
108+
if (timer_elapsed32(last_exec) < 1) {
109+
return;
110+
}
111+
last_exec = timer_read32();
112+
#endif
113+
114+
report_mouse_t local_report = pointing_device_get_report();
115+
116+
// Gather report info
117+
#ifdef POINTING_DEVICE_MOTION_PIN
118+
if (!readPin(POINTING_DEVICE_MOTION_PIN))
119+
#endif
120+
#if defined(POINTING_DEVICE_COMBINED)
121+
local_report = pointing_device_driver.get_report(local_report);
122+
transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &shared_mouse_report);
123+
local_report.x = local_report.x | shared_mouse_report.x;
124+
local_report.y = local_report.y | shared_mouse_report.y;
125+
local_report.h = local_report.h | shared_mouse_report.h;
126+
local_report.v = local_report.v | shared_mouse_report.v;
127+
#elif defined(POINTING_DEVICE_LEFT)
128+
if (is_keyboard_left()) {
129+
local_report = pointing_device_driver.get_report(local_report);
130+
} else {
131+
transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report);
132+
}
133+
#elif defined(POINTING_DEVICE_RIGHT)
134+
if (!is_keyboard_left()) {
135+
local_report = pointing_device_driver.get_report(local_report);
136+
} else {
137+
transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(report_mouse_t), &local_report);
138+
}
139+
#else
140+
# error "You need to define the side(s) the pointing device is on. POINTING_DEVICE_COMBINED / POINTING_DEVICE_LEFT / POINTING_DEVICE_RIGHT"
141+
#endif
142+
143+
// Support rotation of the sensor data
144+
#if defined(POINTING_DEVICE_ROTATION_90) || defined(POINTING_DEVICE_ROTATION_180) || defined(POINTING_DEVICE_ROTATION_270)
145+
int8_t x = local_report.x, y = local_report.y;
146+
# if defined(POINTING_DEVICE_ROTATION_90)
147+
local_report.x = y;
148+
local_report.y = -x;
149+
# elif defined(POINTING_DEVICE_ROTATION_180)
150+
local_report.x = -x;
151+
local_report.y = -y;
152+
# elif defined(POINTING_DEVICE_ROTATION_270)
153+
local_report.x = -y;
154+
local_report.y = x;
155+
# else
156+
# error "How the heck did you get here?!"
157+
# endif
158+
#endif
159+
// Support Inverting the X and Y Axises
160+
#if defined(POINTING_DEVICE_INVERT_X)
161+
local_report.x = -local_report.x;
162+
#endif
163+
#if defined(POINTING_DEVICE_INVERT_Y)
164+
local_report.y = -local_report.y;
165+
#endif
166+
167+
// allow kb to intercept and modify report
168+
local_report = pointing_device_task_kb(local_report);
169+
// combine with mouse report to ensure that the combined is sent correctly
170+
#ifdef MOUSEKEY_ENABLE
171+
report_mouse_t mousekey_report = mousekey_get_report();
172+
local_report.buttons = local_report.buttons | mousekey_report.buttons;
173+
#endif
174+
#if defined(POINTING_DEVICE_COMBINED)
175+
local_report.buttons = local_report.buttons | shared_mouse_report.buttons;
176+
#endif
177+
pointing_device_set_report(local_report);
178+
pointing_device_send();
179+
}

keyboards/handwired/tractyl_manuform/tractyl_manuform.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,8 @@ void pointing_device_init_kb(void) {
9999
}
100100

101101
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
102-
if (is_keyboard_left()) {
103-
if (is_keyboard_master()) {
104-
transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(sync_mouse_report), &sync_mouse_report);
105-
mouse_report.x = sync_mouse_report.x;
106-
mouse_report.y = sync_mouse_report.y;
107-
pointing_device_task_user(mouse_report);
108-
}
109-
} else {
110-
if (is_keyboard_master()) {
111-
pointing_device_task_user(mouse_report);
112-
} else {
113-
sync_mouse_report.x = mouse_report.x;
114-
sync_mouse_report.y = mouse_report.y;
115-
}
102+
if (is_keyboard_master()) {
103+
mouse_report = pointing_device_task_user(mouse_report);
116104
}
117105
return mouse_report;
118106
}

keyboards/handwired/tractyl_manuform/tractyl_manuform.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ typedef struct {
4343
uint16_t device_cpi;
4444
} kb_config_data_t;
4545

46-
__attribute__((aligned(16))) typedef struct {
47-
int8_t x;
48-
int8_t y;
49-
} kb_mouse_report_t;
50-
51-
extern kb_mouse_report_t sync_mouse_report;
52-
53-
void process_mouse(void);
54-
void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y);
5546
void trackball_set_cpi(uint16_t cpi);
5647
void matrix_init_sub_kb(void);
5748
void matrix_scan_sub_kb(void);

keyboards/moonlander/keymaps/drashna/keymap.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
#include "drashna.h"
1818

19-
#ifndef UNICODE_ENABLE
20-
# define UC(x) KC_NO
21-
#endif
22-
2319
enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE };
2420

2521
// clang-format off
@@ -32,10 +28,10 @@ enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE };
3228
) \
3329
LAYOUT_moonlander_wrapper( \
3430
KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, \
35-
KC_TAB, K01, K02, K03, K04, K05, TG_DBLO,TG_DBLO, K06, K07, K08, K09, K0A, KC_BSLS, \
36-
KC_C1R3, K11, K12, K13, K14, K15, TG_GAME,TG_GAME, K16, K17, K18, K19, K1A, RALT_T(K1B), \
31+
KC_TAB, K01, K02, K03, K04, K05, TG_DBLO, TG_DBLO, K06, K07, K08, K09, K0A, KC_BSLS, \
32+
KC_C1R3, K11, K12, K13, K14, K15, TG_GAME, TG_GAME, K16, K17, K18, K19, K1A, RALT_T(K1B), \
3733
KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A),KC_MRSF, \
38-
KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_NO, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC(0x2E2E), \
34+
KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, UC_CLUE, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_IRNY, \
3935
KC_SPC, BK_LWER, OS_LALT, OS_RGUI, DL_RAIS, KC_ENT \
4036
)
4137

@@ -110,10 +106,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
110106
),
111107

112108
[_ADJUST] = LAYOUT_moonlander_wrapper(
113-
KC_MAKE, _________________FUNC_LEFT_________________, UC_MOD, KC_NUKE, _________________ADJUST_R1_________________, KC_RST,
109+
KC_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_NOMODE,_______, KC_NUKE,KC_NOMODE,KC_BLOCKS,KC_REGIONAL,_______,_______, KC_RST,
114110
VRSN, _________________ADJUST_L1_________________, TG(_DIABLOII), _______, _________________ADJUST_R1_________________, EEP_RST,
115-
_______, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, RGB_IDL,
116-
KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
111+
KEYLOCK, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, RGB_IDL,
112+
UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
117113
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS,
118114
_______, _______, _______, _______, _______, _______
119115
),

layouts/community/split_3x6_3/drashna/rules.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ ifeq ($(strip $(KEYBOARD)), crkbd/rev1)
2323
OLED_ENABLE = yes
2424
RGB_MATRIX_ENABLE = yes
2525
HAPTIC_ENABLE = no
26-
BOOTLOADER = qmk-dfu
2726
endif
2827

2928
ifeq ($(strip $(CTPC)), yes)
3029
HAPTIC_ENABLE = no
3130
WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file
3231
SERIAL_DRIVER = usart
3332
SWAP_HANDS_ENABLE = yes
34-
WPM_ENABLE = yes
33+
WPM_ENABLE = yes
34+
else
35+
BOOTLOADER = qmk-hid
36+
BOOTLOADER_SIZE = 512
3537
endif

users/drashna/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
# endif
4242
#endif
4343

44+
#if defined(WPM_ENABLE)
45+
// # define WPM_LAUNCH_CONTROL
46+
// # define WPM_ALLOW_COUNT_REGRESSOIN
47+
// # define WPM_UNFILTERED
48+
# define WPM_SAMPLE_SECONDS 6
49+
# define WPM_SAMPLE_PERIODS 50
50+
# define WPM_ESTIMATED_WORD_SIZE 6
51+
#endif
52+
4453
#ifdef AUDIO_ENABLE
4554
# define AUDIO_CLICKY
4655
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f

users/drashna/oled_stuff.c

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616

1717
#include "drashna.h"
18+
#ifdef CUSTOM_UNICODE_ENABLE
19+
# include "process_unicode_common.h"
20+
#endif
21+
#include <string.h>
1822

1923
extern bool host_driver_disabled;
2024

@@ -59,7 +63,7 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) {
5963
return;
6064
}
6165
if (record->tap.count) {
62-
keycode = keycode & 0xFF;
66+
keycode &= 0xFF;
6367
} else if (keycode > 0xFF) {
6468
return;
6569
}
@@ -150,8 +154,10 @@ void render_keylock_status(uint8_t led_usb_state) {
150154
oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK));
151155
oled_write_P(PSTR(" "), false);
152156
oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK));
153-
// oled_write_P(PSTR(" "), false);
154-
// oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
157+
#if defined(OLED_DISPLAY_128X64)
158+
oled_write_P(PSTR(" "), false);
159+
oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
160+
#endif
155161
}
156162

157163
void render_matrix_scan_rate(void) {
@@ -296,7 +302,7 @@ void render_user_status(void) {
296302
oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false);
297303
static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}};
298304
oled_write_P(cat_mode[0], host_driver_disabled);
299-
#if defined(UNICODE_ENABLE)
305+
#if defined(CUSTOM_UNICODE_ENABLE)
300306
static const char PROGMEM uc_mod_status[5][3] = {{0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
301307
oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false);
302308
#endif
@@ -327,39 +333,28 @@ void oled_driver_render_logo(void) {
327333

328334
void render_wpm(uint8_t padding) {
329335
#ifdef WPM_ENABLE
330-
uint8_t n = get_current_wpm();
331-
char wpm_counter[4];
332-
wpm_counter[3] = '\0';
333-
wpm_counter[2] = '0' + n % 10;
334-
wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
335-
wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
336+
336337
oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
337338
if (padding) {
338339
for (uint8_t n = padding; n > 0; n--) {
339340
oled_write_P(PSTR(" "), false);
340341
}
341342
}
342-
oled_write(wpm_counter, false);
343+
oled_write(get_u8_str(get_current_wpm(), ' '), false);
343344
#endif
344345
}
345346

346347
#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
347348
extern kb_config_data_t kb_config;
348349
void render_pointing_dpi_status(uint8_t padding) {
349-
char dpi_status[5];
350-
uint16_t n = kb_config.device_cpi;
351-
dpi_status[4] = '\0';
352-
dpi_status[3] = '0' + n % 10;
353-
dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
354-
dpi_status[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
355-
dpi_status[0] = n / 10 ? '0' + n / 10 : ' ';
356-
oled_write_P(PSTR("DPI: "), false);
350+
oled_write_P(PSTR("CPI:"), false);
357351
if (padding) {
358-
for (uint8_t n = padding; n > 0; n--) {
352+
for (uint8_t n = padding - 1; n > 0; n--) {
359353
oled_write_P(PSTR(" "), false);
360354
}
361355
}
362-
oled_write(dpi_status, false);
356+
357+
oled_write(get_u16_str(kb_config.device_cpi, ' '), false);
363358
}
364359
#endif
365360

0 commit comments

Comments
 (0)