diff options
author | Drashna Jaelre <[email protected]> | 2024-02-19 16:36:28 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-20 11:36:28 +1100 |
commit | 66780783c79ba8be38dcc0921b15ddd68827e97d (patch) | |
tree | 5077e9c0108e4078765a550022d1ef9cf4dd3806 /drivers | |
parent | 6efb71d401cf842241514b7dc9d425d0c5ec4f41 (diff) | |
download | qmk_firmware-66780783c79ba8be38dcc0921b15ddd68827e97d.tar.gz qmk_firmware-66780783c79ba8be38dcc0921b15ddd68827e97d.zip |
[Bug] Fix pmw33xx sensor corruption on get-cpi call (#23116)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/sensors/pmw3360.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index a7dc687f50..8408daa945 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -15,6 +15,9 @@ uint16_t pmw33xx_get_cpi(uint8_t sensor) { } uint8_t cpival = pmw33xx_read(sensor, REG_Config1); + // In some cases (100, 900, 1700, 2500), reading the CPI corrupts the firmware and the sensor stops responding. + // To avoid this, we write the value back to the sensor, which seems to prevent the corruption. + pmw33xx_write(sensor, REG_Config1, cpival); return (uint16_t)((cpival + 1) & 0xFF) * PMW33XX_CPI_STEP; } |