summaryrefslogtreecommitdiff
path: root/drivers/sensors/pmw3360.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sensors/pmw3360.c')
-rw-r--r--drivers/sensors/pmw3360.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c
index 2b27dccbb6..50d1c35801 100644
--- a/drivers/sensors/pmw3360.c
+++ b/drivers/sensors/pmw3360.c
@@ -143,7 +143,7 @@ void pmw3360_set_cpi(uint16_t cpi) {
uint16_t pmw3360_get_cpi(void) {
uint8_t cpival = spi_read_adv(REG_Config1);
- return (uint16_t)(cpival & 0xFF) * 100;
+ return (uint16_t)((cpival + 1) & 0xFF) * 100;
}
bool pmw3360_init(void) {
@@ -186,6 +186,8 @@ bool pmw3360_init(void) {
spi_write_adv(REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -30, 30));
+ spi_write_adv(REG_Lift_Config, PMW3360_LIFTOFF_DISTANCE);
+
bool init_success = pmw3360_check_signature();
writePinLow(PMW3360_CS_PIN);