diff options
author | Glen D'souza <[email protected]> | 2023-09-24 03:53:15 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2023-09-23 15:23:15 -0700 |
commit | 9c340077f630ef464758687e67e415e85376dad1 (patch) | |
tree | 593db42880285ff3d010c04cc607407f5dac6c5e /drivers/sensors/pmw3320.c | |
parent | c9810faccee16f11ff363418eefc148181dd8d79 (diff) | |
download | qmk_firmware-9c340077f630ef464758687e67e415e85376dad1.tar.gz qmk_firmware-9c340077f630ef464758687e67e415e85376dad1.zip |
Fix lower cpi bound on PMW33XX (#22108)
Diffstat (limited to 'drivers/sensors/pmw3320.c')
-rw-r--r-- | drivers/sensors/pmw3320.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/sensors/pmw3320.c b/drivers/sensors/pmw3320.c index a4648ef425..69a584f4e1 100644 --- a/drivers/sensors/pmw3320.c +++ b/drivers/sensors/pmw3320.c @@ -178,7 +178,7 @@ uint16_t pmw3320_get_cpi(void) { } void pmw3320_set_cpi(uint16_t cpi) { - uint8_t cpival = constrain((cpi / PMW3320_CPI_STEP) - 1U, 0, (PMW3320_CPI_MAX / PMW3320_CPI_STEP) - 1U); + uint8_t cpival = constrain((cpi / PMW3320_CPI_STEP), (PMW3320_CPI_MIN / PMW3320_CPI_STEP), (PMW3320_CPI_MAX / PMW3320_CPI_STEP)) - 1U; // Fifth bit is probably a control bit. // PMW3320 datasheet don't have any info on this, so this is a pure guess. pmw3320_write_reg(REG_Resolution, 0x20 | cpival); |