From 3c58f989295e17d03b66db9a154e02cde7336ece Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Thu, 14 Jul 2022 11:50:00 +0200 Subject: [Core] PMW33XX drivers overhaul (#17613) * PMW33XX drivers overhaul This combines the PMW3389 and PM3360 drivers as they only differ in the firmware blobs and CPI get and set functions. The following changes have been made: * PMW3389 now gets the same multi-sensor feature that is already available on the PMW3360. * Introduced a shared pmw33xx_report_t struct is now directly readable via SPI transactions instead of individual byte-sized reads, saving multiple copies and bitshift operations. * pmw33(89/60)_get_report functions had unreachable branches in their motion detection logic these have been simplied as much as possible. * The fast firmware upload option has been removed as this becomes obsolete by the newly introduced polled waiting functions for ChibiOS polled waiting * PMW33(60/89)_SPI_LSBFIRST and PMW33(60/89)_SPI_MODE config options have been removed as they don't need to be configurable. * All PMW3389 and PMW3360 defines have been unified to a PMW33XX prefix to reduce code duplication and make the defines interchangeable * Adjust keyboards to PMW33XX naming scheme --- keyboards/bastardkb/charybdis/3x5/config.h | 4 ++-- keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h | 6 ++---- keyboards/bastardkb/charybdis/4x6/config.h | 4 ++-- keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h | 8 +++----- keyboards/bbrfkr/dynamis/config.h | 2 +- keyboards/handwired/tractyl_manuform/4x6_right/config.h | 4 ++-- keyboards/handwired/tractyl_manuform/4x6_right/info.json | 2 +- keyboards/handwired/tractyl_manuform/5x6_right/elite_c/config.h | 4 ++-- keyboards/handwired/tractyl_manuform/5x6_right/f303/config.h | 5 ++--- keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h | 5 +---- keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h | 4 ++-- keyboards/oddball/config.h | 2 +- keyboards/ploopyco/mouse/config.h | 4 ++-- keyboards/ploopyco/trackball/config.h | 4 ++-- 14 files changed, 25 insertions(+), 33 deletions(-) (limited to 'keyboards') diff --git a/keyboards/bastardkb/charybdis/3x5/config.h b/keyboards/bastardkb/charybdis/3x5/config.h index 89b896bc35..b12603fade 100644 --- a/keyboards/bastardkb/charybdis/3x5/config.h +++ b/keyboards/bastardkb/charybdis/3x5/config.h @@ -58,8 +58,8 @@ /* Set 0 if debouncing isn't needed. */ #define DEBOUNCE 5 -/* PMW3360 settings. */ -#define PMW3360_CS_PIN B0 +/* PMW33XX settings. */ +#define PMW33XX_CS_PIN B0 // Trackball angle adjustment. #define ROTATIONAL_TRANSFORM_ANGLE -25 diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h index 0f08aee9ef..39204a3667 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h @@ -98,10 +98,8 @@ along with this program. If not, see . // #define EXTERNAL_EEPROM_ADDRESS_SIZE 2 /* pmw3360 config */ -#undef PMW3360_CS_PIN -#define PMW3360_CS_PIN B0 -#define PMW3360_SPI_MODE 3 -#define PMW3360_SPI_DIVISOR 64 +#undef PMW33XX_CS_PIN +#define PMW33XX_CS_PIN B0 #define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 #define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 diff --git a/keyboards/bastardkb/charybdis/4x6/config.h b/keyboards/bastardkb/charybdis/4x6/config.h index 423f12fdbe..6760129ef8 100644 --- a/keyboards/bastardkb/charybdis/4x6/config.h +++ b/keyboards/bastardkb/charybdis/4x6/config.h @@ -60,8 +60,8 @@ /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 -/* PMW3360 settings. */ -#define PMW3360_CS_PIN B0 +/* PMW33XX settings. */ +#define PMW33XX_CS_PIN B0 #define RGB_DI_PIN D3 #define RGBLED_NUM 56 diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h index 2b6e11ec61..63e67aa6d8 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h @@ -87,11 +87,9 @@ #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 -#undef PMW3360_CS_PIN -#define PMW3360_CS_PIN A15 // b14 -#define PMW3360_CS_MODE 3 -#define PMW3360_CS_DIVISOR 64 -#define PMW3360_LIFTOFF_DISTANCE 0b1111 +#undef PMW33XX_CS_PIN +#define PMW33XX_CS_PIN A15 // b14 +#define PMW33XX_LIFTOFF_DISTANCE 0b1111 #undef ROTATIONAL_TRANSFORM_ANGLE #define ROTATIONAL_TRANSFORM_ANGLE -65 diff --git a/keyboards/bbrfkr/dynamis/config.h b/keyboards/bbrfkr/dynamis/config.h index 0c11416612..abf4058e7b 100644 --- a/keyboards/bbrfkr/dynamis/config.h +++ b/keyboards/bbrfkr/dynamis/config.h @@ -52,5 +52,5 @@ #define ENCODERS_PAD_A { B7 } #define ENCODERS_PAD_B { E6 } -#define PMW3360_CS_PIN SPI_SS_PIN +#define PMW33XX_CS_PIN SPI_SS_PIN #define POINTING_DEVICE_INVERT_Y diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/config.h index ab46bc5276..5bfb17ee31 100644 --- a/keyboards/handwired/tractyl_manuform/4x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/4x6_right/config.h @@ -85,7 +85,7 @@ along with this program. If not, see . //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -/* PMW3360 Settings */ -#define PMW3360_CS_PIN B0 +/* PMW33XX Settings */ +#define PMW33XX_CS_PIN B0 #define POINTING_DEVICE_RIGHT diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/info.json b/keyboards/handwired/tractyl_manuform/4x6_right/info.json index e3da8b444c..3d428260ad 100644 --- a/keyboards/handwired/tractyl_manuform/4x6_right/info.json +++ b/keyboards/handwired/tractyl_manuform/4x6_right/info.json @@ -3,7 +3,7 @@ "url": "", "maintainer": "drashna", "layouts": { - "LAYOUT_5x6_right": { + "LAYOUT_4x6_right": { "layout": [ {"label":"L00", "x":0, "y":0}, {"label":"L01", "x":1, "y":0}, diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/elite_c/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/elite_c/config.h index d8d36e824c..ab72957b5c 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/elite_c/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/elite_c/config.h @@ -47,5 +47,5 @@ along with this program. If not, see . #define ENCODERS_PAD_B \ { C7 } -/* PMW3360 Settings */ -#define PMW3360_CS_PIN B6 +/* PMW33XX Settings */ +#define PMW33XX_CS_PIN B6 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f303/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f303/config.h index f9a44587b0..809acdcd94 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f303/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f303/config.h @@ -99,6 +99,5 @@ along with this program. If not, see . // #define DEBUG_EEPROM_OUTPUT /* pmw3360 config */ -#define PMW3360_CS_PIN B9 -#define PMW3360_SPI_MODE 3 -#define PMW3360_SPI_DIVISOR 8 +#define PMW33XX_CS_PIN B9 +#define PMW33XX_SPI_DIVISOR 8 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h index 5f0350810c..0eb5b2a217 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h @@ -102,7 +102,4 @@ along with this program. If not, see . #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 /* pmw3360 config */ -#define PMW3360_CS_PIN B0 -#define PMW3360_SPI_MODE 3 -#define PMW3360_SPI_DIVISOR 64 -#define PMW3360_FIRMWARE_UPLOAD_FAST +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h index 442d474920..6eb3186332 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h @@ -51,5 +51,5 @@ along with this program. If not, see . #define ENCODERS_PAD_B \ { D4 } -/* PMW3360 Settings */ -#define PMW3360_CS_PIN B0 +/* PMW33XX Settings */ +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/oddball/config.h b/keyboards/oddball/config.h index cfb134c4e3..1aaead0cae 100644 --- a/keyboards/oddball/config.h +++ b/keyboards/oddball/config.h @@ -56,4 +56,4 @@ // #define BOOTMAGIC_LITE_COLUMN 0 #define ADNS9800_CS_PIN SPI_SS_PIN -#define PMW3360_CS_PIN SPI_SS_PIN +#define PMW33XX_CS_PIN SPI_SS_PIN diff --git a/keyboards/ploopyco/mouse/config.h b/keyboards/ploopyco/mouse/config.h index 98fc81bb05..a3e4b76893 100644 --- a/keyboards/ploopyco/mouse/config.h +++ b/keyboards/ploopyco/mouse/config.h @@ -77,5 +77,5 @@ // #define DEBUG_LED_PIN F7 -/* PMW3360 Settings */ -#define PMW3360_CS_PIN B0 +/* PMW33XX Settings */ +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/ploopyco/trackball/config.h b/keyboards/ploopyco/trackball/config.h index dd068e4838..5c151c2e73 100644 --- a/keyboards/ploopyco/trackball/config.h +++ b/keyboards/ploopyco/trackball/config.h @@ -53,6 +53,6 @@ // If board has a debug LED, you can enable it by defining this // #define DEBUG_LED_PIN F7 -/* PMW3360 Settings */ -#define PMW3360_CS_PIN B0 +/* PMW33XX Settings */ +#define PMW33XX_CS_PIN B0 #define POINTING_DEVICE_INVERT_Y -- cgit v1.2.3