Skip to content

Commit

Permalink
Merge pull request #19 from tmf97/master
Browse files Browse the repository at this point in the history
Added unit conversion deg to rad to be consistent with documentation
  • Loading branch information
ladyada committed Jan 3, 2021
2 parents e969d40 + f1421d8 commit ef29547
Showing 1 changed file with 4 additions and 0 deletions.
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]

0 comments on commit ef29547

Please sign in to comment.