Skip to content

Commit 0bd439a

Browse files
committed
Add back vertical alignment removed in error, fix warning from lint."
1 parent 5805e79 commit 0bd439a

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

adafruit_fxas21002c.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,31 @@
3939

4040

4141
# Internal constants and register values:
42-
_FXAS21002C_ADDRESS = const(0x21) # 0100001
43-
_FXAS21002C_ID = const(0xD7) # 1101 0111
44-
_GYRO_REGISTER_STATUS = const(0x00)
45-
_GYRO_REGISTER_OUT_X_MSB = const(0x01)
46-
_GYRO_REGISTER_OUT_X_LSB = const(0x02)
47-
_GYRO_REGISTER_OUT_Y_MSB = const(0x03)
48-
_GYRO_REGISTER_OUT_Y_LSB = const(0x04)
49-
_GYRO_REGISTER_OUT_Z_MSB = const(0x05)
50-
_GYRO_REGISTER_OUT_Z_LSB = const(0x06)
51-
_GYRO_REGISTER_WHO_AM_I = const(0x0C) # 11010111 r
52-
_GYRO_REGISTER_CTRL_REG0 = const(0x0D) # 00000000 r/w
53-
_GYRO_REGISTER_CTRL_REG1 = const(0x13) # 00000000 r/w
54-
_GYRO_REGISTER_CTRL_REG2 = const(0x14) # 00000000 r/w
55-
_GYRO_SENSITIVITY_250DPS = 0.0078125 # Table 35 of datasheet
56-
_GYRO_SENSITIVITY_500DPS = 0.015625 # ..
42+
# pylint: disable=bad-whitespace
43+
_FXAS21002C_ADDRESS = const(0x21) # 0100001
44+
_FXAS21002C_ID = const(0xD7) # 1101 0111
45+
_GYRO_REGISTER_STATUS = const(0x00)
46+
_GYRO_REGISTER_OUT_X_MSB = const(0x01)
47+
_GYRO_REGISTER_OUT_X_LSB = const(0x02)
48+
_GYRO_REGISTER_OUT_Y_MSB = const(0x03)
49+
_GYRO_REGISTER_OUT_Y_LSB = const(0x04)
50+
_GYRO_REGISTER_OUT_Z_MSB = const(0x05)
51+
_GYRO_REGISTER_OUT_Z_LSB = const(0x06)
52+
_GYRO_REGISTER_WHO_AM_I = const(0x0C) # 11010111 r
53+
_GYRO_REGISTER_CTRL_REG0 = const(0x0D) # 00000000 r/w
54+
_GYRO_REGISTER_CTRL_REG1 = const(0x13) # 00000000 r/w
55+
_GYRO_REGISTER_CTRL_REG2 = const(0x14) # 00000000 r/w
56+
_GYRO_SENSITIVITY_250DPS = 0.0078125 # Table 35 of datasheet
57+
_GYRO_SENSITIVITY_500DPS = 0.015625 # ..
5758
_GYRO_SENSITIVITY_1000DPS = 0.03125 # ..
5859
_GYRO_SENSITIVITY_2000DPS = 0.0625 # ..
5960

6061
# User facing constants/module globals:
61-
GYRO_RANGE_250DPS = 250
62-
GYRO_RANGE_500DPS = 500
63-
GYRO_RANGE_1000DPS = 1000
64-
GYRO_RANGE_2000DPS = 2000
62+
GYRO_RANGE_250DPS = 250
63+
GYRO_RANGE_500DPS = 500
64+
GYRO_RANGE_1000DPS = 1000
65+
GYRO_RANGE_2000DPS = 2000
66+
# pylint: enable=bad-whitespace
6567

6668
class FXAS21002C:
6769
"""Driver for the NXP FXAS21002C gyroscope."""
@@ -130,6 +132,10 @@ def read_raw(self):
130132
raw_z = ustruct.unpack_from('>h', self._BUFFER[4:6])[0]
131133
return (raw_x, raw_y, raw_z)
132134

135+
# pylint is confused and incorrectly marking this function as bad return
136+
# types. Perhaps it doesn't understand map returns an iterable value.
137+
# Disable the warning.
138+
# pylint: disable=inconsistent-return-statements
133139
@property
134140
def gyroscope(self):
135141
"""Read the gyroscope value and return its X, Y, Z axis values as a
@@ -145,3 +151,4 @@ def gyroscope(self):
145151
return map(lambda x: x * _GYRO_SENSITIVITY_1000DPS, raw)
146152
elif self._gyro_range == GYRO_RANGE_2000DPS:
147153
return map(lambda x: x * _GYRO_SENSITIVITY_2000DPS, raw)
154+
# pylint: enable=inconsistent-return-statements

0 commit comments

Comments
 (0)