From 01bc974365581da6563e2bbd2425233d97280fdd Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Sat, 25 Jun 2022 22:22:28 +0200 Subject: improvements for Cirque Pinnacle trackpads (#17091) --- drivers/sensors/cirque_pinnacle.h | 50 ++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'drivers/sensors/cirque_pinnacle.h') diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index c8cb360e03..d65bdb41b6 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -5,23 +5,14 @@ #include #include -// Convenient way to store and access measurements -typedef struct { - uint16_t xValue; - uint16_t yValue; - uint16_t zValue; - uint8_t buttonFlags; - bool touchDown; -} pinnacle_data_t; - -void cirque_pinnacle_init(void); -pinnacle_data_t cirque_pinnacle_read_data(void); -void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution); -uint16_t cirque_pinnacle_get_scale(void); -void cirque_pinnacle_set_scale(uint16_t scale); - #ifndef CIRQUE_PINNACLE_TIMEOUT -# define CIRQUE_PINNACLE_TIMEOUT 20 +# define CIRQUE_PINNACLE_TIMEOUT 20 // I2C timeout in milliseconds +#endif + +#define CIRQUE_PINNACLE_ABSOLUTE_MODE 1 +#define CIRQUE_PINNACLE_RELATIVE_MODE 0 +#ifndef CIRQUE_PINNACLE_POSITION_MODE +# define CIRQUE_PINNACLE_POSITION_MODE CIRQUE_PINNACLE_ABSOLUTE_MODE #endif // Coordinate scaling values @@ -43,7 +34,9 @@ void cirque_pinnacle_set_scale(uint16_t scale); #ifndef CIRQUE_PINNACLE_Y_RANGE # define CIRQUE_PINNACLE_Y_RANGE (CIRQUE_PINNACLE_Y_UPPER - CIRQUE_PINNACLE_Y_LOWER) #endif - +#if !defined(POINTING_DEVICE_TASK_THROTTLE_MS) +# define POINTING_DEVICE_TASK_THROTTLE_MS 10 // Cirque Pinnacle in normal operation produces data every 10ms. Advanced configuration for pen/stylus usage might require lower values. +#endif #if defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_i2c) # include "i2c_master.h" // Cirque's 7-bit I2C Slave Address @@ -72,3 +65,26 @@ void cirque_pinnacle_set_scale(uint16_t scale); # endif # endif #endif + +// Convenient way to store and access measurements +typedef struct { + bool valid; // true if valid data was read, false if no data was ready +#if CIRQUE_PINNACLE_POSITION_MODE + uint16_t xValue; + uint16_t yValue; + uint16_t zValue; + uint8_t buttonFlags; + bool touchDown; +#else + uint8_t xDelta; + uint8_t yDelta; + uint8_t wheelCount; + uint8_t buttons; +#endif +} pinnacle_data_t; + +void cirque_pinnacle_init(void); +pinnacle_data_t cirque_pinnacle_read_data(void); +void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution); +uint16_t cirque_pinnacle_get_scale(void); +void cirque_pinnacle_set_scale(uint16_t scale); -- cgit v1.2.1 From 5db705d054e54a901f8968e3380e13c791991ab3 Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Tue, 12 Jul 2022 21:17:40 -0700 Subject: Cirque trackpad features: circular scroll, inertial cursor (#17482) --- drivers/sensors/cirque_pinnacle.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers/sensors/cirque_pinnacle.h') diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index d65bdb41b6..1c9bf06fd3 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -2,6 +2,7 @@ #pragma once +#include "cirque_pinnacle_regdefs.h" #include #include @@ -15,6 +16,11 @@ # define CIRQUE_PINNACLE_POSITION_MODE CIRQUE_PINNACLE_ABSOLUTE_MODE #endif +#define CIRQUE_PINNACLE_DEFAULT_SCALE 1024 +#ifndef CIRQUE_PINNACLE_DIAMETER_MM +# define CIRQUE_PINNACLE_DIAMETER_MM 40 +#endif + // Coordinate scaling values #ifndef CIRQUE_PINNACLE_X_LOWER # define CIRQUE_PINNACLE_X_LOWER 127 // min "reachable" X value @@ -41,7 +47,7 @@ # include "i2c_master.h" // Cirque's 7-bit I2C Slave Address # ifndef CIRQUE_PINNACLE_ADDR -# define CIRQUE_PINNACLE_ADDR 0x2A +# define CIRQUE_PINNACLE_ADDR I2C_ADDRESS_DEFAULT # endif #elif defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_spi) # include "spi_master.h" @@ -66,6 +72,10 @@ # endif #endif +#define DIVIDE_UNSIGNED_ROUND(numerator, denominator) (((numerator) + ((denominator) / 2)) / (denominator)) +#define CIRQUE_PINNACLE_INCH_TO_PX(inch) (DIVIDE_UNSIGNED_ROUND((inch) * (uint32_t)CIRQUE_PINNACLE_DIAMETER_MM * 10, 254)) +#define CIRQUE_PINNACLE_PX_TO_INCH(px) (DIVIDE_UNSIGNED_ROUND((px) * (uint32_t)254, CIRQUE_PINNACLE_DIAMETER_MM * 10)) + // Convenient way to store and access measurements typedef struct { bool valid; // true if valid data was read, false if no data was ready @@ -84,6 +94,8 @@ typedef struct { } pinnacle_data_t; void cirque_pinnacle_init(void); +void cirque_pinnacle_calibrate(void); +void cirque_pinnacle_cursor_smoothing(bool enable); pinnacle_data_t cirque_pinnacle_read_data(void); void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution); uint16_t cirque_pinnacle_get_scale(void); -- cgit v1.2.1 From 0b726a437b8906fb52662504ccb6e4f052890f3c Mon Sep 17 00:00:00 2001 From: Drzony Date: Sat, 30 Jul 2022 06:20:34 +0200 Subject: Implement relative mode for Cirque trackpad (#17760) --- drivers/sensors/cirque_pinnacle.h | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'drivers/sensors/cirque_pinnacle.h') diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index 1c9bf06fd3..e9bb9621e4 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -21,24 +21,35 @@ # define CIRQUE_PINNACLE_DIAMETER_MM 40 #endif +#if CIRQUE_PINNACLE_POSITION_MODE // Coordinate scaling values -#ifndef CIRQUE_PINNACLE_X_LOWER -# define CIRQUE_PINNACLE_X_LOWER 127 // min "reachable" X value -#endif -#ifndef CIRQUE_PINNACLE_X_UPPER -# define CIRQUE_PINNACLE_X_UPPER 1919 // max "reachable" X value -#endif -#ifndef CIRQUE_PINNACLE_Y_LOWER -# define CIRQUE_PINNACLE_Y_LOWER 63 // min "reachable" Y value -#endif -#ifndef CIRQUE_PINNACLE_Y_UPPER -# define CIRQUE_PINNACLE_Y_UPPER 1471 // max "reachable" Y value -#endif -#ifndef CIRQUE_PINNACLE_X_RANGE -# define CIRQUE_PINNACLE_X_RANGE (CIRQUE_PINNACLE_X_UPPER - CIRQUE_PINNACLE_X_LOWER) -#endif -#ifndef CIRQUE_PINNACLE_Y_RANGE -# define CIRQUE_PINNACLE_Y_RANGE (CIRQUE_PINNACLE_Y_UPPER - CIRQUE_PINNACLE_Y_LOWER) +# ifndef CIRQUE_PINNACLE_X_LOWER +# define CIRQUE_PINNACLE_X_LOWER 127 // min "reachable" X value +# endif +# ifndef CIRQUE_PINNACLE_X_UPPER +# define CIRQUE_PINNACLE_X_UPPER 1919 // max "reachable" X value +# endif +# ifndef CIRQUE_PINNACLE_Y_LOWER +# define CIRQUE_PINNACLE_Y_LOWER 63 // min "reachable" Y value +# endif +# ifndef CIRQUE_PINNACLE_Y_UPPER +# define CIRQUE_PINNACLE_Y_UPPER 1471 // max "reachable" Y value +# endif +# ifndef CIRQUE_PINNACLE_X_RANGE +# define CIRQUE_PINNACLE_X_RANGE (CIRQUE_PINNACLE_X_UPPER - CIRQUE_PINNACLE_X_LOWER) +# endif +# ifndef CIRQUE_PINNACLE_Y_RANGE +# define CIRQUE_PINNACLE_Y_RANGE (CIRQUE_PINNACLE_Y_UPPER - CIRQUE_PINNACLE_Y_LOWER) +# endif +# if defined(POINTING_DEVICE_GESTURE_SCROLL_ENABLE) +# define CIRQUE_PINNACLE_CIRCULAR_SCROLL_ENABLE +# endif +#else +# define CIRQUE_PINNACLE_X_RANGE 256 +# define CIRQUE_PINNACLE_Y_RANGE 256 +# if defined(POINTING_DEVICE_GESTURE_SCROLL_ENABLE) +# define CIRQUE_PINNACLE_SIDE_SCROLL_ENABLE +# endif #endif #if !defined(POINTING_DEVICE_TASK_THROTTLE_MS) # define POINTING_DEVICE_TASK_THROTTLE_MS 10 // Cirque Pinnacle in normal operation produces data every 10ms. Advanced configuration for pen/stylus usage might require lower values. @@ -86,9 +97,9 @@ typedef struct { uint8_t buttonFlags; bool touchDown; #else - uint8_t xDelta; - uint8_t yDelta; - uint8_t wheelCount; + int16_t xDelta; + int16_t yDelta; + int8_t wheelCount; uint8_t buttons; #endif } pinnacle_data_t; -- cgit v1.2.1 From b03a7cef7555119f1cdee95b0c08cafd9f1f18eb Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Sun, 31 Jul 2022 07:51:20 -0700 Subject: Fix POINTING_DEVICE_GESTURES_SCROLL_ENABLE typo (#17850) * Fix typo for POINTING_DEVICE_GESTURES_SCROLL_ENABLE Follow the name written in documentation which follows POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE * Reword the blurb about POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE in docs --- drivers/sensors/cirque_pinnacle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/sensors/cirque_pinnacle.h') diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index e9bb9621e4..320e7d936e 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -41,13 +41,13 @@ # ifndef CIRQUE_PINNACLE_Y_RANGE # define CIRQUE_PINNACLE_Y_RANGE (CIRQUE_PINNACLE_Y_UPPER - CIRQUE_PINNACLE_Y_LOWER) # endif -# if defined(POINTING_DEVICE_GESTURE_SCROLL_ENABLE) +# if defined(POINTING_DEVICE_GESTURES_SCROLL_ENABLE) # define CIRQUE_PINNACLE_CIRCULAR_SCROLL_ENABLE # endif #else # define CIRQUE_PINNACLE_X_RANGE 256 # define CIRQUE_PINNACLE_Y_RANGE 256 -# if defined(POINTING_DEVICE_GESTURE_SCROLL_ENABLE) +# if defined(POINTING_DEVICE_GESTURES_SCROLL_ENABLE) # define CIRQUE_PINNACLE_SIDE_SCROLL_ENABLE # endif #endif -- cgit v1.2.1 From ccdba43e59fc42c9a91373c65eaa4a026539dc80 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 12 Aug 2022 16:22:34 -0700 Subject: Create generic Pointing Device Pin defines (#17776) --- drivers/sensors/cirque_pinnacle.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/sensors/cirque_pinnacle.h') diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index 320e7d936e..fa06e047f2 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -78,7 +78,11 @@ # define CIRQUE_PINNACLE_SPI_DIVISOR 64 # endif # ifndef CIRQUE_PINNACLE_SPI_CS_PIN -# error "No Chip Select pin has been defined -- missing CIRQUE_PINNACLE_SPI_CS_PIN define" +# ifdef POINTING_DEVICE_CS_PIN +# define CIRQUE_PINNACLE_SPI_CS_PIN POINTING_DEVICE_CS_PIN +# else +# error "No Chip Select pin has been defined -- missing POINTING_DEVICE_CS_PIN or CIRQUE_PINNACLE_SPI_CS_PIN define" +# endif # endif # endif #endif -- cgit v1.2.1