@@ -52,9 +52,9 @@ def _read_u16le(self, register):
52
52
# register.
53
53
with self ._device as i2c :
54
54
_BUFFER [0 ] = register & 0xFF
55
- i2c . write ( _BUFFER , end = 1 , stop = False )
56
- i2c .readinto (_BUFFER , end = 2 )
57
- return (_BUFFER [1 ] << 8 ) | _BUFFER [0 ]
55
+
56
+ i2c .write_then_readinto (_BUFFER , _BUFFER , out_end = 1 , in_start = 1 , in_end = 3 )
57
+ return (_BUFFER [2 ] << 8 ) | _BUFFER [1 ]
58
58
59
59
def _write_u16le (self , register , val ):
60
60
# Write an unsigned 16 bit little endian value to the specified 8-bit
@@ -69,9 +69,9 @@ def _read_u8(self, register):
69
69
# Read an unsigned 8 bit value from the specified 8-bit register.
70
70
with self ._device as i2c :
71
71
_BUFFER [0 ] = register & 0xFF
72
- i2c . write ( _BUFFER , end = 1 , stop = False )
73
- i2c .readinto (_BUFFER , end = 1 )
74
- return _BUFFER [0 ]
72
+
73
+ i2c .write_then_readinto (_BUFFER , _BUFFER , out_end = 1 , in_start = 1 , in_end = 2 )
74
+ return _BUFFER [1 ]
75
75
76
76
def _write_u8 (self , register , val ):
77
77
# Write an 8 bit value to the specified 8-bit register.
0 commit comments