diff options
author | Stefan Kerkmann <karlk90@pm.me> | 2022-07-17 21:08:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 21:08:55 +0200 |
commit | a304a9b51ed6e876f25c579f383e2cbf9afb8353 (patch) | |
tree | f8826b4d9014b0869517214f7afbc4cfa9892272 | |
parent | 4779539543759580b652b719e96566e16cf7132b (diff) | |
download | qmk_firmware-a304a9b51ed6e876f25c579f383e2cbf9afb8353.tar.gz qmk_firmware-a304a9b51ed6e876f25c579f383e2cbf9afb8353.zip |
Use correct angle tune range of +/-127 on PMW33XX (#17708)
...partially reverts 580bcff4f65a3a9ee301de0fd036de7b610c7ee2 as the
datasheet doesn't claim that the angle tuning as limited to +/- 30
degrees.
-rw-r--r-- | docs/feature_pointing_device.md | 18 | ||||
-rw-r--r-- | drivers/sensors/pmw33xx_common.c | 2 | ||||
-rw-r--r-- | drivers/sensors/pmw33xx_common.h | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/docs/feature_pointing_device.md b/docs/feature_pointing_device.md index 7cfdaac407..6343ed073d 100644 --- a/docs/feature_pointing_device.md +++ b/docs/feature_pointing_device.md @@ -176,15 +176,15 @@ The CPI range is 50-16000, in increments of 50. Defaults to 2000 CPI. Both PMW 3360 and PMW 3389 are SPI driven optical sensors, that use a built in IR LED for surface tracking. -| Setting | Description | Default | -| ---------------------------- | ------------------------------------------------------------------------------------------ | ------------- | -| `PMW33XX_CS_PIN` | (Required) Sets the Cable Select pin connected to the sensor. | _not defined_ | -| `PMW33XX_CS_PINS` | (Alternative) Sets the Cable Select pins connected to multiple sensors. | _not defined_ | -| `PMW33XX_CPI` | (Optional) Sets counts per inch sensitivity of the sensor. | _varies_ | -| `PMW33XX_CLOCK_SPEED` | (Optional) Sets the clock speed that the sensor runs at. | `2000000` | -| `PMW33XX_SPI_DIVISOR` | (Optional) Sets the SPI Divisor used for SPI communication. | _varies_ | -| `PMW33XX_LIFTOFF_DISTANCE` | (Optional) Sets the lift off distance at run time | `0x02` | -| `ROTATIONAL_TRANSFORM_ANGLE` | (Optional) Allows for the sensor data to be rotated +/- 30 degrees directly in the sensor. | `0` | +| Setting | Description | Default | +| ---------------------------- | ------------------------------------------------------------------------------------------- | ------------- | +| `PMW33XX_CS_PIN` | (Required) Sets the Cable Select pin connected to the sensor. | _not defined_ | +| `PMW33XX_CS_PINS` | (Alternative) Sets the Cable Select pins connected to multiple sensors. | _not defined_ | +| `PMW33XX_CPI` | (Optional) Sets counts per inch sensitivity of the sensor. | _varies_ | +| `PMW33XX_CLOCK_SPEED` | (Optional) Sets the clock speed that the sensor runs at. | `2000000` | +| `PMW33XX_SPI_DIVISOR` | (Optional) Sets the SPI Divisor used for SPI communication. | _varies_ | +| `PMW33XX_LIFTOFF_DISTANCE` | (Optional) Sets the lift off distance at run time | `0x02` | +| `ROTATIONAL_TRANSFORM_ANGLE` | (Optional) Allows for the sensor data to be rotated +/- 127 degrees directly in the sensor. | `0` | To use multiple sensors, instead of setting `PMW33XX_CS_PIN` you need to set `PMW33XX_CS_PINS` and also handle and merge the read from this sensor in user code. Note that different (per sensor) values of CPI, speed liftoff, rotational angle or flipping of X/Y is not currently supported. diff --git a/drivers/sensors/pmw33xx_common.c b/drivers/sensors/pmw33xx_common.c index 0a8989fcea..13164cb150 100644 --- a/drivers/sensors/pmw33xx_common.c +++ b/drivers/sensors/pmw33xx_common.c @@ -166,7 +166,7 @@ bool pmw33xx_init(uint8_t sensor) { wait_ms(1); pmw33xx_write(sensor, REG_Config2, 0x00); - pmw33xx_write(sensor, REG_Angle_Tune, CONSTRAIN(ROTATIONAL_TRANSFORM_ANGLE, -30, 30)); + pmw33xx_write(sensor, REG_Angle_Tune, CONSTRAIN(ROTATIONAL_TRANSFORM_ANGLE, -127, 127)); pmw33xx_write(sensor, REG_Lift_Config, PMW33XX_LIFTOFF_DISTANCE); if (!pmw33xx_check_signature(sensor)) { diff --git a/drivers/sensors/pmw33xx_common.h b/drivers/sensors/pmw33xx_common.h index eab8518baa..87e8b34d5c 100644 --- a/drivers/sensors/pmw33xx_common.h +++ b/drivers/sensors/pmw33xx_common.h @@ -59,8 +59,8 @@ _Static_assert(sizeof((pmw33xx_report_t){0}.motion) == 1, "pmw33xx_report_t.moti # define ROTATIONAL_TRANSFORM_ANGLE 0x00 #endif -#if ROTATIONAL_TRANSFORM_ANGLE > 30 || ROTATIONAL_TRANSFORM_ANGLE < (-30) -# error ROTATIONAL_TRANSFORM_ANGLE has to be in the range of +/- 30 for all PMW33XX sensors. +#if ROTATIONAL_TRANSFORM_ANGLE > 127 || ROTATIONAL_TRANSFORM_ANGLE < (-127) +# error ROTATIONAL_TRANSFORM_ANGLE has to be in the range of +/- 127 for all PMW33XX sensors. #endif // Support single and plural spellings |