diff --git a/docs/feature_pointing_device.md b/docs/feature_pointing_device.md index 5dacc9f5ab64..377103d6b753 100644 --- a/docs/feature_pointing_device.md +++ b/docs/feature_pointing_device.md @@ -89,15 +89,17 @@ POINTING_DEVICE_DRIVER = cirque_pinnacle_spi This supports the Cirque Pinnacle 1CA027 Touch Controller, which is used in the TM040040, TM035035 and the TM023023 trackpads. These are I2C or SPI compatible, and both configurations are supported. -| Setting | Description | Default | -|---------------------------------|---------------------------------------------------------------------------------|-----------------------| -|`CIRQUE_PINNACLE_X_LOWER` | (Optional) The minimum reachable X value on the sensor. | `127` | -|`CIRQUE_PINNACLE_X_UPPER` | (Optional) The maximum reachable X value on the sensor. | `1919` | -|`CIRQUE_PINNACLE_Y_LOWER` | (Optional) The minimum reachable Y value on the sensor. | `63` | -|`CIRQUE_PINNACLE_Y_UPPER` | (Optional) The maximum reachable Y value on the sensor. | `1471` | -|`CIRQUE_PINNACLE_ATTENUATION` | (Optional) Sets the attenuation of the sensor data. | `ADC_ATTENUATE_4X` | -|`CIRQUE_PINNACLE_TAPPING_TERM` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` | -|`CIRQUE_PINNACLE_TOUCH_DEBOUNCE` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` | +| Setting | Description | Default | +|-------------------------------------|--------------------------------------------------------------------------------------------------|---------------------------------| +|`CIRQUE_PINNACLE_X_LOWER` | (Optional) The minimum reachable X value on the sensor. | `127` | +|`CIRQUE_PINNACLE_X_UPPER` | (Optional) The maximum reachable X value on the sensor. | `1919` | +|`CIRQUE_PINNACLE_Y_LOWER` | (Optional) The minimum reachable Y value on the sensor. | `63` | +|`CIRQUE_PINNACLE_Y_UPPER` | (Optional) The maximum reachable Y value on the sensor. | `1471` | +|`CIRQUE_PINNACLE_ATTENUATION` | (Optional) Sets the attenuation of the sensor data. | `ADC_ATTENUATE_4X` | +|`CIRQUE_PINNACLE_TAPPING_TERM` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` | +|`CIRQUE_PINNACLE_TOUCH_DEBOUNCE` | (Optional) Length of time that a touch can be to be considered a tap. | `TAPPING_TERM`/`200` | +|`CIRQUE_PINNACLE_RESET_ON_INIT_WAIT` | (Optional) Wait time in milliseconds after sending reset during init. Use 0 to skip. | `30` | +|`CIRQUE_PINNACLE_POSITION_MODE` | (Optional) Absolute or Relative positioning mode. Use `CIRQUE_PINNACLE_{ABSOLUTE,RELATIVE}_MODE` | `CIRQUE_PINNACLE_ABSOLUTE_MODE` | **`CIRQUE_PINNACLE_ATTENUATION`** is a measure of how much data is suppressed in regards to sensitivity. The higher the attenuation, the less sensitive the touchpad will be. @@ -122,6 +124,9 @@ Default attenuation is set to 4X, although if you are using a thicker overlay (s Default Scaling/CPI is 1024. +Also see the `POINTING_DEVICE_TASK_THROTTLE_MS`, which defaults to 10ms when using Cirque Pinnacle, which matches the internal update rate of the position registers (in standard configuration). Advanced configuration for pen/stylus usage might require lower values. + + ### Pimoroni Trackball To use the Pimoroni Trackball module, add this to your `rules.mk`: diff --git a/drivers/sensors/cirque_pinnacle.c b/drivers/sensors/cirque_pinnacle.c index 4faa335b7de9..9df42487b76c 100644 --- a/drivers/sensors/cirque_pinnacle.c +++ b/drivers/sensors/cirque_pinnacle.c @@ -210,8 +210,10 @@ void cirque_pinnacle_init(void) { // Bit 1: Shutdown, 1=Shutdown, 0=Active // Bit 2: Sleep Enable, 1=low power mode, 0=normal mode // send a RESET command now, in case QMK had a soft-reset without a power cycle +#if CIRQUE_PINNACLE_RESET_ON_INIT_WAIT > 0 RAP_Write(SYSCONFIG_1, 0x01); - wait_ms(20); // Pinnacle needs 10-15ms to boot, so wait long enough before configuring + wait_ms(CIRQUE_PINNACLE_RESET_ON_INIT_WAIT); +#endif RAP_Write(SYSCONFIG_1, 0x00); wait_us(50); diff --git a/drivers/sensors/cirque_pinnacle.h b/drivers/sensors/cirque_pinnacle.h index 67b86a7e5c6f..13aa72631385 100644 --- a/drivers/sensors/cirque_pinnacle.h +++ b/drivers/sensors/cirque_pinnacle.h @@ -6,7 +6,10 @@ #include #ifndef CIRQUE_PINNACLE_TIMEOUT -# define CIRQUE_PINNACLE_TIMEOUT 20 +# define CIRQUE_PINNACLE_TIMEOUT 20 // I2C timeout in milliseconds +#endif +#ifndef CIRQUE_PINNACLE_RESET_ON_INIT_WAIT +# define CIRQUE_PINNACLE_RESET_ON_INIT_WAIT 30 // milliseconds to wait after setting reset bit. Pinnacle needs 15-20ms to boot, increase if needed. Set to 0 to skip reset-on-init. #endif #define CIRQUE_PINNACLE_ABSOLUTE_MODE 1 @@ -34,9 +37,9 @@ #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) || POINTING_DEVICE_TASK_THROTTLE_MS < 10 +#if !defined(POINTING_DEVICE_TASK_THROTTLE_MS) # undef POINTING_DEVICE_TASK_THROTTLE_MS -# define POINTING_DEVICE_TASK_THROTTLE_MS 10 // Cirque Pinnacle at most will have fresh data every 10ms +# 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"