diff options
Diffstat (limited to 'drivers/sensors/pmw3360.c')
-rw-r--r-- | drivers/sensors/pmw3360.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index 81dca002e2..a7dc687f50 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -23,7 +23,7 @@ void pmw33xx_set_cpi(uint8_t sensor, uint16_t cpi) { return; } - uint8_t cpival = CONSTRAIN((cpi / PMW33XX_CPI_STEP) - 1, 0, (PMW33XX_CPI_MAX / PMW33XX_CPI_STEP) - 1U); + uint8_t cpival = CONSTRAIN((cpi / PMW33XX_CPI_STEP), (PMW33XX_CPI_MIN / PMW33XX_CPI_STEP), (PMW33XX_CPI_MAX / PMW33XX_CPI_STEP)) - 1U; pmw33xx_write(sensor, REG_Config1, cpival); } |