summaryrefslogtreecommitdiff
path: root/drivers/sensors
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-07-16 11:33:18 +0200
committerGitHub <noreply@github.com>2022-07-16 11:33:18 +0200
commit580bcff4f65a3a9ee301de0fd036de7b610c7ee2 (patch)
tree5b05be32ed0cc54347d4b7978d69508eb311c85e /drivers/sensors
parentf5e16f94d5da0598590cd821d1363218e86f0f74 (diff)
Use correct angle tune range of +/-30 on PMW33XX (#17693)
Co-authored-by: Daniel Kao <daniel.m.kao@gmail.com> Co-authored-by: Daniel Kao <daniel.m.kao@gmail.com>
Diffstat (limited to 'drivers/sensors')
-rw-r--r--drivers/sensors/pmw33xx_common.c3
-rw-r--r--drivers/sensors/pmw33xx_common.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/sensors/pmw33xx_common.c b/drivers/sensors/pmw33xx_common.c
index 538c40c462..0a8989fcea 100644
--- a/drivers/sensors/pmw33xx_common.c
+++ b/drivers/sensors/pmw33xx_common.c
@@ -1,3 +1,4 @@
+// Copyright 2022 Daniel Kao (dkao)
// Copyright 2022 Stefan Kerkmann (KarlK90)
// Copyright 2022 Ulrich Spörlein (@uqs)
// Copyright 2021 Alabastard (@Alabastard-64)
@@ -165,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, -127, 127));
+ pmw33xx_write(sensor, REG_Angle_Tune, CONSTRAIN(ROTATIONAL_TRANSFORM_ANGLE, -30, 30));
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 181bea3d43..eab8518baa 100644
--- a/drivers/sensors/pmw33xx_common.h
+++ b/drivers/sensors/pmw33xx_common.h
@@ -1,3 +1,4 @@
+// Copyright 2022 Daniel Kao (dkao)
// Copyright 2022 Stefan Kerkmann (KarlK90)
// Copyright 2022 Ulrich Spörlein (@uqs)
// Copyright 2021 Alabastard (@Alabastard-64)
@@ -58,6 +59,10 @@ _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.
+#endif
+
// Support single and plural spellings
#ifndef PMW33XX_CS_PINS
# ifndef PMW33XX_CS_PIN