Skip to content

Added unit conversion deg to rad to be consistent with documentation #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions adafruit_fxas21002c.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
GYRO_RANGE_1000DPS = 1000
GYRO_RANGE_2000DPS = 2000

# Unit conversion:
DEGREE_TO_RAD = 3.141592653589793 / 180


class FXAS21002C:
"""Driver for the NXP FXAS21002C gyroscope."""
Expand Down Expand Up @@ -172,4 +175,5 @@ def gyroscope(self):
factor = _GYRO_SENSITIVITY_1000DPS
elif self._gyro_range == GYRO_RANGE_2000DPS:
factor = _GYRO_SENSITIVITY_2000DPS
factor *= DEGREE_TO_RAD
return [x * factor for x in raw]