@@ -107,17 +107,15 @@ def _read_u8(self, address):
107107 # Read an 8-bit unsigned value from the specified 8-bit address.
108108 with self ._device as i2c :
109109 self ._BUFFER [0 ] = address & 0xFF
110- i2c .write (self ._BUFFER , end = 1 , stop = False )
111- i2c .readinto (self ._BUFFER , end = 1 )
112- return self ._BUFFER [0 ]
110+ i2c .write_then_readinto (self ._BUFFER , self ._BUFFER , out_end = 1 , in_start = 1 )
111+ return self ._BUFFER [1 ]
113112
114113 def _read_u16BE (self , address ):
115114 # Read a 16-bit big-endian unsigned value from the specified 8-bit address.
116115 with self ._device as i2c :
117116 self ._BUFFER [0 ] = address & 0xFF
118- i2c .write (self ._BUFFER , end = 1 , stop = False )
119- i2c .readinto (self ._BUFFER , end = 2 )
120- return (self ._BUFFER [0 ] << 8 ) | self ._BUFFER [1 ]
117+ i2c .write_then_readinto (self ._BUFFER , self ._BUFFER , out_end = 1 , in_start = 1 )
118+ return (self ._BUFFER [1 ] << 8 ) | self ._BUFFER [2 ]
121119
122120 def _write_u8 (self , address , val ):
123121 # Write an 8-bit unsigned value to the specified 8-bit address.
0 commit comments