39
39
40
40
41
41
# 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 # ..
57
58
_GYRO_SENSITIVITY_1000DPS = 0.03125 # ..
58
59
_GYRO_SENSITIVITY_2000DPS = 0.0625 # ..
59
60
60
61
# 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
65
67
66
68
class FXAS21002C :
67
69
"""Driver for the NXP FXAS21002C gyroscope."""
@@ -130,6 +132,10 @@ def read_raw(self):
130
132
raw_z = ustruct .unpack_from ('>h' , self ._BUFFER [4 :6 ])[0 ]
131
133
return (raw_x , raw_y , raw_z )
132
134
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
133
139
@property
134
140
def gyroscope (self ):
135
141
"""Read the gyroscope value and return its X, Y, Z axis values as a
@@ -145,3 +151,4 @@ def gyroscope(self):
145
151
return map (lambda x : x * _GYRO_SENSITIVITY_1000DPS , raw )
146
152
elif self ._gyro_range == GYRO_RANGE_2000DPS :
147
153
return map (lambda x : x * _GYRO_SENSITIVITY_2000DPS , raw )
154
+ # pylint: enable=inconsistent-return-statements
0 commit comments