@@ -186,8 +186,7 @@ class LSM6DS: # pylint: disable=too-many-instance-attributes
186186 _raw_temp_data = Struct (_LSM6DS_OUT_TEMP_L , "<h" )
187187 _emb_func_en_a = Struct (_LSM6DS_EMB_FUNC_EN_A , "<b" )
188188 _emb_func_en_b = Struct (_LSM6DS_EMB_FUNC_EN_B , "<b" )
189- _mlc0_src = Struct (_LSM6DS_MLC0_SRC , "<b" )
190- # _all_int = Struct(_LSM6DS_ALL_INT_SRC, "<bbbbbbbb")
189+ _mlc0_src = Struct (_LSM6DS_MLC0_SRC , "<bbbbbbbb" )
191190 # RWBits:
192191 _accel_range = RWBits (2 , _LSM6DS_CTRL1_XL , 2 )
193192 _accel_data_rate = RWBits (4 , _LSM6DS_CTRL1_XL , 4 )
@@ -241,7 +240,6 @@ def __init__(
241240 self .accelerometer_range = AccelRange .RANGE_4G # pylint: disable=no-member
242241 self .gyro_range = GyroRange .RANGE_250_DPS # pylint: disable=no-member
243242 # Load and configure MLC if UCF file is provided
244- print (ucf )
245243 if ucf is not None :
246244 self .load_mlc (ucf )
247245
@@ -406,17 +404,15 @@ def temperature(self) -> float:
406404
407405 return temp * 0.0625
408406
409- def set_embedded_functions (self , enable , emb_ab = None ):
410- """DocString Here """
407+ def _set_embedded_functions (self , enable , emb_ab = None ):
408+ """Enable/disable embedded functions - returns prior settings when disabled """
411409 self ._mem_bank = 1
412410 if enable :
413411 self ._emb_func_en_a = emb_ab [0 ]
414412 self ._emb_func_en_b = emb_ab [1 ]
415413 else :
416414 emb_a = self ._emb_func_en_a
417415 emb_b = self ._emb_func_en_b
418- print (emb_a )
419- print (emb_b )
420416 self ._emb_func_en_a = (emb_a [0 ] & 0xC7 ,)
421417 self ._emb_func_en_b = (emb_b [0 ] & 0xE6 ,)
422418 emb_ab = (emb_a , emb_b )
@@ -425,20 +421,20 @@ def set_embedded_functions(self, enable, emb_ab=None):
425421 return emb_ab
426422
427423 def load_mlc (self , ucf ):
428- """DOCString Here """
424+ """Load MLC configuration file into sensor """
429425 buf = bytearray (2 )
430426 with self .i2c_device as i2c :
431427 # Load MLC config from file
432428 with open (ucf , "r" ) as ucf_file :
433429 for line in ucf_file :
434430 if line .startswith ("Ac" ):
435431 command = [int (v , 16 ) for v in line .strip ().split (" " )[1 :3 ]]
436- print (line )
437432 buf [0 ] = command [0 ]
438433 buf [1 ] = command [1 ]
439434 i2c .write (buf )
440435
441- emb_ab = self .set_embedded_functions (False )
436+ # Disable embudded function -- save current settings
437+ emb_ab = self ._set_embedded_functions (False )
442438
443439 # Disable I3C interface
444440 self ._i3c_disable = 1
@@ -449,19 +445,19 @@ def load_mlc(self, ucf):
449445 # Route signals on interrupt pin 1
450446 self ._mem_bank = 1
451447 self ._route_int1 &= 1
452- self ._mem_bank = 1
448+ self ._mem_bank = 0
453449
454450 # Configure interrupt pin mode
455451 self ._tap_latch = 1
456452 self ._tap_clear = 1
457453
458- self .set_embedded_functions (True , emb_ab )
454+ # Enabble Embedded Functions using previously stored settings
455+ self ._set_embedded_functions (True , emb_ab )
459456
460457 def read_mlc_output (self ):
461- """DOCString here """
458+ """Read MLC results """
462459 buf = None
463460 if self ._mlc_status :
464- # junk = self._all_int
465461 self ._mem_bank = 1
466462 buf = self ._mlc0_src
467463 self ._mem_bank = 0
0 commit comments