@@ -228,18 +228,25 @@ class LIS3MDL:
228
228
_range = RWBits (2 , _LIS3MDL_CTRL_REG2 , 5 )
229
229
_reset = RWBit (_LIS3MDL_CTRL_REG2 , 2 )
230
230
231
- def __init__ (self , i2c_bus : I2C , address : int = _LIS3MDL_DEFAULT_ADDRESS ) -> None :
232
- # pylint: disable=no-member
231
+ def __init__ (
232
+ self ,
233
+ i2c_bus : I2C ,
234
+ address : int = _LIS3MDL_DEFAULT_ADDRESS ,
235
+ performance_mode : PerformanceMode = PerformanceMode .MODE_ULTRA ,
236
+ data_rate : Rate = Rate .RATE_155_HZ ,
237
+ range_ : Range = Range .RANGE_4_GAUSS ,
238
+ operation_mode : OperationMode = OperationMode .CONTINUOUS ,
239
+ ) -> None :
240
+ # pylint: disable=no-member,too-many-arguments
233
241
self .i2c_device = i2c_device .I2CDevice (i2c_bus , address )
234
242
if self ._chip_id != _LIS3MDL_CHIP_ID :
235
243
raise RuntimeError ("Failed to find LIS3MDL - check your wiring!" )
236
244
237
245
self .reset ()
238
- self .performance_mode = PerformanceMode .MODE_ULTRA
239
-
240
- self .data_rate = Rate .RATE_155_HZ
241
- self .range = Range .RANGE_4_GAUSS
242
- self .operation_mode = OperationMode .CONTINUOUS
246
+ self .performance_mode = performance_mode
247
+ self .data_rate = data_rate
248
+ self .range = range_
249
+ self .operation_mode = operation_mode
243
250
244
251
sleep (0.010 )
245
252
0 commit comments