From 801f5b9385c6a36017a9627a98554cd786288355 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Mon, 20 Nov 2023 23:47:38 +0100 Subject: [PATCH 01/19] Add ps2_mouse pointing device --- builddefs/common_features.mk | 5 +- drivers/ps2/ps2_mouse.c | 91 +++++++++++++++++++ drivers/ps2/ps2_mouse.h | 5 + quantum/pointing_device/pointing_device.h | 2 + .../pointing_device/pointing_device_drivers.c | 10 ++ 5 files changed, 112 insertions(+), 1 deletion(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 17b3edfcf4b..9438ce48499 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -120,7 +120,7 @@ ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) MOUSE_ENABLE := yes endif -VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick azoteq_iqs5xx cirque_pinnacle_i2c cirque_pinnacle_spi paw3204 pmw3320 pmw3360 pmw3389 pimoroni_trackball custom +VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick azoteq_iqs5xx cirque_pinnacle_i2c cirque_pinnacle_spi paw3204 pmw3320 pmw3360 pmw3389 pimoroni_trackball ps2_mouse custom ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) ifeq ($(filter $(POINTING_DEVICE_DRIVER),$(VALID_POINTING_DEVICE_DRIVER_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid POINTING_DEVICE_DRIVER,POINTING_DEVICE_DRIVER="$(POINTING_DEVICE_DRIVER)" is not a valid pointing device type) @@ -157,6 +157,9 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) else ifneq ($(filter $(strip $(POINTING_DEVICE_DRIVER)),pmw3360 pmw3389),) SPI_DRIVER_REQUIRED = yes SRC += drivers/sensors/pmw33xx_common.c + else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), ps2_mouse) + PS2_ENABLE := yes + SRC += drivers/ps2/ps2_mouse.c endif endif endif diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 88c9bdcebef..7f6622f33d0 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -311,3 +311,94 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { RELEASE_SCROLL_BUTTONS; } + +void ps2_mouse_pointing_device_init(void) { + ps2_mouse_init(); +} + +report_mouse_t ps2_mouse_pointing_device_get_report(report_mouse_t mouse_report) { + static uint8_t buttons_prev = 0; + + /* receives packet from mouse */ +#ifdef PS2_MOUSE_USE_REMOTE_MODE + uint8_t rcv; + rcv = ps2_host_send(PS2_MOUSE_READ_DATA); + if (rcv == PS2_ACK) { + mouse_report.buttons = ps2_host_recv_response(); + mouse_report.x = ps2_host_recv_response(); + mouse_report.y = ps2_host_recv_response(); +# ifdef PS2_MOUSE_ENABLE_SCROLLING + mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); +# endif + } else { + if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); + } +#else + if (pbuf_has_data()) { + mouse_report.buttons = ps2_host_recv_response(); + mouse_report.x = ps2_host_recv_response(); + mouse_report.y = ps2_host_recv_response(); +# ifdef PS2_MOUSE_ENABLE_SCROLLING + mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); +# endif + } +#endif + + /* if mouse moves or buttons state changes */ + if (mouse_report.x || mouse_report.y || mouse_report.v || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { +#ifdef PS2_MOUSE_DEBUG_RAW + // Used to debug raw ps2 bytes from mouse + ps2_mouse_print_report(&mouse_report); +#endif + buttons_prev = mouse_report.buttons; + ps2_mouse_convert_report_to_hid(&mouse_report); +#if PS2_MOUSE_SCROLL_BTN_MASK + ps2_mouse_scroll_button_task(&mouse_report); +#endif + if (mouse_report.x || mouse_report.y || mouse_report.v) { + ps2_mouse_moved_user(&mouse_report); + } +#ifdef PS2_MOUSE_DEBUG_HID + // Used to debug the bytes sent to the host + ps2_mouse_print_report(&mouse_report); +#endif + } + + return mouse_report; +} + +/* Note: PS/2 mouse uses counts/mm */ +uint16_t ps2_mouse_pointing_device_get_cpi(void) { + uint8_t rcv, cpm; + rcv = ps2_host_send(PS2_MOUSE_STATUS_REQUEST); + if (rcv == PS2_ACK) { + rcv = ps2_host_recv_response(); + cpm = ps2_host_recv_response(); + rcv = ps2_host_recv_response(); + + return (1 << cpm); + } + + return 0; +} + +/* Note: PS/2 mouse uses counts/mm */ +void ps2_mouse_pointing_device_set_cpi(uint16_t cpi) { + switch (cpi) { + case 1: + ps2_mouse_set_resolution(PS2_MOUSE_1_COUNT_MM); + break; + case 2: + ps2_mouse_set_resolution(PS2_MOUSE_2_COUNT_MM); + break; + case 4: + ps2_mouse_set_resolution(PS2_MOUSE_4_COUNT_MM); + break; + case 8: + ps2_mouse_set_resolution(PS2_MOUSE_8_COUNT_MM); + break; + default: + if (debug_mouse) xprintf("ps2_mouse: invalid cpi: %u\n", cpi); + break; + } +} diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 885eeecbd2d..1157e8ac83f 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -175,3 +175,8 @@ void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution); void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); void ps2_mouse_moved_user(report_mouse_t *mouse_report); + +void ps2_mouse_pointing_device_init(void); +report_mouse_t ps2_mouse_pointing_device_get_report(report_mouse_t mouse_report); +uint16_t ps2_mouse_pointing_device_get_cpi(void); +void ps2_mouse_pointing_device_set_cpi(uint16_t cpi); diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h index 1cd4b0b5e60..1f2d844a458 100644 --- a/quantum/pointing_device/pointing_device.h +++ b/quantum/pointing_device/pointing_device.h @@ -67,6 +67,8 @@ along with this program. If not, see . # include "spi_master.h" # include "drivers/sensors/pmw33xx_common.h" # define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW +#elif defined(POINTING_DEVICE_DRIVER_ps2_mouse) +# include "drivers/ps2/ps2_mouse.h" #else void pointing_device_driver_init(void); report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report); diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c index bf131c6eda5..5e40a1b4d7a 100644 --- a/quantum/pointing_device/pointing_device_drivers.c +++ b/quantum/pointing_device/pointing_device_drivers.c @@ -492,6 +492,16 @@ const pointing_device_driver_t pointing_device_driver = { }; // clang-format on +#elif defined(POINTING_DEVICE_DRIVER_ps2_mouse) +// clang-format off +const pointing_device_driver_t pointing_device_driver = { + .init = ps2_mouse_pointing_device_init, + .get_report = ps2_mouse_pointing_device_get_report, + .set_cpi = ps2_mouse_pointing_device_set_cpi, + .get_cpi = ps2_mouse_pointing_device_get_cpi, +}; +// clang-format on + #else __attribute__((weak)) void pointing_device_driver_init(void) {} __attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { From abd7f065ee7aa01206efeb9b56b108ed36b692b2 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:09:10 +0100 Subject: [PATCH 02/19] Remove ps2_mouse_task(), clean up ps2_mouse_get_report --- drivers/ps2/ps2_mouse.c | 95 +++---------------- drivers/ps2/ps2_mouse.h | 10 +- quantum/keyboard.c | 10 -- .../pointing_device/pointing_device_drivers.c | 8 +- 4 files changed, 22 insertions(+), 101 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 7f6622f33d0..b4964c1e107 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -1,5 +1,6 @@ /* Copyright 2011,2013 Jun Wako +Copyright 2023 Johannes H. Jensen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,8 +29,6 @@ along with this program. If not, see . /* ============================= MACROS ============================ */ -static report_mouse_t mouse_report = {}; - static inline void ps2_mouse_print_report(report_mouse_t *mouse_report); static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report); @@ -71,10 +70,7 @@ __attribute__((weak)) void ps2_mouse_init_user(void) {} __attribute__((weak)) void ps2_mouse_moved_user(report_mouse_t *mouse_report) {} -void ps2_mouse_task(void) { - static uint8_t buttons_prev = 0; - extern int tp_buttons; - +report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { /* receives packet from mouse */ #ifdef PS2_MOUSE_USE_REMOTE_MODE uint8_t rcv; @@ -90,6 +86,7 @@ void ps2_mouse_task(void) { if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); } #else + /* Streaming mode */ if (pbuf_has_data()) { mouse_report.buttons = ps2_host_recv_response(); mouse_report.x = ps2_host_recv_response(); @@ -97,36 +94,23 @@ void ps2_mouse_task(void) { # ifdef PS2_MOUSE_ENABLE_SCROLLING mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif - } else { - if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); } #endif - mouse_report.buttons |= tp_buttons; - /* if mouse moves or buttons state changes */ - if (mouse_report.x || mouse_report.y || mouse_report.v || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { #ifdef PS2_MOUSE_DEBUG_RAW - // Used to debug raw ps2 bytes from mouse - ps2_mouse_print_report(&mouse_report); -#endif - buttons_prev = mouse_report.buttons; - ps2_mouse_convert_report_to_hid(&mouse_report); -#if PS2_MOUSE_SCROLL_BTN_MASK - ps2_mouse_scroll_button_task(&mouse_report); + // Used to debug raw ps2 bytes from mouse + ps2_mouse_print_report(&mouse_report); #endif - if (mouse_report.x || mouse_report.y || mouse_report.v) { - ps2_mouse_moved_user(&mouse_report); - } + ps2_mouse_convert_report_to_hid(&mouse_report); #ifdef PS2_MOUSE_DEBUG_HID - // Used to debug the bytes sent to the host - ps2_mouse_print_report(&mouse_report); + // Used to debug the bytes sent to the host + ps2_mouse_print_report(&mouse_report); #endif - host_mouse_send(&mouse_report); - } - ps2_mouse_clear_report(&mouse_report); + return mouse_report; } + void ps2_mouse_disable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); } @@ -312,63 +296,8 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { RELEASE_SCROLL_BUTTONS; } -void ps2_mouse_pointing_device_init(void) { - ps2_mouse_init(); -} - -report_mouse_t ps2_mouse_pointing_device_get_report(report_mouse_t mouse_report) { - static uint8_t buttons_prev = 0; - - /* receives packet from mouse */ -#ifdef PS2_MOUSE_USE_REMOTE_MODE - uint8_t rcv; - rcv = ps2_host_send(PS2_MOUSE_READ_DATA); - if (rcv == PS2_ACK) { - mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response(); - mouse_report.y = ps2_host_recv_response(); -# ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); -# endif - } else { - if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); - } -#else - if (pbuf_has_data()) { - mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response(); - mouse_report.y = ps2_host_recv_response(); -# ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); -# endif - } -#endif - - /* if mouse moves or buttons state changes */ - if (mouse_report.x || mouse_report.y || mouse_report.v || ((mouse_report.buttons ^ buttons_prev) & PS2_MOUSE_BTN_MASK)) { -#ifdef PS2_MOUSE_DEBUG_RAW - // Used to debug raw ps2 bytes from mouse - ps2_mouse_print_report(&mouse_report); -#endif - buttons_prev = mouse_report.buttons; - ps2_mouse_convert_report_to_hid(&mouse_report); -#if PS2_MOUSE_SCROLL_BTN_MASK - ps2_mouse_scroll_button_task(&mouse_report); -#endif - if (mouse_report.x || mouse_report.y || mouse_report.v) { - ps2_mouse_moved_user(&mouse_report); - } -#ifdef PS2_MOUSE_DEBUG_HID - // Used to debug the bytes sent to the host - ps2_mouse_print_report(&mouse_report); -#endif - } - - return mouse_report; -} - /* Note: PS/2 mouse uses counts/mm */ -uint16_t ps2_mouse_pointing_device_get_cpi(void) { +uint16_t ps2_mouse_get_cpi(void) { uint8_t rcv, cpm; rcv = ps2_host_send(PS2_MOUSE_STATUS_REQUEST); if (rcv == PS2_ACK) { @@ -383,7 +312,7 @@ uint16_t ps2_mouse_pointing_device_get_cpi(void) { } /* Note: PS/2 mouse uses counts/mm */ -void ps2_mouse_pointing_device_set_cpi(uint16_t cpi) { +void ps2_mouse_set_cpi(uint16_t cpi) { switch (cpi) { case 1: ps2_mouse_set_resolution(PS2_MOUSE_1_COUNT_MM); diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 1157e8ac83f..7f3d7e14c37 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -1,5 +1,6 @@ /* Copyright 2011 Jun Wako +Copyright 2023 Johannes H. Jensen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -176,7 +177,8 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); void ps2_mouse_moved_user(report_mouse_t *mouse_report); -void ps2_mouse_pointing_device_init(void); -report_mouse_t ps2_mouse_pointing_device_get_report(report_mouse_t mouse_report); -uint16_t ps2_mouse_pointing_device_get_cpi(void); -void ps2_mouse_pointing_device_set_cpi(uint16_t cpi); +report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report); + +uint16_t ps2_mouse_get_cpi(void); + +void ps2_mouse_set_cpi(uint16_t cpi); diff --git a/quantum/keyboard.c b/quantum/keyboard.c index 83e9909c07b..4065c2a476f 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c @@ -47,9 +47,6 @@ along with this program. If not, see . #ifdef MOUSEKEY_ENABLE # include "mousekey.h" #endif -#ifdef PS2_MOUSE_ENABLE -# include "ps2_mouse.h" -#endif #ifdef RGBLIGHT_ENABLE # include "rgblight.h" #endif @@ -456,9 +453,6 @@ void keyboard_init(void) { #ifdef ST7565_ENABLE st7565_init(DISPLAY_ROTATION_0); #endif -#ifdef PS2_MOUSE_ENABLE - ps2_mouse_init(); -#endif #ifdef BACKLIGHT_ENABLE backlight_init(); #endif @@ -735,10 +729,6 @@ void keyboard_task(void) { mousekey_task(); #endif -#ifdef PS2_MOUSE_ENABLE - ps2_mouse_task(); -#endif - #ifdef MIDI_ENABLE midi_task(); #endif diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c index 5e40a1b4d7a..db003ac64a3 100644 --- a/quantum/pointing_device/pointing_device_drivers.c +++ b/quantum/pointing_device/pointing_device_drivers.c @@ -495,10 +495,10 @@ const pointing_device_driver_t pointing_device_driver = { #elif defined(POINTING_DEVICE_DRIVER_ps2_mouse) // clang-format off const pointing_device_driver_t pointing_device_driver = { - .init = ps2_mouse_pointing_device_init, - .get_report = ps2_mouse_pointing_device_get_report, - .set_cpi = ps2_mouse_pointing_device_set_cpi, - .get_cpi = ps2_mouse_pointing_device_get_cpi, + .init = ps2_mouse_init, + .get_report = ps2_mouse_get_report, + .set_cpi = ps2_mouse_set_cpi, + .get_cpi = ps2_mouse_get_cpi, }; // clang-format on From 9ee6f74331ec5e853159e867f19272a3f0da0bfb Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:32:56 +0100 Subject: [PATCH 03/19] Remove PS2_MOUSE_INVERT_[XY] --- drivers/ps2/ps2_mouse.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index b4964c1e107..2bb14379643 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -182,13 +182,8 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) // remove sign and overflow flags mouse_report->buttons &= PS2_MOUSE_BTN_MASK; -#ifdef PS2_MOUSE_INVERT_X - mouse_report->x = -mouse_report->x; -#endif -#ifndef PS2_MOUSE_INVERT_Y // NOTE if not! // invert coordinate of y to conform to USB HID mouse mouse_report->y = -mouse_report->y; -#endif #ifdef PS2_MOUSE_ROTATE mouse_xy_report_t x = mouse_report->x; From 4e53ceb7a641422e8b10ca7f108073905b662043 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:36:54 +0100 Subject: [PATCH 04/19] Remove PS2_MOUSE_ROTATE --- drivers/ps2/ps2_mouse.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 2bb14379643..042b8f6cf0d 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -184,21 +184,6 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) // invert coordinate of y to conform to USB HID mouse mouse_report->y = -mouse_report->y; - -#ifdef PS2_MOUSE_ROTATE - mouse_xy_report_t x = mouse_report->x; - mouse_xy_report_t y = mouse_report->y; -# if PS2_MOUSE_ROTATE == 90 - mouse_report->x = y; - mouse_report->y = -x; -# elif PS2_MOUSE_ROTATE == 180 - mouse_report->x = -x; - mouse_report->y = -y; -# elif PS2_MOUSE_ROTATE == 270 - mouse_report->x = -y; - mouse_report->y = x; -# endif -#endif } static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { From 28a8d00eb92cff47a246ba822f16af6edc7c6838 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Wed, 13 Dec 2023 22:47:02 +0100 Subject: [PATCH 05/19] Remove PS2_MOUSE_SCROLL_BTN_* --- drivers/ps2/ps2_mouse.c | 56 ----------------------------------------- drivers/ps2/ps2_mouse.h | 8 ------ 2 files changed, 64 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 042b8f6cf0d..59e44575857 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -220,62 +220,6 @@ static inline void ps2_mouse_enable_scrolling(void) { wait_ms(20); } -#define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) -#define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK) -static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { - static enum { - SCROLL_NONE, - SCROLL_BTN, - SCROLL_SENT, - } scroll_state = SCROLL_NONE; - static uint16_t scroll_button_time = 0; - static int16_t scroll_x, scroll_y; - - if (PS2_MOUSE_SCROLL_BTN_MASK == (mouse_report->buttons & (PS2_MOUSE_SCROLL_BTN_MASK))) { - // All scroll buttons are pressed - - if (scroll_state == SCROLL_NONE) { - scroll_button_time = timer_read(); - scroll_state = SCROLL_BTN; - scroll_x = 0; - scroll_y = 0; - } - - // If the mouse has moved, update the report to scroll instead of move the mouse - if (mouse_report->x || mouse_report->y) { - scroll_state = SCROLL_SENT; - scroll_y += mouse_report->y; - scroll_x += mouse_report->x; - mouse_report->v = -scroll_y / (PS2_MOUSE_SCROLL_DIVISOR_V); - mouse_report->h = scroll_x / (PS2_MOUSE_SCROLL_DIVISOR_H); - scroll_y += (mouse_report->v * (PS2_MOUSE_SCROLL_DIVISOR_V)); - scroll_x -= (mouse_report->h * (PS2_MOUSE_SCROLL_DIVISOR_H)); - mouse_report->x = 0; - mouse_report->y = 0; -#ifdef PS2_MOUSE_INVERT_H - mouse_report->h = -mouse_report->h; -#endif -#ifdef PS2_MOUSE_INVERT_V - mouse_report->v = -mouse_report->v; -#endif - } - } else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) { - // None of the scroll buttons are pressed - -#if PS2_MOUSE_SCROLL_BTN_SEND - if (scroll_state == SCROLL_BTN && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { - PRESS_SCROLL_BUTTONS; - host_mouse_send(mouse_report); - wait_ms(100); - RELEASE_SCROLL_BUTTONS; - } -#endif - scroll_state = SCROLL_NONE; - } - - RELEASE_SCROLL_BUTTONS; -} - /* Note: PS/2 mouse uses counts/mm */ uint16_t ps2_mouse_get_cpi(void) { uint8_t rcv, cpm; diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 7f3d7e14c37..beae1922856 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -85,14 +85,6 @@ __attribute__((unused)) static enum ps2_mouse_mode_e { #define PS2_MOUSE_X_OVFLW 6 #define PS2_MOUSE_Y_OVFLW 7 -/* mouse button to start scrolling; set 0 to disable scroll */ -#ifndef PS2_MOUSE_SCROLL_BTN_MASK -# define PS2_MOUSE_SCROLL_BTN_MASK (1 << PS2_MOUSE_BTN_MIDDLE) -#endif -/* send button event when button is released within this value(ms); set 0 to disable */ -#ifndef PS2_MOUSE_SCROLL_BTN_SEND -# define PS2_MOUSE_SCROLL_BTN_SEND 300 -#endif /* divide virtical and horizontal mouse move by this to convert to scroll move */ #ifndef PS2_MOUSE_SCROLL_DIVISOR_V # define PS2_MOUSE_SCROLL_DIVISOR_V 2 From f128cd53d1af77612f0a122f338087751f3ae3d2 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:44:32 +0100 Subject: [PATCH 06/19] Remove ps2_mouse_init_user and ps2_mouse_moved_user --- drivers/ps2/ps2_mouse.c | 6 ------ drivers/ps2/ps2_mouse.h | 4 ---- 2 files changed, 10 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 59e44575857..73d97197889 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -62,14 +62,8 @@ void ps2_mouse_init(void) { #ifdef PS2_MOUSE_USE_2_1_SCALING ps2_mouse_set_scaling_2_1(); #endif - - ps2_mouse_init_user(); } -__attribute__((weak)) void ps2_mouse_init_user(void) {} - -__attribute__((weak)) void ps2_mouse_moved_user(report_mouse_t *mouse_report) {} - report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { /* receives packet from mouse */ #ifdef PS2_MOUSE_USE_REMOTE_MODE diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index beae1922856..8cdfb238ee3 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -147,8 +147,6 @@ typedef enum ps2_mouse_sample_rate_e { void ps2_mouse_init(void); -void ps2_mouse_init_user(void); - void ps2_mouse_task(void); void ps2_mouse_disable_data_reporting(void); @@ -167,8 +165,6 @@ void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution); void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); -void ps2_mouse_moved_user(report_mouse_t *mouse_report); - report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report); uint16_t ps2_mouse_get_cpi(void); From 225618c4daeee25f0455c48bbf61f7f2c4f5b736 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:46:35 +0100 Subject: [PATCH 07/19] Remove ps2_mouse_task --- drivers/ps2/ps2_mouse.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 8cdfb238ee3..9a665e6e641 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -147,8 +147,6 @@ typedef enum ps2_mouse_sample_rate_e { void ps2_mouse_init(void); -void ps2_mouse_task(void); - void ps2_mouse_disable_data_reporting(void); void ps2_mouse_enable_data_reporting(void); From ec3fd41aa6838c24f2d8f73f5a8288e1ab1f023c Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 21:56:11 +0100 Subject: [PATCH 08/19] Use pd_dprintf instead of custom PS2_DEBUG logic --- drivers/ps2/ps2_mouse.c | 44 +++++++++++++---------------------------- drivers/ps2/ps2_mouse.h | 10 ++-------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 73d97197889..e0ae7fb7efd 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -22,18 +22,15 @@ along with this program. If not, see . #include "gpio.h" #include "host.h" #include "timer.h" -#include "print.h" #include "report.h" -#include "debug.h" #include "ps2.h" +#include "pointing_device_internal.h" /* ============================= MACROS ============================ */ -static inline void ps2_mouse_print_report(report_mouse_t *mouse_report); static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report); static inline void ps2_mouse_enable_scrolling(void); -static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report); /* ============================= IMPLEMENTATION ============================ */ @@ -65,6 +62,8 @@ void ps2_mouse_init(void) { } report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { + bool has_report = false; + /* receives packet from mouse */ #ifdef PS2_MOUSE_USE_REMOTE_MODE uint8_t rcv; @@ -76,8 +75,9 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { # ifdef PS2_MOUSE_ENABLE_SCROLLING mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif + has_report = true; } else { - if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n"); + pd_dprintf("ps2_mouse: fail to get mouse packet\n"); } #else /* Streaming mode */ @@ -88,18 +88,17 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { # ifdef PS2_MOUSE_ENABLE_SCROLLING mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif + has_report = true; } #endif -#ifdef PS2_MOUSE_DEBUG_RAW - // Used to debug raw ps2 bytes from mouse - ps2_mouse_print_report(&mouse_report); -#endif - ps2_mouse_convert_report_to_hid(&mouse_report); -#ifdef PS2_MOUSE_DEBUG_HID - // Used to debug the bytes sent to the host - ps2_mouse_print_report(&mouse_report); -#endif + if (has_report) { + pd_dprintf("ps2_mouse: raw x=%x y=%x v=%x h=%x buttons=%x\n", mouse_report.x, mouse_report.y, mouse_report.v, mouse_report.h, mouse_report.buttons); + + ps2_mouse_convert_report_to_hid(&mouse_report); + + pd_dprintf("ps2_mouse: hid x=%x y=%x v=%x h=%x buttons=%x\n", mouse_report.x, mouse_report.y, mouse_report.v, mouse_report.h, mouse_report.buttons); + } return mouse_report; } @@ -188,21 +187,6 @@ static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { mouse_report->buttons = 0; } -static inline void ps2_mouse_print_report(report_mouse_t *mouse_report) { - if (!debug_mouse) return; - print("ps2_mouse: ["); - print_hex8(mouse_report->buttons); - print("|"); - print_hex8((uint8_t)mouse_report->x); - print(" "); - print_hex8((uint8_t)mouse_report->y); - print(" "); - print_hex8((uint8_t)mouse_report->v); - print(" "); - print_hex8((uint8_t)mouse_report->h); - print("]\n"); -} - static inline void ps2_mouse_enable_scrolling(void) { PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Initiaing scroll wheel enable: Set sample rate"); PS2_MOUSE_SEND(200, "200"); @@ -245,7 +229,7 @@ void ps2_mouse_set_cpi(uint16_t cpi) { ps2_mouse_set_resolution(PS2_MOUSE_8_COUNT_MM); break; default: - if (debug_mouse) xprintf("ps2_mouse: invalid cpi: %u\n", cpi); + pd_dprintf("ps2_mouse: invalid cpi: %u\n", cpi); break; } } diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 9a665e6e641..c76588c707f 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -25,10 +25,7 @@ along with this program. If not, see . #define PS2_MOUSE_SEND(command, message) \ do { \ __attribute__((unused)) uint8_t rcv = ps2_host_send(command); \ - if (debug_mouse) { \ - print((message)); \ - xprintf(" command: %X, result: %X, error: %X \n", command, rcv, ps2_error); \ - } \ + pd_dprintf("%s command: %X, result: %X, error: %X \n", message, command, rcv, ps2_error); \ } while (0) #define PS2_MOUSE_SEND_SAFE(command, message) \ @@ -57,10 +54,7 @@ along with this program. If not, see . #define PS2_MOUSE_RECEIVE(message) \ do { \ __attribute__((unused)) uint8_t rcv = ps2_host_recv_response(); \ - if (debug_mouse) { \ - print((message)); \ - xprintf(" result: %X, error: %X \n", rcv, ps2_error); \ - } \ + pd_dprintf("%s result: %X, error: %X \n", message, rcv, ps2_error); \ } while (0) __attribute__((unused)) static enum ps2_mouse_mode_e { From af2c7038d9c96a0cd5cc7e8afe3729f5149d8660 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Thu, 30 Nov 2023 22:10:43 +0100 Subject: [PATCH 09/19] Remove ps2_mouse_clear_report --- drivers/ps2/ps2_mouse.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index e0ae7fb7efd..a1f58ae9774 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -29,7 +29,6 @@ along with this program. If not, see . /* ============================= MACROS ============================ */ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); -static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report); static inline void ps2_mouse_enable_scrolling(void); /* ============================= IMPLEMENTATION ============================ */ @@ -179,14 +178,6 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) mouse_report->y = -mouse_report->y; } -static inline void ps2_mouse_clear_report(report_mouse_t *mouse_report) { - mouse_report->x = 0; - mouse_report->y = 0; - mouse_report->v = 0; - mouse_report->h = 0; - mouse_report->buttons = 0; -} - static inline void ps2_mouse_enable_scrolling(void) { PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Initiaing scroll wheel enable: Set sample rate"); PS2_MOUSE_SEND(200, "200"); From 6a4e2214a5f5d9da1e7ce9f27e1f3ce96fd2b111 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Fri, 1 Dec 2023 22:58:43 +0100 Subject: [PATCH 10/19] Use has_mouse_report_changed --- drivers/ps2/ps2_mouse.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index a1f58ae9774..5fb059e8c5e 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -61,45 +61,43 @@ void ps2_mouse_init(void) { } report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { - bool has_report = false; + report_mouse_t new_report = {}; /* receives packet from mouse */ #ifdef PS2_MOUSE_USE_REMOTE_MODE uint8_t rcv; rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { - mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response(); - mouse_report.y = ps2_host_recv_response(); + new_report.buttons = ps2_host_recv_response(); + new_report.x = ps2_host_recv_response(); + new_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); + new_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif - has_report = true; } else { pd_dprintf("ps2_mouse: fail to get mouse packet\n"); } #else /* Streaming mode */ if (pbuf_has_data()) { - mouse_report.buttons = ps2_host_recv_response(); - mouse_report.x = ps2_host_recv_response(); - mouse_report.y = ps2_host_recv_response(); + new_report.buttons = ps2_host_recv_response(); + new_report.x = ps2_host_recv_response(); + new_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - mouse_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); + new_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); # endif - has_report = true; } #endif - if (has_report) { - pd_dprintf("ps2_mouse: raw x=%x y=%x v=%x h=%x buttons=%x\n", mouse_report.x, mouse_report.y, mouse_report.v, mouse_report.h, mouse_report.buttons); + ps2_mouse_convert_report_to_hid(&new_report); - ps2_mouse_convert_report_to_hid(&mouse_report); + if (has_mouse_report_changed(&new_report, &mouse_report)) { + pd_dprintf("ps2_mouse: raw x=%x y=%x v=%x h=%x buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); - pd_dprintf("ps2_mouse: hid x=%x y=%x v=%x h=%x buttons=%x\n", mouse_report.x, mouse_report.y, mouse_report.v, mouse_report.h, mouse_report.buttons); + pd_dprintf("ps2_mouse: hid x=%x y=%x v=%x h=%x buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); } - return mouse_report; + return new_report; } From 65ced8fae74f5983b5010fbceb7e1af1825c2a48 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Sat, 2 Dec 2023 00:36:41 +0100 Subject: [PATCH 11/19] Introduce ps2_mouse_report_t --- drivers/ps2/ps2_mouse.c | 107 ++++++++++++++++++++++++---------------- drivers/ps2/ps2_mouse.h | 44 +++++++++++------ 2 files changed, 94 insertions(+), 57 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 5fb059e8c5e..c1199d0da8b 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -24,11 +24,12 @@ along with this program. If not, see . #include "timer.h" #include "report.h" #include "ps2.h" +#include "pointing_device.h" #include "pointing_device_internal.h" /* ============================= MACROS ============================ */ -static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); +static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_report, report_mouse_t *mouse_report); static inline void ps2_mouse_enable_scrolling(void); /* ============================= IMPLEMENTATION ============================ */ @@ -62,17 +63,18 @@ void ps2_mouse_init(void) { report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { report_mouse_t new_report = {}; + ps2_mouse_report_t ps2_report = {}; /* receives packet from mouse */ #ifdef PS2_MOUSE_USE_REMOTE_MODE uint8_t rcv; rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { - new_report.buttons = ps2_host_recv_response(); - new_report.x = ps2_host_recv_response(); - new_report.y = ps2_host_recv_response(); + ps2_report.head.w = ps2_host_recv_response(); + ps2_report.x = ps2_host_recv_response(); + ps2_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - new_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); + ps2_report.z = ps2_host_recv_response(); # endif } else { pd_dprintf("ps2_mouse: fail to get mouse packet\n"); @@ -80,21 +82,31 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { #else /* Streaming mode */ if (pbuf_has_data()) { - new_report.buttons = ps2_host_recv_response(); - new_report.x = ps2_host_recv_response(); - new_report.y = ps2_host_recv_response(); + ps2_report.head.w = ps2_host_recv_response(); + ps2_report.x = ps2_host_recv_response(); + ps2_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - new_report.v = -(ps2_host_recv_response() & PS2_MOUSE_SCROLL_MASK); + ps2_report.z = ps2_host_recv_response(); # endif } #endif - ps2_mouse_convert_report_to_hid(&new_report); + ps2_mouse_convert_report_to_hid(&ps2_report, &new_report); if (has_mouse_report_changed(&new_report, &mouse_report)) { - pd_dprintf("ps2_mouse: raw x=%x y=%x v=%x h=%x buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); - - pd_dprintf("ps2_mouse: hid x=%x y=%x v=%x h=%x buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); + pd_dprintf("ps2_mouse: raw x=%02x y=%02x head=0x%02x [left=%u right=%u middle=%u one=%u x_sign=%u y_sign=%u x_ovf=%u y_ovf=%u]\n", + ps2_report.x, ps2_report.y, + ps2_report.head.w, + ps2_report.head.b.left_button, + ps2_report.head.b.right_button, + ps2_report.head.b.middle_button, + ps2_report.head.b.always_one, + ps2_report.head.b.x_sign, + ps2_report.head.b.y_sign, + ps2_report.head.b.x_overflow, + ps2_report.head.b.y_overflow); + + pd_dprintf("ps2_mouse: hid x=%d y=%d v=%d h=%d buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); } return new_report; @@ -137,43 +149,52 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { /* ============================= HELPERS ============================ */ -#define X_IS_NEG (mouse_report->buttons & (1 << PS2_MOUSE_X_SIGN)) -#define Y_IS_NEG (mouse_report->buttons & (1 << PS2_MOUSE_Y_SIGN)) -#define X_IS_OVF (mouse_report->buttons & (1 << PS2_MOUSE_X_OVFLW)) -#define Y_IS_OVF (mouse_report->buttons & (1 << PS2_MOUSE_Y_OVFLW)) -static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) { -#ifndef MOUSE_EXTENDED_REPORT - // PS/2 mouse data is '9-bit integer'(-256 to 255) which is comprised of sign-bit and 8-bit value. - // bit: 8 7 ... 0 - // sign \8-bit/ - // - // Meanwhile USB HID mouse indicates 8bit data(-127 to 127), note that -128 is not used. - // - // This converts PS/2 data into HID value. Use only -127-127 out of PS/2 9-bit. - mouse_report->x *= PS2_MOUSE_X_MULTIPLIER; - mouse_report->y *= PS2_MOUSE_Y_MULTIPLIER; - mouse_report->x = X_IS_NEG ? ((!X_IS_OVF && -127 <= mouse_report->x && mouse_report->x <= -1) ? mouse_report->x : -127) : ((!X_IS_OVF && 0 <= mouse_report->x && mouse_report->x <= 127) ? mouse_report->x : 127); - mouse_report->y = Y_IS_NEG ? ((!Y_IS_OVF && -127 <= mouse_report->y && mouse_report->y <= -1) ? mouse_report->y : -127) : ((!Y_IS_OVF && 0 <= mouse_report->y && mouse_report->y <= 127) ? mouse_report->y : 127); -#else +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) + +static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_report, report_mouse_t *mouse_report) +{ + bool x_sign = ps2_report->head.b.x_sign; + bool y_sign = ps2_report->head.b.y_sign; + bool left_button = ps2_report->head.b.left_button; + bool right_button = ps2_report->head.b.right_button; + bool middle_button = ps2_report->head.b.middle_button; + + // PS/2 mouse data is '9-bit integer'(-256 to 255), comprised of sign-bit and 8-bit value. // Sign extend if negative, otherwise leave positive 8-bits as-is - mouse_report->x = X_IS_NEG ? (mouse_report->x | ~0xFF) : mouse_report->x; - mouse_report->y = Y_IS_NEG ? (mouse_report->y | ~0xFF) : mouse_report->y; - mouse_report->x *= PS2_MOUSE_X_MULTIPLIER; - mouse_report->y *= PS2_MOUSE_Y_MULTIPLIER; -#endif + int16_t x = x_sign ? (ps2_report->x | ~0xFF) : ps2_report->x; + int16_t y = y_sign ? (ps2_report->y | ~0xFF) : ps2_report->y; + + x *= PS2_MOUSE_X_MULTIPLIER; + y *= PS2_MOUSE_Y_MULTIPLIER; + + // Constrain xy values to valid range + mouse_report->x = min(max(XY_REPORT_MIN, x), XY_REPORT_MAX); + mouse_report->y = min(max(XY_REPORT_MIN, y), XY_REPORT_MAX); + + // invert coordinate of y to conform to USB HID mouse + mouse_report->y = -mouse_report->y; + +#ifdef PS2_MOUSE_ENABLE_SCROLLING + mouse_report->v = -(ps2_report->z & PS2_MOUSE_SCROLL_MASK); mouse_report->v *= PS2_MOUSE_V_MULTIPLIER; +#endif #ifdef PS2_MOUSE_INVERT_BUTTONS // swap left & right buttons - bool needs_left = mouse_report->buttons & (1 << PS2_MOUSE_BTN_RIGHT); - bool needs_right = mouse_report->buttons & (1 << PS2_MOUSE_BTN_LEFT); - mouse_report->buttons = (mouse_report->buttons & ~((1 << PS2_MOUSE_BTN_LEFT) | (1 << PS2_MOUSE_BTN_RIGHT))) | (needs_left << PS2_MOUSE_BTN_LEFT) | (needs_right << PS2_MOUSE_BTN_RIGHT); + if (left_button) + mouse_report->buttons |= MOUSE_BTN2; + if (right_button) + mouse_report->buttons |= MOUSE_BTN1; +#else + if (left_button) + mouse_report->buttons |= MOUSE_BTN1; + if (right_button) + mouse_report->buttons |= MOUSE_BTN2; #endif - // remove sign and overflow flags - mouse_report->buttons &= PS2_MOUSE_BTN_MASK; - // invert coordinate of y to conform to USB HID mouse - mouse_report->y = -mouse_report->y; + if (middle_button) + mouse_report->buttons |= MOUSE_BTN3; } static inline void ps2_mouse_enable_scrolling(void) { diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index c76588c707f..4db7c5c8d2a 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -21,6 +21,7 @@ along with this program. If not, see . #include #include "debug.h" #include "report.h" +#include "pointing_device_internal.h" #define PS2_MOUSE_SEND(command, message) \ do { \ @@ -69,23 +70,38 @@ __attribute__((unused)) static enum ps2_mouse_mode_e { * 0|[Yovflw][Xovflw][Ysign ][Xsign ][ 1 ][Middle][Right ][Left ] * 1|[ X movement(0-255) ] * 2|[ Y movement(0-255) ] + * + * if PS2_MOUSE_ENABLE_SCROLLING: + * 3|[ Z movement(0-255) ] */ -#define PS2_MOUSE_BTN_MASK 0x07 -#define PS2_MOUSE_BTN_LEFT 0 -#define PS2_MOUSE_BTN_RIGHT 1 -#define PS2_MOUSE_BTN_MIDDLE 2 -#define PS2_MOUSE_X_SIGN 4 -#define PS2_MOUSE_Y_SIGN 5 -#define PS2_MOUSE_X_OVFLW 6 -#define PS2_MOUSE_Y_OVFLW 7 - -/* divide virtical and horizontal mouse move by this to convert to scroll move */ -#ifndef PS2_MOUSE_SCROLL_DIVISOR_V -# define PS2_MOUSE_SCROLL_DIVISOR_V 2 +typedef struct __attribute__((packed)) { + union { + struct { + bool left_button : 1; + bool right_button : 1; + bool middle_button : 1; + bool always_one : 1; + bool x_sign : 1; + bool y_sign : 1; + bool x_overflow : 1; + bool y_overflow : 1; + } b; + uint8_t w; + } head; + uint8_t x; + uint8_t y; +#ifdef PS2_MOUSE_ENABLE_SCROLLING + uint8_t z; #endif -#ifndef PS2_MOUSE_SCROLL_DIVISOR_H -# define PS2_MOUSE_SCROLL_DIVISOR_H 2 +} ps2_mouse_report_t; + +#ifdef PS2_MOUSE_ENABLE_SCROLLING +_Static_assert(sizeof(ps2_mouse_report_t) == 4, "ps2_mouse_report_t must be 4 bytes in size"); +#else +_Static_assert(sizeof(ps2_mouse_report_t) == 3, "ps2_mouse_report_t must be 3 bytes in size"); #endif +_Static_assert(sizeof((ps2_mouse_report_t){0}.head) == 1, "ps2_mouse_report_t.head must be 1 byte in size"); + /* multiply reported mouse values by these */ #ifndef PS2_MOUSE_X_MULTIPLIER # define PS2_MOUSE_X_MULTIPLIER 1 From 0183e0f1dcd6e4aebb1571086151facedfda0160 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Mon, 4 Dec 2023 22:24:57 +0100 Subject: [PATCH 12/19] Protect debug print logic in POINTING_DEVICE_DEBUG --- drivers/ps2/ps2_mouse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index c1199d0da8b..19a84e41c2d 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -93,6 +93,7 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { ps2_mouse_convert_report_to_hid(&ps2_report, &new_report); +#ifdef POINTING_DEVICE_DEBUG if (has_mouse_report_changed(&new_report, &mouse_report)) { pd_dprintf("ps2_mouse: raw x=%02x y=%02x head=0x%02x [left=%u right=%u middle=%u one=%u x_sign=%u y_sign=%u x_ovf=%u y_ovf=%u]\n", ps2_report.x, ps2_report.y, @@ -108,6 +109,7 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { pd_dprintf("ps2_mouse: hid x=%d y=%d v=%d h=%d buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); } +#endif return new_report; } From 0fc394a2a588ec282e0790432eed4cdb8f329d18 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Mon, 4 Dec 2023 22:49:40 +0100 Subject: [PATCH 13/19] Decouple PS/2 PIO driver from PS2_MOUSE --- .../chibios/drivers/vendor/RP/RP2040/ps2_vendor.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/ps2_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/ps2_vendor.c index 1c61f196bde..83650899feb 100644 --- a/platforms/chibios/drivers/vendor/RP/RP2040/ps2_vendor.c +++ b/platforms/chibios/drivers/vendor/RP/RP2040/ps2_vendor.c @@ -11,16 +11,6 @@ # error PIO Driver is only available for Raspberry Pi 2040 MCUs! #endif -#if defined(PS2_ENABLE) -# if defined(PS2_MOUSE_ENABLE) -# if !defined(PS2_MOUSE_USE_REMOTE_MODE) -# define BUFFERED_MODE_ENABLE -# endif -# else // PS2 Keyboard -# define BUFFERED_MODE_ENABLE -# endif -#endif - #if PS2_DATA_PIN + 1 != PS2_CLOCK_PIN # error PS/2 clock pin must be data pin + 1! #endif @@ -240,8 +230,6 @@ uint8_t ps2_host_recv_response(void) { return ps2_get_data_from_frame(frame); } -#ifdef BUFFERED_MODE_ENABLE - bool pbuf_has_data(void) { osalSysLock(); bool has_data = !ibqIsEmptyI(&pio_rx_queue); @@ -266,5 +254,3 @@ uint8_t ps2_host_recv(void) { return frame != 0 ? ps2_get_data_from_frame(frame) : 0; } - -#endif From 1a5011cff86425684625dcb2e2d49bfc541f5c00 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Wed, 13 Dec 2023 22:14:34 +0100 Subject: [PATCH 14/19] Remove PS2_MOUSE_ENABLE --- builddefs/common_features.mk | 5 +---- builddefs/show_options.mk | 1 - data/mappings/info_rules.hjson | 2 +- data/schemas/keyboard.jsonschema | 1 - quantum/action.c | 10 +--------- 5 files changed, 3 insertions(+), 16 deletions(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 9438ce48499..25670a45647 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -799,10 +799,7 @@ ifeq ($(strip $(UNICODE_COMMON)), yes) endif ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes) - PS2_ENABLE := yes - MOUSE_ENABLE := yes - SRC += ps2_mouse.c - OPT_DEFS += -DPS2_MOUSE_ENABLE + $(call CATASTROPHIC_ERROR,PS2_MOUSE has migrated to pointing device,Please see docs/feature_pointing_device.md for more information.) endif VALID_PS2_DRIVER_TYPES := busywait interrupt usart vendor diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk index 81d8400a806..2e5ea9a19ff 100644 --- a/builddefs/show_options.mk +++ b/builddefs/show_options.mk @@ -63,7 +63,6 @@ OTHER_OPTION_NAMES = \ LCD_BACKLIGHT_ENABLE \ MACROS_ENABLED \ PS2_ENABLE \ - PS2_MOUSE_ENABLE \ PS2_DRIVER \ RAW_ENABLE \ SWAP_HANDS_ENABLE \ diff --git a/data/mappings/info_rules.hjson b/data/mappings/info_rules.hjson index fc25eb3328b..487c5588e93 100644 --- a/data/mappings/info_rules.hjson +++ b/data/mappings/info_rules.hjson @@ -35,7 +35,6 @@ "PLATFORM_KEY": {"info_key": "platform_key", "to_json": false}, "PS2_DRIVER": {"info_key": "ps2.driver"}, "PS2_ENABLE": {"info_key": "ps2.enabled", "value_type": "bool"}, - "PS2_MOUSE_ENABLE": {"info_key": "ps2.mouse_enabled", "value_type": "bool"}, "RGB_MATRIX_DRIVER": {"info_key": "rgb_matrix.driver"}, "RGBLIGHT_DRIVER": {"info_key": "rgblight.driver"}, "SECURE_ENABLE": {"info_key": "secure.enabled", "value_type": "bool"}, @@ -51,4 +50,5 @@ "CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, "CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, "VIAL_ENABLE": {"info_key": "_invalid.vial", "invalid": true} + "PS2_MOUSE_ENABLE": {"info_key": "_invalid.ps2.mouse_enabled", "inivalid": true}, } diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index e52ba032f28..36ebca86f6f 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -690,7 +690,6 @@ "additionalProperties": false, "properties": { "enabled": {"type": "boolean"}, - "mouse_enabled": {"type": "boolean"}, "clock_pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, "data_pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, "driver": { diff --git a/quantum/action.c b/quantum/action.c index 8e027ccf378..4fcdffa960b 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -329,7 +329,7 @@ void register_mouse(uint8_t mouse_keycode, bool pressed) { } // should mousekeys send report, or does something else handle this? switch (mouse_keycode) { -# if defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE) +# if defined(POINTING_DEVICE_ENABLE) case KC_MS_BTN1 ... KC_MS_BTN8: // let pointing device handle the buttons // expand if/when it handles more of the code @@ -349,14 +349,6 @@ void register_mouse(uint8_t mouse_keycode, bool pressed) { pointing_device_keycode_handler(mouse_keycode, pressed); } #endif - -#ifdef PS2_MOUSE_ENABLE - // make sure that ps2 mouse has button report synced - if (KC_MS_BTN1 <= mouse_keycode && mouse_keycode <= KC_MS_BTN3) { - uint8_t tmp_button_msk = MOUSE_BTN_MASK(mouse_keycode - KC_MS_BTN1); - tp_buttons = pressed ? tp_buttons | tmp_button_msk : tp_buttons & ~tmp_button_msk; - } -#endif } /** \brief Take an action and processes it. From fd4baf3200f39bc63daf90e0eb04cee5173391b1 Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Wed, 13 Dec 2023 22:20:18 +0100 Subject: [PATCH 15/19] Minor cleanup --- drivers/ps2/ps2_mouse.c | 74 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 19a84e41c2d..04acf780462 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -27,7 +27,7 @@ along with this program. If not, see . #include "pointing_device.h" #include "pointing_device_internal.h" -/* ============================= MACROS ============================ */ +/* ============================= HELPERS ============================ */ static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_report, report_mouse_t *mouse_report); static inline void ps2_mouse_enable_scrolling(void); @@ -149,6 +149,42 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate"); } +/* Note: PS/2 mouse uses counts/mm */ +uint16_t ps2_mouse_get_cpi(void) { + uint8_t rcv, cpm; + rcv = ps2_host_send(PS2_MOUSE_STATUS_REQUEST); + if (rcv == PS2_ACK) { + rcv = ps2_host_recv_response(); + cpm = ps2_host_recv_response(); + rcv = ps2_host_recv_response(); + + return (1 << cpm); + } + + return 0; +} + +/* Note: PS/2 mouse uses counts/mm */ +void ps2_mouse_set_cpi(uint16_t cpi) { + switch (cpi) { + case 1: + ps2_mouse_set_resolution(PS2_MOUSE_1_COUNT_MM); + break; + case 2: + ps2_mouse_set_resolution(PS2_MOUSE_2_COUNT_MM); + break; + case 4: + ps2_mouse_set_resolution(PS2_MOUSE_4_COUNT_MM); + break; + case 8: + ps2_mouse_set_resolution(PS2_MOUSE_8_COUNT_MM); + break; + default: + pd_dprintf("ps2_mouse: invalid cpi: %u\n", cpi); + break; + } +} + /* ============================= HELPERS ============================ */ #define min(a,b) ((a)<(b)?(a):(b)) @@ -178,6 +214,7 @@ static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_repor mouse_report->y = -mouse_report->y; #ifdef PS2_MOUSE_ENABLE_SCROLLING + // Valid z values are in the range -8 to +7 mouse_report->v = -(ps2_report->z & PS2_MOUSE_SCROLL_MASK); mouse_report->v *= PS2_MOUSE_V_MULTIPLIER; #endif @@ -210,38 +247,3 @@ static inline void ps2_mouse_enable_scrolling(void) { wait_ms(20); } -/* Note: PS/2 mouse uses counts/mm */ -uint16_t ps2_mouse_get_cpi(void) { - uint8_t rcv, cpm; - rcv = ps2_host_send(PS2_MOUSE_STATUS_REQUEST); - if (rcv == PS2_ACK) { - rcv = ps2_host_recv_response(); - cpm = ps2_host_recv_response(); - rcv = ps2_host_recv_response(); - - return (1 << cpm); - } - - return 0; -} - -/* Note: PS/2 mouse uses counts/mm */ -void ps2_mouse_set_cpi(uint16_t cpi) { - switch (cpi) { - case 1: - ps2_mouse_set_resolution(PS2_MOUSE_1_COUNT_MM); - break; - case 2: - ps2_mouse_set_resolution(PS2_MOUSE_2_COUNT_MM); - break; - case 4: - ps2_mouse_set_resolution(PS2_MOUSE_4_COUNT_MM); - break; - case 8: - ps2_mouse_set_resolution(PS2_MOUSE_8_COUNT_MM); - break; - default: - pd_dprintf("ps2_mouse: invalid cpi: %u\n", cpi); - break; - } -} From 35affa6ac05dcdaf79a59cf175d21e78614b5c3a Mon Sep 17 00:00:00 2001 From: "Johannes H. Jensen" Date: Wed, 13 Dec 2023 23:13:53 +0100 Subject: [PATCH 16/19] Make linter happy --- drivers/ps2/ps2_mouse.c | 56 ++++++++++++++--------------------------- drivers/ps2/ps2_mouse.h | 14 +++++------ 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 04acf780462..d69f249e4d1 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -62,7 +62,7 @@ void ps2_mouse_init(void) { } report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { - report_mouse_t new_report = {}; + report_mouse_t new_report = {}; ps2_mouse_report_t ps2_report = {}; /* receives packet from mouse */ @@ -71,8 +71,8 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { rcv = ps2_host_send(PS2_MOUSE_READ_DATA); if (rcv == PS2_ACK) { ps2_report.head.w = ps2_host_recv_response(); - ps2_report.x = ps2_host_recv_response(); - ps2_report.y = ps2_host_recv_response(); + ps2_report.x = ps2_host_recv_response(); + ps2_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING ps2_report.z = ps2_host_recv_response(); # endif @@ -83,10 +83,10 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { /* Streaming mode */ if (pbuf_has_data()) { ps2_report.head.w = ps2_host_recv_response(); - ps2_report.x = ps2_host_recv_response(); - ps2_report.y = ps2_host_recv_response(); + ps2_report.x = ps2_host_recv_response(); + ps2_report.y = ps2_host_recv_response(); # ifdef PS2_MOUSE_ENABLE_SCROLLING - ps2_report.z = ps2_host_recv_response(); + ps2_report.z = ps2_host_recv_response(); # endif } #endif @@ -95,17 +95,7 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { #ifdef POINTING_DEVICE_DEBUG if (has_mouse_report_changed(&new_report, &mouse_report)) { - pd_dprintf("ps2_mouse: raw x=%02x y=%02x head=0x%02x [left=%u right=%u middle=%u one=%u x_sign=%u y_sign=%u x_ovf=%u y_ovf=%u]\n", - ps2_report.x, ps2_report.y, - ps2_report.head.w, - ps2_report.head.b.left_button, - ps2_report.head.b.right_button, - ps2_report.head.b.middle_button, - ps2_report.head.b.always_one, - ps2_report.head.b.x_sign, - ps2_report.head.b.y_sign, - ps2_report.head.b.x_overflow, - ps2_report.head.b.y_overflow); + pd_dprintf("ps2_mouse: raw x=%02x y=%02x head=0x%02x [left=%u right=%u middle=%u one=%u x_sign=%u y_sign=%u x_ovf=%u y_ovf=%u]\n", ps2_report.x, ps2_report.y, ps2_report.head.w, ps2_report.head.b.left_button, ps2_report.head.b.right_button, ps2_report.head.b.middle_button, ps2_report.head.b.always_one, ps2_report.head.b.x_sign, ps2_report.head.b.y_sign, ps2_report.head.b.x_overflow, ps2_report.head.b.y_overflow); pd_dprintf("ps2_mouse: hid x=%d y=%d v=%d h=%d buttons=%x\n", new_report.x, new_report.y, new_report.v, new_report.h, new_report.buttons); } @@ -114,7 +104,6 @@ report_mouse_t ps2_mouse_get_report(report_mouse_t mouse_report) { return new_report; } - void ps2_mouse_disable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); } @@ -187,15 +176,14 @@ void ps2_mouse_set_cpi(uint16_t cpi) { /* ============================= HELPERS ============================ */ -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) -static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_report, report_mouse_t *mouse_report) -{ - bool x_sign = ps2_report->head.b.x_sign; - bool y_sign = ps2_report->head.b.y_sign; - bool left_button = ps2_report->head.b.left_button; - bool right_button = ps2_report->head.b.right_button; +static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_report, report_mouse_t *mouse_report) { + bool x_sign = ps2_report->head.b.x_sign; + bool y_sign = ps2_report->head.b.y_sign; + bool left_button = ps2_report->head.b.left_button; + bool right_button = ps2_report->head.b.right_button; bool middle_button = ps2_report->head.b.middle_button; // PS/2 mouse data is '9-bit integer'(-256 to 255), comprised of sign-bit and 8-bit value. @@ -221,19 +209,14 @@ static inline void ps2_mouse_convert_report_to_hid(ps2_mouse_report_t *ps2_repor #ifdef PS2_MOUSE_INVERT_BUTTONS // swap left & right buttons - if (left_button) - mouse_report->buttons |= MOUSE_BTN2; - if (right_button) - mouse_report->buttons |= MOUSE_BTN1; + if (left_button) mouse_report->buttons |= MOUSE_BTN2; + if (right_button) mouse_report->buttons |= MOUSE_BTN1; #else - if (left_button) - mouse_report->buttons |= MOUSE_BTN1; - if (right_button) - mouse_report->buttons |= MOUSE_BTN2; + if (left_button) mouse_report->buttons |= MOUSE_BTN1; + if (right_button) mouse_report->buttons |= MOUSE_BTN2; #endif - if (middle_button) - mouse_report->buttons |= MOUSE_BTN3; + if (middle_button) mouse_report->buttons |= MOUSE_BTN3; } static inline void ps2_mouse_enable_scrolling(void) { @@ -246,4 +229,3 @@ static inline void ps2_mouse_enable_scrolling(void) { PS2_MOUSE_SEND(PS2_MOUSE_GET_DEVICE_ID, "Finished enabling scroll wheel"); wait_ms(20); } - diff --git a/drivers/ps2/ps2_mouse.h b/drivers/ps2/ps2_mouse.h index 4db7c5c8d2a..74e9514a959 100644 --- a/drivers/ps2/ps2_mouse.h +++ b/drivers/ps2/ps2_mouse.h @@ -23,9 +23,9 @@ along with this program. If not, see . #include "report.h" #include "pointing_device_internal.h" -#define PS2_MOUSE_SEND(command, message) \ - do { \ - __attribute__((unused)) uint8_t rcv = ps2_host_send(command); \ +#define PS2_MOUSE_SEND(command, message) \ + do { \ + __attribute__((unused)) uint8_t rcv = ps2_host_send(command); \ pd_dprintf("%s command: %X, result: %X, error: %X \n", message, command, rcv, ps2_error); \ } while (0) @@ -52,10 +52,10 @@ along with this program. If not, see . } \ } while (0) -#define PS2_MOUSE_RECEIVE(message) \ - do { \ - __attribute__((unused)) uint8_t rcv = ps2_host_recv_response(); \ - pd_dprintf("%s result: %X, error: %X \n", message, rcv, ps2_error); \ +#define PS2_MOUSE_RECEIVE(message) \ + do { \ + __attribute__((unused)) uint8_t rcv = ps2_host_recv_response(); \ + pd_dprintf("%s result: %X, error: %X \n", message, rcv, ps2_error); \ } while (0) __attribute__((unused)) static enum ps2_mouse_mode_e { From 6df16716897b042ac2e27a7ed3eafc8dd043b578 Mon Sep 17 00:00:00 2001 From: Ira Cooper Date: Sun, 24 Mar 2024 17:15:44 -0400 Subject: [PATCH 17/19] feature: Lego. Lego is the ability to compose Svalboard firmwares like legos. Ballpoint and pointball disappear. Because they are just a trackball firmware and a trackpoint firmware, flashed on the correct sides. If there is a blank, it can not be master. Point/point is now a vaild config. DPI Setting for PS/2 is disabled until we figure out how not to have it break the world. --- .github/PULL_REQUEST_TEMPLATE.md | 29 ---- .github/workflows/release.yml | 2 +- builddefs/common_features.mk | 3 +- drivers/ps2/ps2_mouse.c | 5 +- keyboards/svalboard/ballpoint/.noci | 0 keyboards/svalboard/ballpoint/config.h | 90 ----------- keyboards/svalboard/ballpoint/left/config.h | 4 - keyboards/svalboard/ballpoint/left/halconf.h | 26 --- keyboards/svalboard/ballpoint/left/info.json | 116 -------------- keyboards/svalboard/ballpoint/left/mcuconf.h | 19 --- keyboards/svalboard/ballpoint/left/rules.mk | 7 - keyboards/svalboard/ballpoint/right/config.h | 4 - keyboards/svalboard/ballpoint/right/info.json | 116 -------------- keyboards/svalboard/ballpoint/right/rules.mk | 11 -- keyboards/svalboard/ballpoint/rules.mk | 15 -- keyboards/svalboard/config.h | 2 + keyboards/svalboard/mouse/.noci | 0 keyboards/svalboard/mouse/config.h | 150 ------------------ keyboards/svalboard/mouse/halconf.h | 26 --- keyboards/svalboard/mouse/info.json | 112 ------------- keyboards/svalboard/mouse/left/rules.mk | 1 - keyboards/svalboard/mouse/mcuconf.h | 20 --- keyboards/svalboard/mouse/right/rules.mk | 1 - keyboards/svalboard/mouse/rules.mk | 7 - keyboards/svalboard/pointball/.noci | 0 keyboards/svalboard/pointball/config.h | 91 ----------- keyboards/svalboard/pointball/left/config.h | 4 - keyboards/svalboard/pointball/left/info.json | 116 -------------- keyboards/svalboard/pointball/left/rules.mk | 11 -- keyboards/svalboard/pointball/right/config.h | 4 - keyboards/svalboard/pointball/right/halconf.h | 26 --- keyboards/svalboard/pointball/right/info.json | 116 -------------- keyboards/svalboard/pointball/right/mcuconf.h | 19 --- keyboards/svalboard/pointball/right/rules.mk | 7 - keyboards/svalboard/pointball/rules.mk | 15 -- keyboards/svalboard/trackball/config.h | 17 +- keyboards/svalboard/trackball/rules.mk | 3 +- keyboards/svalboard/trackball/trackball.c | 17 ++ keyboards/svalboard/trackpoint/config.h | 29 ++-- keyboards/svalboard/trackpoint/info.json | 6 +- keyboards/svalboard/trackpoint/rules.mk | 6 +- keyboards/svalboard/trackpoint/trackpoint.c | 17 ++ .../pointing_device/pointing_device_drivers.c | 55 +++++-- 43 files changed, 98 insertions(+), 1227 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 keyboards/svalboard/ballpoint/.noci delete mode 100644 keyboards/svalboard/ballpoint/config.h delete mode 100644 keyboards/svalboard/ballpoint/left/config.h delete mode 100644 keyboards/svalboard/ballpoint/left/halconf.h delete mode 100644 keyboards/svalboard/ballpoint/left/info.json delete mode 100644 keyboards/svalboard/ballpoint/left/mcuconf.h delete mode 100644 keyboards/svalboard/ballpoint/left/rules.mk delete mode 100644 keyboards/svalboard/ballpoint/right/config.h delete mode 100644 keyboards/svalboard/ballpoint/right/info.json delete mode 100644 keyboards/svalboard/ballpoint/right/rules.mk delete mode 100644 keyboards/svalboard/ballpoint/rules.mk delete mode 100644 keyboards/svalboard/mouse/.noci delete mode 100644 keyboards/svalboard/mouse/config.h delete mode 100644 keyboards/svalboard/mouse/halconf.h delete mode 100644 keyboards/svalboard/mouse/info.json delete mode 100644 keyboards/svalboard/mouse/left/rules.mk delete mode 100644 keyboards/svalboard/mouse/mcuconf.h delete mode 100644 keyboards/svalboard/mouse/right/rules.mk delete mode 100644 keyboards/svalboard/mouse/rules.mk delete mode 100644 keyboards/svalboard/pointball/.noci delete mode 100644 keyboards/svalboard/pointball/config.h delete mode 100644 keyboards/svalboard/pointball/left/config.h delete mode 100644 keyboards/svalboard/pointball/left/info.json delete mode 100644 keyboards/svalboard/pointball/left/rules.mk delete mode 100644 keyboards/svalboard/pointball/right/config.h delete mode 100644 keyboards/svalboard/pointball/right/halconf.h delete mode 100644 keyboards/svalboard/pointball/right/info.json delete mode 100644 keyboards/svalboard/pointball/right/mcuconf.h delete mode 100644 keyboards/svalboard/pointball/right/rules.mk delete mode 100644 keyboards/svalboard/pointball/rules.mk create mode 100644 keyboards/svalboard/trackball/trackball.c create mode 100644 keyboards/svalboard/trackpoint/trackpoint.c diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 62343131d2d..00000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17e30b7683b..b50c8f760b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,6 @@ jobs: side: ${{ matrix.side }} strategy: matrix: - keyboard: [ svalboard/trackpoint, svalboard, svalboard/trackball, svalboard/ballpoint, svalboard/pointball ] + keyboard: [ svalboard/trackpoint, svalboard, svalboard/trackball ] keymap: [ vial ] side: [ left, right ] diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 25670a45647..70599aa7162 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -121,6 +121,7 @@ ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) endif VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick azoteq_iqs5xx cirque_pinnacle_i2c cirque_pinnacle_spi paw3204 pmw3320 pmw3360 pmw3389 pimoroni_trackball ps2_mouse custom +CUSTOM_TYPES := custom ps2_mouse ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) ifeq ($(filter $(POINTING_DEVICE_DRIVER),$(VALID_POINTING_DEVICE_DRIVER_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid POINTING_DEVICE_DRIVER,POINTING_DEVICE_DRIVER="$(POINTING_DEVICE_DRIVER)" is not a valid pointing device type) @@ -131,7 +132,7 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) SRC += $(QUANTUM_DIR)/pointing_device/pointing_device.c SRC += $(QUANTUM_DIR)/pointing_device/pointing_device_drivers.c SRC += $(QUANTUM_DIR)/pointing_device/pointing_device_auto_mouse.c - ifneq ($(strip $(POINTING_DEVICE_DRIVER)), custom) + ifeq ($(filter $(POINTING_DEVICE_DRIVER), $(CUSTOM_TYPES)),) SRC += drivers/sensors/$(strip $(POINTING_DEVICE_DRIVER)).c OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(shell echo $(POINTING_DEVICE_DRIVER) | tr '[:lower:]' '[:upper:]')) endif diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index d69f249e4d1..fd8c9803f5d 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -140,6 +140,7 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { /* Note: PS/2 mouse uses counts/mm */ uint16_t ps2_mouse_get_cpi(void) { +#if 0 uint8_t rcv, cpm; rcv = ps2_host_send(PS2_MOUSE_STATUS_REQUEST); if (rcv == PS2_ACK) { @@ -149,12 +150,13 @@ uint16_t ps2_mouse_get_cpi(void) { return (1 << cpm); } - +#endif return 0; } /* Note: PS/2 mouse uses counts/mm */ void ps2_mouse_set_cpi(uint16_t cpi) { +#if 0 switch (cpi) { case 1: ps2_mouse_set_resolution(PS2_MOUSE_1_COUNT_MM); @@ -172,6 +174,7 @@ void ps2_mouse_set_cpi(uint16_t cpi) { pd_dprintf("ps2_mouse: invalid cpi: %u\n", cpi); break; } +#endif } /* ============================= HELPERS ============================ */ diff --git a/keyboards/svalboard/ballpoint/.noci b/keyboards/svalboard/ballpoint/.noci deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/keyboards/svalboard/ballpoint/config.h b/keyboards/svalboard/ballpoint/config.h deleted file mode 100644 index 4d504673d79..00000000000 --- a/keyboards/svalboard/ballpoint/config.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2023 Morgan Venable @_claussen - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#pragma once - -/* key matrix size */ -// Rows are doubled-up - -#if defined(POINTING_DEVICE_ENABLE) - - // Pointing device stuff - #define SPLIT_POINTING_ENABLE - #define POINTING_DEVICE_COMBINED - #define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE - - #if defined(POINTING_DEVICE_IS_PIMORONI) - - #define I2C_DRIVER I2CD1 - #define I2C1_SDA_PIN GP18 - #define I2C1_SCL_PIN GP19 - #define PIMORONI_TRACKBALL_SCALE 5 - - #endif - - #if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - // SPI stuff - #define USE_FFC_SPI - - #ifdef USE_FFC_SPI - #define SPI_DRIVER SPID1 - // for FFC connector - #define SPI_SCK_PIN GP26 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP27 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP24 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP25 - #else - //for Separate Pimoroni Connector - #define SPI_DRIVER SPID0 - #define SPI_SCK_PIN GP18 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP19 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP16 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP17 - #endif - #define POINTING_DEVICE_INVERT_X - #define POINTING_DEVICE_ROTATION_90 - #endif -#endif - -//PS2 Trackpoint Setup -#ifdef PS2_MOUSE_ENABLE - //#define SERIAL_PIO_USE_PIO1 - #define PS2_PIO_USE_PIO1 - #define PS2_RESET_PIN GP25 - #define PS2_CLOCK_PIN GP24 - #define PS2_DATA_PIN GP23 - #define PS2_MOUSE_SCROLL_DIVISOR_H 4 - #define PS2_MOUSE_SCROLL_DIVISOR_V 4 - #ifndef PS2_MOUSE_ROTATE - #define PS2_MOUSE_ROTATE 90 - //default is N exit on right hand --270 for N on left see bsa.sh - #endif -// #define PS2_MOUSE_SCROLL_BTN_MASK 0 // just normal middle button for panning and relative scroll - #define PS2_MOUSE_SCROLL_BTN_MASK (1< - -#if defined(POINTING_DEVICE_DRIVER) - -#if defined(POINTING_DEVICE_IS_PIMORONI) - -#undef HAL_USE_I2C -#define HAL_USE_I2C TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - -#undef HAL_USE_SPI -#define HAL_USE_SPI TRUE - -#undef SPI_USE_WAIT -#define SPI_USE_WAIT TRUE - -#undef SPI_SELECT_MODE -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - -#endif -#endif diff --git a/keyboards/svalboard/ballpoint/left/info.json b/keyboards/svalboard/ballpoint/left/info.json deleted file mode 100644 index 63f16dc65c5..00000000000 --- a/keyboards/svalboard/ballpoint/left/info.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "manufacturer": "Svalboard", - "keyboard_name": "svalboard", - "maintainer": "MorganVenable", - "url": "http://svalboard.com", - "bootloader": "rp2040", - "diode_direction": "COL2ROW", - "features": { - "audio": false, - "backlight": false, - "bluetooth": false, - "bootmagic": false, - "command": true, - "console": true, - "extrakey": true, - "fauxclicky": false, - "midi": false, - "mousekey": true, - "nkro": true, - "rgblight": false, - "sleep_led": false, - "unicode": false - }, - "height": 10, - "matrix_pins": { - "cols": ["GP14", "GP13", "GP12", "GP11", "GP10", "GP9"], - "rows": ["GP8", "GP7", "GP6", "GP5", "GP4"] - }, - "mousekey": { - "delay": 150, - "interval": 60, - "max_speed": 5, - "time_to_max": 7 - }, - "processor": "RP2040", - "split": { - "enabled": true, - "transport": { - "protocol": "serial", - "sync_matrix_state": false, - "sync_modifiers": false - } - }, - "tapping": { - "term": 200 - }, - "ps2": { - "enabled": false, - "driver": "vendor" - }, - "usb": { - "device_version": "0.0.2", - "pid": "0x4044", - "polling_interval": 1, - "vid": "0x303A" - }, - "width": 20.5, - "layouts": { - "LAYOUT": { - "layout": [ - {"label": "r1c", "matrix": [1, 2], "x": 0.5, "y": 1.5}, - {"label": "r1n", "matrix": [1, 3], "x": 0.5, "y": 1, "h": 0.5}, - {"label": "r1e", "matrix": [1, 1], "x": 1.5, "y": 1.5, "w": 0.5}, - {"label": "r1s", "matrix": [1, 0], "x": 0.5, "y": 2.5, "h": 0.5}, - {"label": "r1w", "matrix": [1, 4], "x": 0, "y": 1.5, "w": 0.5}, - {"label": "r2c", "matrix": [2, 2], "x": 2.5, "y": 1}, - {"label": "r2n", "matrix": [2, 3], "x": 2.5, "y": 0.5, "h": 0.5}, - {"label": "r2e", "matrix": [2, 1], "x": 3.5, "y": 1, "w": 0.5}, - {"label": "r2s", "matrix": [2, 0], "x": 2.5, "y": 2, "h": 0.5}, - {"label": "r2w", "matrix": [2, 4], "x": 2, "y": 1, "w": 0.5}, - {"label": "r3c", "matrix": [3, 2], "x": 4.5, "y": 0.5}, - {"label": "r3n", "matrix": [3, 3], "x": 4.5, "y": 0, "h": 0.5}, - {"label": "r3e", "matrix": [3, 1], "x": 5.5, "y": 0.5, "w": 0.5}, - {"label": "r3s", "matrix": [3, 0], "x": 4.5, "y": 1.5, "h": 0.5}, - {"label": "r3w", "matrix": [3, 4], "x": 4, "y": 0.5, "w": 0.5}, - {"label": "r4c", "matrix": [4, 2], "x": 6.5, "y": 1}, - {"label": "r4n", "matrix": [4, 3], "x": 6.5, "y": 0.5, "h": 0.5}, - {"label": "r4e", "matrix": [4, 1], "x": 7.5, "y": 1, "w": 0.5}, - {"label": "r4s", "matrix": [4, 0], "x": 6.5, "y": 2, "h": 0.5}, - {"label": "r4w", "matrix": [4, 4], "x": 6, "y": 1, "w": 0.5}, - {"label": "l1c", "matrix": [6, 2], "x": 8.5, "y": 4, "h": 2}, - {"label": "l1n", "matrix": [6, 3], "x": 8, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1e", "matrix": [6, 1], "x": 7.5, "y": 3.5, "w": 0.5}, - {"label": "l1w", "matrix": [6, 0], "x": 9.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1s", "matrix": [6, 4], "x": 9.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2c", "matrix": [7, 2], "x": 8.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2n", "matrix": [7, 3], "x": 11, "y": 4, "h": 2}, - {"label": "l2e", "matrix": [7, 1], "x": 12, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l2w", "matrix": [7, 0], "x": 12.5, "y": 3.5, "w": 0.5}, - {"label": "l2s", "matrix": [7, 4], "x": 10.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l3c", "matrix": [8, 2], "x": 10.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3n", "matrix": [8, 3], "x": 11, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3e", "matrix": [8, 1], "x": 13, "y": 1}, - {"label": "l3w", "matrix": [8, 0], "x": 13, "y": 0.5, "h": 0.5}, - {"label": "l3s", "matrix": [8, 4], "x": 12.5, "y": 1, "w": 0.5}, - {"label": "l4c", "matrix": [9, 2], "x": 13, "y": 2, "h": 0.5}, - {"label": "l4n", "matrix": [9, 3], "x": 14, "y": 1, "w": 0.5}, - {"label": "l4e", "matrix": [9, 1], "x": 15, "y": 0.5}, - {"label": "l4s", "matrix": [9, 0], "x": 15, "y": 0, "h": 0.5}, - {"label": "l4w", "matrix": [9, 4], "x": 16, "y": 0.5, "w": 0.5}, - {"label": "rtd", "matrix": [0, 2], "x": 15, "y": 1.5, "h": 0.5}, - {"label": "rti", "matrix": [0, 3], "x": 14.5, "y": 0.5, "w": 0.5}, - {"label": "rtu", "matrix": [0, 4], "x": 17, "y": 1}, - {"label": "rtuo", "matrix": [0, 1], "x": 17, "y": 0.5, "h": 0.5}, - {"label": "rtlo", "matrix": [0, 0], "x": 18, "y": 1, "w": 0.5}, - {"label": "rtdd", "matrix": [0, 5], "x": 17, "y": 2, "h": 0.5}, - {"label": "ltd", "matrix": [5, 2], "x": 16.5, "y": 1, "w": 0.5}, - {"label": "lti", "matrix": [5, 3], "x": 19, "y": 1.5}, - {"label": "ltu", "matrix": [5, 4], "x": 19, "y": 1, "h": 0.5}, - {"label": "ltuo", "matrix": [5, 1], "x": 20, "y": 1.5, "w": 0.5}, - {"label": "ltlo", "matrix": [5, 0], "x": 19, "y": 2.5, "h": 0.5}, - {"label": "ltdd", "matrix": [5, 5], "x": 18.5, "y": 1.5, "w": 0.5} - ] - } - } -} \ No newline at end of file diff --git a/keyboards/svalboard/ballpoint/left/mcuconf.h b/keyboards/svalboard/ballpoint/left/mcuconf.h deleted file mode 100644 index 231550b3672..00000000000 --- a/keyboards/svalboard/ballpoint/left/mcuconf.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include_next "mcuconf.h" - -#if defined(POINTING_DEVICE_IS_PIMORONI) -// TODO I2C0 does not work, for some reason. -#undef RP_I2C_USE_I2C1 -#define RP_I2C_USE_I2C1 TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - #ifdef USE_FFC_SPI - #undef RP_SPI_USE_SPI1 - #define RP_SPI_USE_SPI1 TRUE - #else - #undef RP_SPI_USE_SPI0 - #define RP_SPI_USE_SPI0 TRUE - #endif -#endif \ No newline at end of file diff --git a/keyboards/svalboard/ballpoint/left/rules.mk b/keyboards/svalboard/ballpoint/left/rules.mk deleted file mode 100644 index fcf25389f73..00000000000 --- a/keyboards/svalboard/ballpoint/left/rules.mk +++ /dev/null @@ -1,7 +0,0 @@ -OPT_DEFS += -DINIT_EE_HANDS_LEFT -# this turns on trackballs including pimoroni -POINTING_DEVICE_ENABLE = yes -# this selects trackball driver -POINTING_DEVICE_DRIVER = pmw3360 -# pimoroni_trackball -# pmw3389 diff --git a/keyboards/svalboard/ballpoint/right/config.h b/keyboards/svalboard/ballpoint/right/config.h deleted file mode 100644 index 1ab09780e05..00000000000 --- a/keyboards/svalboard/ballpoint/right/config.h +++ /dev/null @@ -1,4 +0,0 @@ -#define SERIAL_USART_TX_PIN GP1 -#define SERIAL_USART_RX_PIN GP0 -#define SERIAL_USART_FULL_DUPLEX -#define SERIAL_PIO_USE_PIO0 \ No newline at end of file diff --git a/keyboards/svalboard/ballpoint/right/info.json b/keyboards/svalboard/ballpoint/right/info.json deleted file mode 100644 index fedaad01bcf..00000000000 --- a/keyboards/svalboard/ballpoint/right/info.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "manufacturer": "Svalboard", - "keyboard_name": "svalboard", - "maintainer": "MorganVenable", - "url": "http://svalboard.com", - "bootloader": "rp2040", - "diode_direction": "COL2ROW", - "features": { - "audio": false, - "backlight": false, - "bluetooth": false, - "bootmagic": false, - "command": true, - "console": true, - "extrakey": true, - "fauxclicky": false, - "midi": false, - "mousekey": true, - "nkro": true, - "rgblight": false, - "sleep_led": false, - "unicode": false - }, - "height": 10, - "matrix_pins": { - "cols": ["GP14", "GP13", "GP12", "GP11", "GP10", "GP9"], - "rows": ["GP8", "GP7", "GP6", "GP5", "GP4"] - }, - "mousekey": { - "delay": 150, - "interval": 60, - "max_speed": 5, - "time_to_max": 7 - }, - "processor": "RP2040", - "split": { - "enabled": true, - "transport": { - "protocol": "serial", - "sync_matrix_state": false, - "sync_modifiers": false - } - }, - "tapping": { - "term": 200 - }, - "ps2": { - "enabled": true, - "driver": "vendor" - }, - "usb": { - "device_version": "0.0.2", - "pid": "0x4044", - "polling_interval": 1, - "vid": "0x303A" - }, - "width": 20.5, - "layouts": { - "LAYOUT": { - "layout": [ - {"label": "r1c", "matrix": [1, 2], "x": 0.5, "y": 1.5}, - {"label": "r1n", "matrix": [1, 3], "x": 0.5, "y": 1, "h": 0.5}, - {"label": "r1e", "matrix": [1, 1], "x": 1.5, "y": 1.5, "w": 0.5}, - {"label": "r1s", "matrix": [1, 0], "x": 0.5, "y": 2.5, "h": 0.5}, - {"label": "r1w", "matrix": [1, 4], "x": 0, "y": 1.5, "w": 0.5}, - {"label": "r2c", "matrix": [2, 2], "x": 2.5, "y": 1}, - {"label": "r2n", "matrix": [2, 3], "x": 2.5, "y": 0.5, "h": 0.5}, - {"label": "r2e", "matrix": [2, 1], "x": 3.5, "y": 1, "w": 0.5}, - {"label": "r2s", "matrix": [2, 0], "x": 2.5, "y": 2, "h": 0.5}, - {"label": "r2w", "matrix": [2, 4], "x": 2, "y": 1, "w": 0.5}, - {"label": "r3c", "matrix": [3, 2], "x": 4.5, "y": 0.5}, - {"label": "r3n", "matrix": [3, 3], "x": 4.5, "y": 0, "h": 0.5}, - {"label": "r3e", "matrix": [3, 1], "x": 5.5, "y": 0.5, "w": 0.5}, - {"label": "r3s", "matrix": [3, 0], "x": 4.5, "y": 1.5, "h": 0.5}, - {"label": "r3w", "matrix": [3, 4], "x": 4, "y": 0.5, "w": 0.5}, - {"label": "r4c", "matrix": [4, 2], "x": 6.5, "y": 1}, - {"label": "r4n", "matrix": [4, 3], "x": 6.5, "y": 0.5, "h": 0.5}, - {"label": "r4e", "matrix": [4, 1], "x": 7.5, "y": 1, "w": 0.5}, - {"label": "r4s", "matrix": [4, 0], "x": 6.5, "y": 2, "h": 0.5}, - {"label": "r4w", "matrix": [4, 4], "x": 6, "y": 1, "w": 0.5}, - {"label": "l1c", "matrix": [6, 2], "x": 8.5, "y": 4, "h": 2}, - {"label": "l1n", "matrix": [6, 3], "x": 8, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1e", "matrix": [6, 1], "x": 7.5, "y": 3.5, "w": 0.5}, - {"label": "l1w", "matrix": [6, 0], "x": 9.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1s", "matrix": [6, 4], "x": 9.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2c", "matrix": [7, 2], "x": 8.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2n", "matrix": [7, 3], "x": 11, "y": 4, "h": 2}, - {"label": "l2e", "matrix": [7, 1], "x": 12, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l2w", "matrix": [7, 0], "x": 12.5, "y": 3.5, "w": 0.5}, - {"label": "l2s", "matrix": [7, 4], "x": 10.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l3c", "matrix": [8, 2], "x": 10.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3n", "matrix": [8, 3], "x": 11, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3e", "matrix": [8, 1], "x": 13, "y": 1}, - {"label": "l3w", "matrix": [8, 0], "x": 13, "y": 0.5, "h": 0.5}, - {"label": "l3s", "matrix": [8, 4], "x": 12.5, "y": 1, "w": 0.5}, - {"label": "l4c", "matrix": [9, 2], "x": 13, "y": 2, "h": 0.5}, - {"label": "l4n", "matrix": [9, 3], "x": 14, "y": 1, "w": 0.5}, - {"label": "l4e", "matrix": [9, 1], "x": 15, "y": 0.5}, - {"label": "l4s", "matrix": [9, 0], "x": 15, "y": 0, "h": 0.5}, - {"label": "l4w", "matrix": [9, 4], "x": 16, "y": 0.5, "w": 0.5}, - {"label": "rtd", "matrix": [0, 2], "x": 15, "y": 1.5, "h": 0.5}, - {"label": "rti", "matrix": [0, 3], "x": 14.5, "y": 0.5, "w": 0.5}, - {"label": "rtu", "matrix": [0, 4], "x": 17, "y": 1}, - {"label": "rtuo", "matrix": [0, 1], "x": 17, "y": 0.5, "h": 0.5}, - {"label": "rtlo", "matrix": [0, 0], "x": 18, "y": 1, "w": 0.5}, - {"label": "rtdd", "matrix": [0, 5], "x": 17, "y": 2, "h": 0.5}, - {"label": "ltd", "matrix": [5, 2], "x": 16.5, "y": 1, "w": 0.5}, - {"label": "lti", "matrix": [5, 3], "x": 19, "y": 1.5}, - {"label": "ltu", "matrix": [5, 4], "x": 19, "y": 1, "h": 0.5}, - {"label": "ltuo", "matrix": [5, 1], "x": 20, "y": 1.5, "w": 0.5}, - {"label": "ltlo", "matrix": [5, 0], "x": 19, "y": 2.5, "h": 0.5}, - {"label": "ltdd", "matrix": [5, 5], "x": 18.5, "y": 1.5, "w": 0.5} - ] - } - } -} \ No newline at end of file diff --git a/keyboards/svalboard/ballpoint/right/rules.mk b/keyboards/svalboard/ballpoint/right/rules.mk deleted file mode 100644 index 7ab04b882f9..00000000000 --- a/keyboards/svalboard/ballpoint/right/rules.mk +++ /dev/null @@ -1,11 +0,0 @@ -OPT_DEFS += -DINIT_EE_HANDS_RIGHT -# # this turns on trackpoint: -PS2_MOUSE_ENABLE = yes -# # this turns on Manna-Harbour's automousekeys: -MH_AUTO_BUTTONS = yes -# # this selects trackball driver - -POINTING_DEVICE_ENABLE = yes -POINTING_DEVICE_DRIVER = custom -# this selects trackball driver -#POINTING_DEVICE_DRIVER = pmw3360 \ No newline at end of file diff --git a/keyboards/svalboard/ballpoint/rules.mk b/keyboards/svalboard/ballpoint/rules.mk deleted file mode 100644 index c513a5e4f6e..00000000000 --- a/keyboards/svalboard/ballpoint/rules.mk +++ /dev/null @@ -1,15 +0,0 @@ -POINTING_DEVICE_ENABLE = yes -# this selects trackball driver -POINTING_DEVICE_DRIVER = pmw3360 - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pimoroni_trackball) - OPT_DEFS += -DPOINTING_DEVICE_IS_PIMORONI -endif - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3360) - OPT_DEFS += -DPOINTING_DEVICE_IS_PMW3360 -endif - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3389) - OPT_DEFS += -DPOINTING_DEVICE_IS_PMW3389 -endif \ No newline at end of file diff --git a/keyboards/svalboard/config.h b/keyboards/svalboard/config.h index eeee124d479..9520c5d55a6 100644 --- a/keyboards/svalboard/config.h +++ b/keyboards/svalboard/config.h @@ -56,6 +56,7 @@ along with this program. If not, see . #define USB_SUSPEND_WAKEUP_DELAY 500 #define SELECT_SOFT_SERIAL_RATE {0} +#define MOUSE_EXTENDED_REPORT #define SPLIT_POINTING_ENABLE #define POINTING_DEVICE_COMBINED #define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE @@ -66,3 +67,4 @@ along with this program. If not, see . // hub, KVM, or a machine that boots slowly (ECC RAM), the keyboard no longer // needs to be reset to come to life. #define SPLIT_WATCHDOG_ENABLE + diff --git a/keyboards/svalboard/mouse/.noci b/keyboards/svalboard/mouse/.noci deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/keyboards/svalboard/mouse/config.h b/keyboards/svalboard/mouse/config.h deleted file mode 100644 index 225bbf24f4f..00000000000 --- a/keyboards/svalboard/mouse/config.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -Copyright 2023 Morgan Venable @_claussen - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#pragma once - -/* key matrix size */ -// Rows are doubled-up -#define MATRIX_ROWS 10 -#define MATRIX_COLS 6 -#define PFET_ROWS -#define EE_HANDS -#define FORCE_NKRO -#undef PS2_MOUSE_ENABLE -// #ifndef MH_AUTO_BUTTONS -// #define MH_AUTO_BUTTONS -// #endif -#ifndef POINTING_DEVICE_ENABLE -#define POINTING_DEVICE_ENABLE -#endif - -// in config.h: -#define POINTING_DEVICE_AUTO_MOUSE_ENABLE -// only required if not setting mouse layer elsewhere -#define AUTO_MOUSE_DEFAULT_LAYER 5 - -//#define DEBUG_MATRIX_SCAN_RATE - -// wiring of each half -//Layout for svalboard v0 (different from lalboard_v2) -//1 2 3 4 5 6 -//S E D N W None -//Both Thumbs (these are same as lalboard_v2) -//OL OU D IL MODE DOUBLE -//Knuckle Nail Down Pad Up Double -//#define THUMB_DOWN_ACTIVE_DARK - -#ifndef MATRIX_COL_PUSHED_STATES -#define MATRIX_COL_PUSHED_STATES { 0, 0, 1, 0, 0, 0 } -#endif -#define MATRIX_COL_PUSHED_STATES { 0, 0, 1, 0, 0, 0 } -#ifndef MATRIX_COL_PUSHED_STATES_THUMBS - #ifdef THUMB_DOWN_ACTIVE_DARK - #define MATRIX_COL_PUSHED_STATES_THUMBS { 0, 0, 1, 0, 0, 0 } - #else - #define MATRIX_COL_PUSHED_STATES_THUMBS { 0, 0, 0, 0, 0, 0 } - #endif -#endif -#define DOUBLEDOWN_COL 5 // need a pullup on COL6 -#define PREWAIT_US 90 -#define POSTWAIT_US 90 - -#define SERIAL_DEBUG -#define SERIAL_USART_TX_PIN GP0 -#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET -#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500 // Timeout window in ms in which the double tap can occur. - -#ifdef PS2_MOUSE_ENABLE - //#define SERIAL_PIO_USE_PIO1 - #define PS2_PIO_USE_PIO1 - #define PS2_RESET_PIN GP25 - #define PS2_CLOCK_PIN GP24 - #define PS2_DATA_PIN GP23 - #define PS2_MOUSE_ROTATE 270 -#endif - -#if defined(POINTING_DEVICE_ENABLE) - - // Pointing device stuff - #define SPLIT_POINTING_ENABLE - #define POINTING_DEVICE_COMBINED - - #if defined(POINTING_DEVICE_IS_PIMORONI) - - #define I2C_DRIVER I2CD1 - #define I2C1_SDA_PIN GP18 - #define I2C1_SCL_PIN GP19 - #define PIMORONI_TRACKBALL_SCALE 5 - - #endif - - #if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - // SPI stuff - #define USE_FFC_SPI - - #ifdef USE_FFC_SPI - #define SPI_DRIVER SPID1 - // for FFC connector - #define SPI_SCK_PIN GP26 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP27 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP24 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP25 - #else - //for Separate Pimoroni Connector - #define SPI_DRIVER SPID0 - #define SPI_SCK_PIN GP18 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP19 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP16 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP17 - #endif - #define PMW33XX_CS_DIVISOR 4 - #define PMW33XX_CPI 1600 - //#define POINTING_DEVICE_INVERT_Y - #define ROTATIONAL_TRANSFORM_ANGLE_RIGHT 180 - #endif -#endif - -#if defined MH_AUTO_BUTTONS - #define MH_AUTO_BUTTONS_LAYER MBO - #define MH_AUTO_BUTTONS_TIMEOUT 5000 - #define PS2_MOUSE_SCROLL_BTN_MASK 0 - //(1< - -#if defined(POINTING_DEVICE_DRIVER) - -#if defined(POINTING_DEVICE_IS_PIMORONI) - -#undef HAL_USE_I2C -#define HAL_USE_I2C TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - -#undef HAL_USE_SPI -#define HAL_USE_SPI TRUE - -#undef SPI_USE_WAIT -#define SPI_USE_WAIT TRUE - -#undef SPI_SELECT_MODE -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - -#endif -#endif diff --git a/keyboards/svalboard/mouse/info.json b/keyboards/svalboard/mouse/info.json deleted file mode 100644 index 749e27ab77d..00000000000 --- a/keyboards/svalboard/mouse/info.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "manufacturer": "Svalboard", - "keyboard_name": "svalboard", - "maintainer": "MorganVenable", - "url": "http://svalboard.com", - "bootloader": "rp2040", - "diode_direction": "COL2ROW", - "features": { - "audio": false, - "backlight": false, - "bluetooth": false, - "bootmagic": false, - "command": true, - "console": true, - "extrakey": true, - "fauxclicky": false, - "midi": false, - "mousekey": true, - "nkro": true, - "rgblight": false, - "sleep_led": false, - "unicode": false - }, - "height": 10, - "matrix_pins": { - "cols": ["GP14", "GP13", "GP12", "GP11", "GP10", "GP9"], - "rows": ["GP8", "GP7", "GP6", "GP5", "GP4"] - }, - "mousekey": { - "delay": 150, - "interval": 60, - "max_speed": 5, - "time_to_max": 7 - }, - "processor": "RP2040", - "split": { - "enabled": true, - "transport": { - "protocol": "serial", - "sync_matrix_state": false, - "sync_modifiers": false - } - }, - "tapping": { - "term": 200 - }, - "usb": { - "device_version": "0.0.2", - "pid": "0x4044", - "polling_interval": 1, - "vid": "0x303A" - }, - "width": 20.5, - "layouts": { - "LAYOUT": { - "layout": [ - {"label": "r1c", "matrix": [6, 2], "x": 0.5, "y": 1.5}, - {"label": "r1n", "matrix": [6, 3], "x": 0.5, "y": 1, "h": 0.5}, - {"label": "r1e", "matrix": [6, 1], "x": 1.5, "y": 1.5, "w": 0.5}, - {"label": "r1s", "matrix": [6, 0], "x": 0.5, "y": 2.5, "h": 0.5}, - {"label": "r1w", "matrix": [6, 4], "x": 0, "y": 1.5, "w": 0.5}, - {"label": "r2c", "matrix": [7, 2], "x": 2.5, "y": 1}, - {"label": "r2n", "matrix": [7, 3], "x": 2.5, "y": 0.5, "h": 0.5}, - {"label": "r2e", "matrix": [7, 1], "x": 3.5, "y": 1, "w": 0.5}, - {"label": "r2s", "matrix": [7, 0], "x": 2.5, "y": 2, "h": 0.5}, - {"label": "r2w", "matrix": [7, 4], "x": 2, "y": 1, "w": 0.5}, - {"label": "r3c", "matrix": [8, 2], "x": 4.5, "y": 0.5}, - {"label": "r3n", "matrix": [8, 3], "x": 4.5, "y": 0, "h": 0.5}, - {"label": "r3e", "matrix": [8, 1], "x": 5.5, "y": 0.5, "w": 0.5}, - {"label": "r3s", "matrix": [8, 0], "x": 4.5, "y": 1.5, "h": 0.5}, - {"label": "r3w", "matrix": [8, 4], "x": 4, "y": 0.5, "w": 0.5}, - {"label": "r4c", "matrix": [9, 2], "x": 6.5, "y": 1}, - {"label": "r4n", "matrix": [9, 3], "x": 6.5, "y": 0.5, "h": 0.5}, - {"label": "r4e", "matrix": [9, 1], "x": 7.5, "y": 1, "w": 0.5}, - {"label": "r4s", "matrix": [9, 0], "x": 6.5, "y": 2, "h": 0.5}, - {"label": "r4w", "matrix": [9, 4], "x": 6, "y": 1, "w": 0.5}, - {"label": "l1c", "matrix": [1, 2], "x": 8.5, "y": 4, "h": 2}, - {"label": "l1n", "matrix": [1, 3], "x": 8, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1e", "matrix": [1, 1], "x": 7.5, "y": 3.5, "w": 0.5}, - {"label": "l1w", "matrix": [1, 0], "x": 9.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1s", "matrix": [1, 4], "x": 9.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2c", "matrix": [2, 2], "x": 8.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2n", "matrix": [2, 3], "x": 11, "y": 4, "h": 2}, - {"label": "l2e", "matrix": [2, 1], "x": 12, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l2w", "matrix": [2, 0], "x": 12.5, "y": 3.5, "w": 0.5}, - {"label": "l2s", "matrix": [2, 4], "x": 10.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l3c", "matrix": [3, 2], "x": 10.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3n", "matrix": [3, 3], "x": 11, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3e", "matrix": [3, 1], "x": 13, "y": 1}, - {"label": "l3w", "matrix": [3, 0], "x": 13, "y": 0.5, "h": 0.5}, - {"label": "l3s", "matrix": [3, 4], "x": 12.5, "y": 1, "w": 0.5}, - {"label": "l4c", "matrix": [4, 2], "x": 13, "y": 2, "h": 0.5}, - {"label": "l4n", "matrix": [4, 3], "x": 14, "y": 1, "w": 0.5}, - {"label": "l4e", "matrix": [4, 1], "x": 15, "y": 0.5}, - {"label": "l4s", "matrix": [4, 0], "x": 15, "y": 0, "h": 0.5}, - {"label": "l4w", "matrix": [4, 4], "x": 16, "y": 0.5, "w": 0.5}, - {"label": "rtd", "matrix": [5, 2], "x": 15, "y": 1.5, "h": 0.5}, - {"label": "rti", "matrix": [5, 3], "x": 14.5, "y": 0.5, "w": 0.5}, - {"label": "rtu", "matrix": [5, 4], "x": 17, "y": 1}, - {"label": "rtuo", "matrix": [5, 1], "x": 17, "y": 0.5, "h": 0.5}, - {"label": "rtlo", "matrix": [5, 0], "x": 18, "y": 1, "w": 0.5}, - {"label": "rtdd", "matrix": [5, 5], "x": 17, "y": 2, "h": 0.5}, - {"label": "ltd", "matrix": [0, 2], "x": 16.5, "y": 1, "w": 0.5}, - {"label": "lti", "matrix": [0, 3], "x": 19, "y": 1.5}, - {"label": "ltu", "matrix": [0, 4], "x": 19, "y": 1, "h": 0.5}, - {"label": "ltuo", "matrix": [0, 1], "x": 20, "y": 1.5, "w": 0.5}, - {"label": "ltlo", "matrix": [0, 0], "x": 19, "y": 2.5, "h": 0.5}, - {"label": "ltdd", "matrix": [0, 5], "x": 18.5, "y": 1.5, "w": 0.5} - ] - } - } -} \ No newline at end of file diff --git a/keyboards/svalboard/mouse/left/rules.mk b/keyboards/svalboard/mouse/left/rules.mk deleted file mode 100644 index b00079cee5d..00000000000 --- a/keyboards/svalboard/mouse/left/rules.mk +++ /dev/null @@ -1 +0,0 @@ -OPT_DEFS += -DINIT_EE_HANDS_LEFT \ No newline at end of file diff --git a/keyboards/svalboard/mouse/mcuconf.h b/keyboards/svalboard/mouse/mcuconf.h deleted file mode 100644 index c61ba2fcdb6..00000000000 --- a/keyboards/svalboard/mouse/mcuconf.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include_next "mcuconf.h" - -#if defined(POINTING_DEVICE_IS_PIMORONI) -// TODO I2C0 does not work, for some reason. -#undef RP_I2C_USE_I2C1 -#define RP_I2C_USE_I2C1 TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - #ifdef USE_FFC_SPI - #undef RP_SPI_USE_SPI1 - #define RP_SPI_USE_SPI1 TRUE - #else - #undef RP_SPI_USE_SPI0 - #define RP_SPI_USE_SPI0 TRUE - #endif -#endif diff --git a/keyboards/svalboard/mouse/right/rules.mk b/keyboards/svalboard/mouse/right/rules.mk deleted file mode 100644 index 80b34bd6f42..00000000000 --- a/keyboards/svalboard/mouse/right/rules.mk +++ /dev/null @@ -1 +0,0 @@ -OPT_DEFS += -DINIT_EE_HANDS_RIGHT \ No newline at end of file diff --git a/keyboards/svalboard/mouse/rules.mk b/keyboards/svalboard/mouse/rules.mk deleted file mode 100644 index 7c5af2206a1..00000000000 --- a/keyboards/svalboard/mouse/rules.mk +++ /dev/null @@ -1,7 +0,0 @@ -# this turns on trackballs including pimoroni -POINTING_DEVICE_ENABLE = yes -# this selects trackball driver -POINTING_DEVICE_DRIVER = pmw3360 -# pimoroni_trackball -# pmw3389 -MH_AUTO_BUTTONS = yes diff --git a/keyboards/svalboard/pointball/.noci b/keyboards/svalboard/pointball/.noci deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/keyboards/svalboard/pointball/config.h b/keyboards/svalboard/pointball/config.h deleted file mode 100644 index 27ad30036a2..00000000000 --- a/keyboards/svalboard/pointball/config.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 2023 Morgan Venable @_claussen - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#pragma once - -/* key matrix size */ -// Rows are doubled-up - -#if defined(POINTING_DEVICE_ENABLE) - - // Pointing device stuff - #define SPLIT_POINTING_ENABLE - #define POINTING_DEVICE_COMBINED - #define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE - - #if defined(POINTING_DEVICE_IS_PIMORONI) - - #define I2C_DRIVER I2CD1 - #define I2C1_SDA_PIN GP18 - #define I2C1_SCL_PIN GP19 - #define PIMORONI_TRACKBALL_SCALE 5 - - #endif - - #if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - // SPI stuff - #define USE_FFC_SPI - - #ifdef USE_FFC_SPI - #define SPI_DRIVER SPID1 - // for FFC connector - #define SPI_SCK_PIN GP26 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP27 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP24 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP25 - #else - //for Separate Pimoroni Connector - #define SPI_DRIVER SPID0 - #define SPI_SCK_PIN GP18 - // Use TX# pin from SPI set. - #define SPI_MOSI_PIN GP19 - // Use RX# pin from SPI set. - #define SPI_MISO_PIN GP16 - // PMW33XX stuff - // Use CS# pin from SPI set. Might not actually have to be the CS# pin, since - // there's supposed to be support for multiple PMW33XX sensors, with different - // CS pins. - #define PMW33XX_CS_PIN GP17 - #endif - #define POINTING_DEVICE_INVERT_X_RIGHT - #define POINTING_DEVICE_ROTATION_90_RIGHT - //^ rotation is CCW - #endif -#endif - -//PS2 Trackpoint Setup -#ifdef PS2_MOUSE_ENABLE - //#define SERIAL_PIO_USE_PIO1 - #define PS2_PIO_USE_PIO1 - #define PS2_RESET_PIN GP25 - #define PS2_CLOCK_PIN GP24 - #define PS2_DATA_PIN GP23 - #define PS2_MOUSE_SCROLL_DIVISOR_H 4 - #define PS2_MOUSE_SCROLL_DIVISOR_V 4 - #ifndef PS2_MOUSE_ROTATE - #define PS2_MOUSE_ROTATE 90 - //default is N exit on right hand --270 for N on left see bsa.sh - #endif -// #define PS2_MOUSE_SCROLL_BTN_MASK 0 // just normal middle button for panning and relative scroll - #define PS2_MOUSE_SCROLL_BTN_MASK (1< - -#if defined(POINTING_DEVICE_DRIVER) - -#if defined(POINTING_DEVICE_IS_PIMORONI) - -#undef HAL_USE_I2C -#define HAL_USE_I2C TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - -#undef HAL_USE_SPI -#define HAL_USE_SPI TRUE - -#undef SPI_USE_WAIT -#define SPI_USE_WAIT TRUE - -#undef SPI_SELECT_MODE -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - -#endif -#endif diff --git a/keyboards/svalboard/pointball/right/info.json b/keyboards/svalboard/pointball/right/info.json deleted file mode 100644 index 63f16dc65c5..00000000000 --- a/keyboards/svalboard/pointball/right/info.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "manufacturer": "Svalboard", - "keyboard_name": "svalboard", - "maintainer": "MorganVenable", - "url": "http://svalboard.com", - "bootloader": "rp2040", - "diode_direction": "COL2ROW", - "features": { - "audio": false, - "backlight": false, - "bluetooth": false, - "bootmagic": false, - "command": true, - "console": true, - "extrakey": true, - "fauxclicky": false, - "midi": false, - "mousekey": true, - "nkro": true, - "rgblight": false, - "sleep_led": false, - "unicode": false - }, - "height": 10, - "matrix_pins": { - "cols": ["GP14", "GP13", "GP12", "GP11", "GP10", "GP9"], - "rows": ["GP8", "GP7", "GP6", "GP5", "GP4"] - }, - "mousekey": { - "delay": 150, - "interval": 60, - "max_speed": 5, - "time_to_max": 7 - }, - "processor": "RP2040", - "split": { - "enabled": true, - "transport": { - "protocol": "serial", - "sync_matrix_state": false, - "sync_modifiers": false - } - }, - "tapping": { - "term": 200 - }, - "ps2": { - "enabled": false, - "driver": "vendor" - }, - "usb": { - "device_version": "0.0.2", - "pid": "0x4044", - "polling_interval": 1, - "vid": "0x303A" - }, - "width": 20.5, - "layouts": { - "LAYOUT": { - "layout": [ - {"label": "r1c", "matrix": [1, 2], "x": 0.5, "y": 1.5}, - {"label": "r1n", "matrix": [1, 3], "x": 0.5, "y": 1, "h": 0.5}, - {"label": "r1e", "matrix": [1, 1], "x": 1.5, "y": 1.5, "w": 0.5}, - {"label": "r1s", "matrix": [1, 0], "x": 0.5, "y": 2.5, "h": 0.5}, - {"label": "r1w", "matrix": [1, 4], "x": 0, "y": 1.5, "w": 0.5}, - {"label": "r2c", "matrix": [2, 2], "x": 2.5, "y": 1}, - {"label": "r2n", "matrix": [2, 3], "x": 2.5, "y": 0.5, "h": 0.5}, - {"label": "r2e", "matrix": [2, 1], "x": 3.5, "y": 1, "w": 0.5}, - {"label": "r2s", "matrix": [2, 0], "x": 2.5, "y": 2, "h": 0.5}, - {"label": "r2w", "matrix": [2, 4], "x": 2, "y": 1, "w": 0.5}, - {"label": "r3c", "matrix": [3, 2], "x": 4.5, "y": 0.5}, - {"label": "r3n", "matrix": [3, 3], "x": 4.5, "y": 0, "h": 0.5}, - {"label": "r3e", "matrix": [3, 1], "x": 5.5, "y": 0.5, "w": 0.5}, - {"label": "r3s", "matrix": [3, 0], "x": 4.5, "y": 1.5, "h": 0.5}, - {"label": "r3w", "matrix": [3, 4], "x": 4, "y": 0.5, "w": 0.5}, - {"label": "r4c", "matrix": [4, 2], "x": 6.5, "y": 1}, - {"label": "r4n", "matrix": [4, 3], "x": 6.5, "y": 0.5, "h": 0.5}, - {"label": "r4e", "matrix": [4, 1], "x": 7.5, "y": 1, "w": 0.5}, - {"label": "r4s", "matrix": [4, 0], "x": 6.5, "y": 2, "h": 0.5}, - {"label": "r4w", "matrix": [4, 4], "x": 6, "y": 1, "w": 0.5}, - {"label": "l1c", "matrix": [6, 2], "x": 8.5, "y": 4, "h": 2}, - {"label": "l1n", "matrix": [6, 3], "x": 8, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1e", "matrix": [6, 1], "x": 7.5, "y": 3.5, "w": 0.5}, - {"label": "l1w", "matrix": [6, 0], "x": 9.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l1s", "matrix": [6, 4], "x": 9.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2c", "matrix": [7, 2], "x": 8.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l2n", "matrix": [7, 3], "x": 11, "y": 4, "h": 2}, - {"label": "l2e", "matrix": [7, 1], "x": 12, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l2w", "matrix": [7, 0], "x": 12.5, "y": 3.5, "w": 0.5}, - {"label": "l2s", "matrix": [7, 4], "x": 10.5, "y": 3.5, "w": 0.5, "h": 1.5}, - {"label": "l3c", "matrix": [8, 2], "x": 10.5, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3n", "matrix": [8, 3], "x": 11, "y": 5, "w": 0.5, "h": 1.5}, - {"label": "l3e", "matrix": [8, 1], "x": 13, "y": 1}, - {"label": "l3w", "matrix": [8, 0], "x": 13, "y": 0.5, "h": 0.5}, - {"label": "l3s", "matrix": [8, 4], "x": 12.5, "y": 1, "w": 0.5}, - {"label": "l4c", "matrix": [9, 2], "x": 13, "y": 2, "h": 0.5}, - {"label": "l4n", "matrix": [9, 3], "x": 14, "y": 1, "w": 0.5}, - {"label": "l4e", "matrix": [9, 1], "x": 15, "y": 0.5}, - {"label": "l4s", "matrix": [9, 0], "x": 15, "y": 0, "h": 0.5}, - {"label": "l4w", "matrix": [9, 4], "x": 16, "y": 0.5, "w": 0.5}, - {"label": "rtd", "matrix": [0, 2], "x": 15, "y": 1.5, "h": 0.5}, - {"label": "rti", "matrix": [0, 3], "x": 14.5, "y": 0.5, "w": 0.5}, - {"label": "rtu", "matrix": [0, 4], "x": 17, "y": 1}, - {"label": "rtuo", "matrix": [0, 1], "x": 17, "y": 0.5, "h": 0.5}, - {"label": "rtlo", "matrix": [0, 0], "x": 18, "y": 1, "w": 0.5}, - {"label": "rtdd", "matrix": [0, 5], "x": 17, "y": 2, "h": 0.5}, - {"label": "ltd", "matrix": [5, 2], "x": 16.5, "y": 1, "w": 0.5}, - {"label": "lti", "matrix": [5, 3], "x": 19, "y": 1.5}, - {"label": "ltu", "matrix": [5, 4], "x": 19, "y": 1, "h": 0.5}, - {"label": "ltuo", "matrix": [5, 1], "x": 20, "y": 1.5, "w": 0.5}, - {"label": "ltlo", "matrix": [5, 0], "x": 19, "y": 2.5, "h": 0.5}, - {"label": "ltdd", "matrix": [5, 5], "x": 18.5, "y": 1.5, "w": 0.5} - ] - } - } -} \ No newline at end of file diff --git a/keyboards/svalboard/pointball/right/mcuconf.h b/keyboards/svalboard/pointball/right/mcuconf.h deleted file mode 100644 index 231550b3672..00000000000 --- a/keyboards/svalboard/pointball/right/mcuconf.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include_next "mcuconf.h" - -#if defined(POINTING_DEVICE_IS_PIMORONI) -// TODO I2C0 does not work, for some reason. -#undef RP_I2C_USE_I2C1 -#define RP_I2C_USE_I2C1 TRUE - -#endif - -#if (defined(POINTING_DEVICE_IS_PMW3360) || defined(POINTING_DEVICE_IS_PMW3389)) - #ifdef USE_FFC_SPI - #undef RP_SPI_USE_SPI1 - #define RP_SPI_USE_SPI1 TRUE - #else - #undef RP_SPI_USE_SPI0 - #define RP_SPI_USE_SPI0 TRUE - #endif -#endif \ No newline at end of file diff --git a/keyboards/svalboard/pointball/right/rules.mk b/keyboards/svalboard/pointball/right/rules.mk deleted file mode 100644 index 2e6be022bca..00000000000 --- a/keyboards/svalboard/pointball/right/rules.mk +++ /dev/null @@ -1,7 +0,0 @@ -OPT_DEFS += -DINIT_EE_HANDS_RIGHT -# this turns on trackballs including pimoroni -POINTING_DEVICE_ENABLE = yes -# this selects trackball driver -POINTING_DEVICE_DRIVER = pmw3360 -# pimoroni_trackball -# pmw3389 diff --git a/keyboards/svalboard/pointball/rules.mk b/keyboards/svalboard/pointball/rules.mk deleted file mode 100644 index c513a5e4f6e..00000000000 --- a/keyboards/svalboard/pointball/rules.mk +++ /dev/null @@ -1,15 +0,0 @@ -POINTING_DEVICE_ENABLE = yes -# this selects trackball driver -POINTING_DEVICE_DRIVER = pmw3360 - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pimoroni_trackball) - OPT_DEFS += -DPOINTING_DEVICE_IS_PIMORONI -endif - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3360) - OPT_DEFS += -DPOINTING_DEVICE_IS_PMW3360 -endif - -ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3389) - OPT_DEFS += -DPOINTING_DEVICE_IS_PMW3389 -endif \ No newline at end of file diff --git a/keyboards/svalboard/trackball/config.h b/keyboards/svalboard/trackball/config.h index 9f6cf1ef33e..766285c6692 100644 --- a/keyboards/svalboard/trackball/config.h +++ b/keyboards/svalboard/trackball/config.h @@ -17,8 +17,6 @@ along with this program. If not, see . #pragma once -#define MOUSE_EXTENDED_REPORT - #undef PS2_MOUSE_ENABLE // in config.h: @@ -28,15 +26,11 @@ along with this program. If not, see . #define PS2_RESET_PIN GP25 #define PS2_CLOCK_PIN GP24 #define PS2_DATA_PIN GP23 - #define PS2_MOUSE_ROTATE 270 #endif #if defined(POINTING_DEVICE_ENABLE) // Pointing device stuff - #define SPLIT_POINTING_ENABLE - #define POINTING_DEVICE_COMBINED - #define POINTING_DEVICE_AUTO_MOUSE_MH_ENABLE #if defined(POINTING_DEVICE_IS_PIMORONI) @@ -79,14 +73,5 @@ along with this program. If not, see . // CS pins. #define PMW33XX_CS_PIN GP17 #endif - #ifdef FORTY_FOUR_MM_TB - #define POINTING_DEVICE_INVERT_X_RIGHT - #define POINTING_DEVICE_INVERT_X - #else - #define POINTING_DEVICE_INVERT_X_RIGHT - #define POINTING_DEVICE_INVERT_X - #define POINTING_DEVICE_ROTATION_90_RIGHT - #define POINTING_DEVICE_ROTATION_90 - #endif #endif -#endif \ No newline at end of file +#endif diff --git a/keyboards/svalboard/trackball/rules.mk b/keyboards/svalboard/trackball/rules.mk index 94d76edd14a..abdec079052 100644 --- a/keyboards/svalboard/trackball/rules.mk +++ b/keyboards/svalboard/trackball/rules.mk @@ -16,4 +16,5 @@ endif ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3389) OPT_DEFS += -DPOINTING_DEVICE_IS_PMW3389 -endif \ No newline at end of file +endif + diff --git a/keyboards/svalboard/trackball/trackball.c b/keyboards/svalboard/trackball/trackball.c new file mode 100644 index 00000000000..0d8d2fef7af --- /dev/null +++ b/keyboards/svalboard/trackball/trackball.c @@ -0,0 +1,17 @@ +#include "quantum.h" +#include "pointing_device.h" +#include "pointing_device_internal.h" + +extern const pointing_device_driver_t real_device_driver; + +report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { + int16_t swap; + + mouse_report = real_device_driver.get_report(mouse_report); + + swap = mouse_report.x; + mouse_report.x = -mouse_report.y; + mouse_report.y = -swap; + + return mouse_report; +} diff --git a/keyboards/svalboard/trackpoint/config.h b/keyboards/svalboard/trackpoint/config.h index 1cdf64154fe..9fabc7f5be5 100644 --- a/keyboards/svalboard/trackpoint/config.h +++ b/keyboards/svalboard/trackpoint/config.h @@ -17,28 +17,17 @@ along with this program. If not, see . #pragma once -/* key matrix size */ -// Rows are doubled-up - - - //PS2 Trackpoint Setup -#ifdef PS2_MOUSE_ENABLE - //#define SERIAL_PIO_USE_PIO1 - #define PS2_PIO_USE_PIO1 - #define PS2_RESET_PIN GP25 - #define PS2_CLOCK_PIN GP24 - #define PS2_DATA_PIN GP23 - #define PS2_MOUSE_SCROLL_DIVISOR_H 4 - #define PS2_MOUSE_SCROLL_DIVISOR_V 4 - #ifndef PS2_MOUSE_ROTATE - #define PS2_MOUSE_ROTATE 90 - //default is N exit on right hand --270 for N on left see bsa.sh - #endif +//#define SERIAL_PIO_USE_PIO1 +#define PS2_PIO_USE_PIO1 +#define PS2_RESET_PIN GP25 +#define PS2_CLOCK_PIN GP24 +#define PS2_DATA_PIN GP23 +#define PS2_MOUSE_SCROLL_DIVISOR_H 4 +#define PS2_MOUSE_SCROLL_DIVISOR_V 4 // #define PS2_MOUSE_SCROLL_BTN_MASK 0 // just normal middle button for panning and relative scroll - #define PS2_MOUSE_SCROLL_BTN_MASK (1< Date: Wed, 8 May 2024 13:27:56 -0400 Subject: [PATCH 18/19] trackpoint: Fixup the drift correction after lego. Drift correction got broken with lego. This fixes it. --- keyboards/svalboard/svalboard.c | 102 +------------------- keyboards/svalboard/trackpoint/trackpoint.c | 97 +++++++++++++++++++ 2 files changed, 100 insertions(+), 99 deletions(-) diff --git a/keyboards/svalboard/svalboard.c b/keyboards/svalboard/svalboard.c index 6546e0c93da..f1c705f2251 100644 --- a/keyboards/svalboard/svalboard.c +++ b/keyboards/svalboard/svalboard.c @@ -67,14 +67,14 @@ void set_right_dpi(uint8_t index) { pointing_device_set_cpi_on_side(false, dpi_choices[index]); } -void pointing_device_init_kb(void) { +void set_dpi_from_eeprom(void) { read_eeprom_kb(); set_left_dpi(global_saved_values.left_dpi_index); set_right_dpi(global_saved_values.right_dpi_index); } void keyboard_post_init_kb(void) { - pointing_device_init_kb(); + set_dpi_from_eeprom(); keyboard_post_init_user(); } @@ -95,102 +95,6 @@ void bootmagic_lite(void) { } #endif -#ifdef PS2_MOUSE_ENABLE -#include "ps2_mouse.h" -#include "ps2.h" - -void ps2_mouse_init_user() { -//sensitivity command in fourth byte 00 = 0 multiplier, FF = 2.0 multiplier - /* - PS2_MOUSE_SEND(0xE2); - PS2_MOUSE_SEND(0x81); - PS2_MOUSE_SEND(0x4A); - PS2_MOUSE_SEND(0x59); - */ -//Z tap -- doesn't seem to work. 0x01 is on. - uint8_t val; - - ps2_mouse_disable_data_reporting(); - - PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); - PS2_MOUSE_SEND(0x47, "pts: 0x47"); - PS2_MOUSE_SEND(0x2C, "pts: 0x2C"); - PS2_MOUSE_SEND(0x00, "pts: 0x00"); // 01 turns on Z tap, 00 turns off - PS2_MOUSE_RECEIVE("ztap - disable"); - -/* -From Sprintek: - -E2 47 FA 10 - Disable drift correction. - Flips the bit, it should boot enabled. - -This was given to us to stop the trackpoint from calibrating at bad times. - -*/ - - PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); - PS2_MOUSE_SEND(0x80, "pts: 0x80"); - PS2_MOUSE_SEND(0xFA, "pts: 0xFA"); - val = ps2_host_recv_response(); - - if (~val & 0x10) { - PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); - PS2_MOUSE_SEND(0x47, "pts: 0x47"); - PS2_MOUSE_SEND(0xFA, "pts: 0xFA"); - PS2_MOUSE_SEND(0x10, "pts: 0x10"); - PS2_MOUSE_RECEIVE("drift correction - disable"); - } -/* - -From Sprintek: - -E2 81 92 XX - Set the deadzone - 0x0C default, claimed. - -Increase this to get rid of the tail drift. - -*/ -// PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); -// PS2_MOUSE_SEND(0x81, "pts: 0x81"); -// PS2_MOUSE_SEND(0x92, "pts: 0x92"); -// PS2_MOUSE_SEND(0x80, "pts: 0x0C"); // Experiment with this if it isn't enough. - -/* - -Timing on the double tap on the trackpoint: - -E2 80 5E -E2 81 5E XX - -Z Time Constant [zTc] - This PtS parameter is the time constant of the running average of Z force. Its units are in - force sampling time units as specified in the Set Sampling Rate command on page 14. - This determines how sharp a press has to be to be recognized. The value of this parameter - is 256/n, where n is the desired time constant. The running average is then calculated with - the formula: - where A = running average, N = present sample, and X is - A=A+(N−A) X - 256 - zTc. The default value for zTc is x"26" (decimal 38) corresponding to a time constant of - 6.7 samples. This value is not affected by a reset (x"FF") or set default (x"F6") command - -*/ - - - PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); - PS2_MOUSE_SEND(0x81, "pts: 0x81"); - PS2_MOUSE_SEND(0x5E, "pts: 0x5E"); - PS2_MOUSE_SEND(0x00, "pts: 0x00"); - PS2_MOUSE_RECEIVE("double Z tap - disable"); - - ps2_mouse_enable_data_reporting(); - -} -#endif - -void recalibrate_pointer(void) { -#ifdef PS2_MOUSE_ENABLE - PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); - PS2_MOUSE_SEND(0x51, "pts: 0x51"); - PS2_MOUSE_RECEIVE("trackpoint - recalibrate"); -#endif +__attribute__((weak)) void recalibrate_pointer(void) { } diff --git a/keyboards/svalboard/trackpoint/trackpoint.c b/keyboards/svalboard/trackpoint/trackpoint.c index 15936bf5473..5132d39c53f 100644 --- a/keyboards/svalboard/trackpoint/trackpoint.c +++ b/keyboards/svalboard/trackpoint/trackpoint.c @@ -1,6 +1,8 @@ #include "quantum.h" #include "pointing_device.h" #include "pointing_device_internal.h" +#include "ps2_mouse.h" +#include "ps2.h" extern const pointing_device_driver_t real_device_driver; @@ -15,3 +17,98 @@ report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { return mouse_report; } + +void pointing_device_init_kb() { +//sensitivity command in fourth byte 00 = 0 multiplier, FF = 2.0 multiplier + /* + PS2_MOUSE_SEND(0xE2); + PS2_MOUSE_SEND(0x81); + PS2_MOUSE_SEND(0x4A); + PS2_MOUSE_SEND(0x59); + */ +//Z tap -- doesn't seem to work. 0x01 is on. + uint8_t val; + + ps2_mouse_disable_data_reporting(); + + PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); + PS2_MOUSE_SEND(0x47, "pts: 0x47"); + PS2_MOUSE_SEND(0x2C, "pts: 0x2C"); + PS2_MOUSE_SEND(0x00, "pts: 0x00"); // 01 turns on Z tap, 00 turns off + PS2_MOUSE_RECEIVE("ztap - disable"); + +/* +From Sprintek: + +E2 47 FA 10 - Disable drift correction. - Flips the bit, it should boot enabled. + +This was given to us to stop the trackpoint from calibrating at bad times. + +*/ + + PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); + PS2_MOUSE_SEND(0x80, "pts: 0x80"); + PS2_MOUSE_SEND(0xFA, "pts: 0xFA"); + val = ps2_host_recv_response(); + + if (~val & 0x10) { + PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); + PS2_MOUSE_SEND(0x47, "pts: 0x47"); + PS2_MOUSE_SEND(0xFA, "pts: 0xFA"); + PS2_MOUSE_SEND(0x10, "pts: 0x10"); + PS2_MOUSE_RECEIVE("drift correction - disable"); + } +/* + +From Sprintek: + +E2 81 92 XX - Set the deadzone - 0x0C default, claimed. + +Increase this to get rid of the tail drift. + +*/ +// PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); +// PS2_MOUSE_SEND(0x81, "pts: 0x81"); +// PS2_MOUSE_SEND(0x92, "pts: 0x92"); +// PS2_MOUSE_SEND(0x80, "pts: 0x0C"); // Experiment with this if it isn't enough. + +/* + +Timing on the double tap on the trackpoint: + +E2 80 5E +E2 81 5E XX + +Z Time Constant [zTc] + This PtS parameter is the time constant of the running average of Z force. Its units are in + force sampling time units as specified in the Set Sampling Rate command on page 14. + This determines how sharp a press has to be to be recognized. The value of this parameter + is 256/n, where n is the desired time constant. The running average is then calculated with + the formula: + where A = running average, N = present sample, and X is + A=A+(N−A) X + 256 + zTc. The default value for zTc is x"26" (decimal 38) corresponding to a time constant of + 6.7 samples. This value is not affected by a reset (x"FF") or set default (x"F6") command + +*/ + + + PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); + PS2_MOUSE_SEND(0x81, "pts: 0x81"); + PS2_MOUSE_SEND(0x5E, "pts: 0x5E"); + PS2_MOUSE_SEND(0x00, "pts: 0x00"); + PS2_MOUSE_RECEIVE("double Z tap - disable"); + + ps2_mouse_enable_data_reporting(); + + pointing_device_init_user(); + +} + + +void recalibrate_pointer(void) { + PS2_MOUSE_SEND(0xE2, "pts: 0xE2"); + PS2_MOUSE_SEND(0x51, "pts: 0x51"); + PS2_MOUSE_RECEIVE("trackpoint - recalibrate"); +} From 74c5c56f1b9f1b1669bef3a81ffcb5fa6dc14ab4 Mon Sep 17 00:00:00 2001 From: Ira Cooper Date: Fri, 10 May 2024 09:10:59 -0400 Subject: [PATCH 19/19] keymaps: add datahand_dvorak.vil This is the actual datahand_dvorak.vil I made for when I started out. It may not be 100% perfect, but it is better than anything else. --- keyboards/svalboard/keymaps/vial/datahand_dvorak.vil | 1 + 1 file changed, 1 insertion(+) create mode 100755 keyboards/svalboard/keymaps/vial/datahand_dvorak.vil diff --git a/keyboards/svalboard/keymaps/vial/datahand_dvorak.vil b/keyboards/svalboard/keymaps/vial/datahand_dvorak.vil new file mode 100755 index 00000000000..64886d7df18 --- /dev/null +++ b/keyboards/svalboard/keymaps/vial/datahand_dvorak.vil @@ -0,0 +1 @@ +{"version": 1, "uid": 5199957870438586395, "layout": [[["KC_LCTRL", "KC_TAB", "KC_LSHIFT", "KC_ENTER", "TO(0)", "KC_CAPSLOCK"], ["KC_K", "KC_I", "KC_U", "KC_P", "KC_Y", -1], ["KC_J", "LSFT(KC_TAB)", "KC_E", "KC_DOT", "KC_GRAVE", -1], ["KC_Q", "KC_X", "KC_O", "KC_COMMA", "KC_ESCAPE", -1], ["KC_SCOLON", "KC_BSLASH", "KC_A", "KC_QUOTE", "KC_DELETE", -1], ["KC_LALT", "KC_BSPACE", "MO(4)", "KC_SPACE", "TO(2)", "TG(1)"], ["KC_M", "KC_F", "KC_H", "KC_G", "KC_D", -1], ["KC_W", "KC_RBRACKET", "KC_T", "KC_C", "KC_LBRACKET", -1], ["KC_V", "KC_LGUI", "KC_N", "KC_R", "KC_B", -1], ["KC_Z", "KC_MINUS", "KC_S", "KC_L", "KC_SLASH", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["LSFT(KC_4)", "KC_5", "KC_4", "LSFT(KC_5)", "KC_KP_PLUS", -1], ["LSFT(KC_3)", "KC_TRNS", "KC_3", "KC_DOT", "KC_KP_MINUS", -1], ["LSFT(KC_2)", "KC_NUMLOCK", "KC_2", "KC_COMMA", "KC_ESCAPE", -1], ["LSFT(KC_1)", "KC_EQUAL", "KC_1", "KC_QUOTE", "KC_DELETE", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["LSFT(KC_7)", "KC_SLASH", "KC_7", "LSFT(KC_6)", "KC_6", -1], ["LSFT(KC_8)", "LSFT(KC_0)", "KC_8", "KC_BSLASH", "LSFT(KC_9)", -1], ["M0", "KC_LGUI", "KC_9", "KC_SCOLON", "TO(5)", -1], ["KC_DOWN", "KC_RIGHT", "KC_0", "KC_UP", "KC_LEFT", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_DOWN", "KC_RIGHT", "KC_HOME", "KC_UP", "KC_LEFT", -1], ["KC_F5", "KC_TRNS", "KC_END", "KC_F6", "KC_NO", -1], ["KC_F3", "KC_NUMLOCK", "KC_NO", "KC_F4", "KC_ESCAPE", -1], ["KC_F1", "KC_SCROLLLOCK", "KC_PSCREEN", "KC_F2", "KC_DELETE", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_DOWN", "KC_RIGHT", "KC_HOME", "KC_UP", "KC_LEFT", -1], ["KC_F7", "KC_NO", "KC_END", "KC_F8", "KC_END", -1], ["KC_F9", "KC_LGUI", "KC_PSCREEN", "KC_F10", "KC_INSERT", -1], ["KC_PGDOWN", "KC_F12", "KC_PAUSE", "KC_PGUP", "KC_F11", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_BTN1", "KC_NO", "KC_NO", "KC_NO", "KC_NO", -1], ["KC_BTN2", "KC_TRNS", "KC_NO", "KC_NO", "KC_NO", -1], ["KC_BTN3", "KC_NO", "KC_NO", "KC_NO", "KC_NO", -1], ["KC_WH_D", "KC_WH_R", "KC_BTN4", "KC_WH_U", "KC_WH_L", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["LCTL(KC_DOWN)", "LCTL(KC_RIGHT)", "KC_LEFT", "LCTL(KC_UP)", "LCTL(KC_LEFT)", -1], ["KC_MS_D", "KC_MS_R", "KC_UP", "KC_MS_U", "KC_MS_L", -1], ["KC_WH_D", "KC_WH_R", "KC_DOWN", "KC_WH_U", "KC_WH_L", -1], ["KC_PGDOWN", "KC_END", "KC_RIGHT", "KC_PGUP", "KC_HOME", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["LSFT(KC_4)", "KC_5", "KC_4", "LSFT(KC_5)", "KC_KP_PLUS", -1], ["LSFT(KC_3)", "LSFT_T(KC_TAB)", "KC_3", "KC_DOT", "KC_KP_MINUS", -1], ["LSFT(KC_2)", "KC_NUMLOCK", "KC_2", "KC_COMMA", "KC_ESCAPE", -1], ["LSFT(KC_1)", "KC_EQUAL", "KC_1", "KC_QUOTE", "KC_DELETE", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["LSFT(KC_7)", "KC_SLASH", "KC_7", "LSFT(KC_6)", "KC_6", -1], ["LSFT(KC_8)", "LSFT(KC_0)", "KC_8", "KC_BSLASH", "LSFT(KC_9)", -1], ["M0", "KC_LGUI", "KC_9", "KC_SCOLON", "TG(5)", -1], ["KC_DOWN", "KC_RIGHT", "KC_0", "KC_UP", "KC_LEFT", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_KP_ASTERISK", "KC_NO", "KC_TRNS", "KC_KP_PLUS", -1], ["KC_TRNS", "KC_TRNS", "KC_KP_SLASH", "KC_TRNS", "KC_KP_MINUS", -1], ["KC_BTN3", "KC_TRNS", "LSFT(KC_7)", "KC_BTN4", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "LSFT(KC_6)", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_KP_1", "M0", "KC_KP_4", "KC_KP_7", "KC_KP_0", -1], ["KC_KP_2", "LSFT(KC_0)", "KC_KP_5", "KC_KP_8", "LSFT(KC_9)", -1], ["KC_KP_3", "KC_KP_ENTER", "KC_KP_6", "KC_KP_9", "TG(5)", -1], ["KC_DOWN", "KC_RIGHT", "KC_HOME", "KC_UP", "KC_LEFT", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_BTN1", "KC_TRNS", "KC_TRNS", "KC_BTN4", "KC_TRNS", -1], ["KC_BTN2", "KC_TRNS", "KC_TRNS", "KC_BTN5", "KC_TRNS", -1], ["KC_BTN3", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_WH_D", "KC_WH_R", "KC_TRNS", "KC_WH_U", "KC_WH_L", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_BTN1", "KC_TRNS", "KC_TRNS", "KC_BTN4", "KC_TRNS", -1], ["KC_BTN2", "KC_TRNS", "KC_TRNS", "KC_BTN5", "KC_TRNS", -1], ["KC_BTN3", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_WH_D", "KC_WH_R", "KC_TRNS", "KC_WH_U", "KC_WH_L", -1]]], "encoder_layout": [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []], "layout_options": -1, "macro": [[["text", "00"]], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []], "vial_protocol": 6, "via_protocol": 9, "tap_dance": [["TO(0)", "KC_LGUI", "KC_NO", "KC_NO", 200], ["TO(2)", "TO(3)", "KC_NO", "KC_LGUI", 250], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200]], "combo": [["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"]], "key_override": [{"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}], "settings": {"1": 0, "2": 50, "3": 0, "4": 175, "5": 5, "6": 5000, "7": 200, "8": 0, "9": 150, "10": 60, "11": 8, "12": 5, "13": 7, "14": 10, "15": 80, "16": 8, "17": 40, "18": 0, "19": 80, "20": 2, "21": 128}} \ No newline at end of file