@@ -228,18 +228,21 @@ 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 :
231
+ def __init__ (self , i2c_bus : I2C , address : int = _LIS3MDL_DEFAULT_ADDRESS ,
232
+ performance_mode : PerformanceMode = PerformanceMode .MODE_ULTRA ,
233
+ data_rate : Rate = Rate .RATE_155_HZ ,
234
+ range_ : Range = Range .RANGE_4_GAUSS ,
235
+ operation_mode : OperationMode = OperationMode .CONTINUOUS ) -> None :
232
236
# pylint: disable=no-member
233
237
self .i2c_device = i2c_device .I2CDevice (i2c_bus , address )
234
238
if self ._chip_id != _LIS3MDL_CHIP_ID :
235
239
raise RuntimeError ("Failed to find LIS3MDL - check your wiring!" )
236
240
237
241
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
242
+ self .performance_mode = performance_mode
243
+ self .data_rate = data_rate
244
+ self .range = range_
245
+ self .operation_mode = operation_mode
243
246
244
247
sleep (0.010 )
245
248
0 commit comments