@@ -210,8 +210,8 @@ def gesture(self): #pylint: disable-msg=too-many-branches
210210 if n_recs :
211211
212212 with self .i2c_device as i2c :
213- i2c .write (buffer , end = 1 , stop = False )
214- i2c . readinto ( buffer , start = 1 , end = min (129 , 1 + n_recs * 4 ))
213+ i2c .write_then_readinto (buffer , buffer , out_end = 1 , in_start = 1 ,
214+ in_end = min (129 , 1 + n_recs * 4 ))
215215 upp , down , left , right = buffer [1 :5 ]
216216
217217 if abs (upp - down ) > 13 :
@@ -356,8 +356,7 @@ def _read8(self, command):
356356 buf = self .buf2
357357 buf [0 ] = command
358358 with self .i2c_device as i2c :
359- i2c .write (buf , end = 1 )
360- i2c .readinto (buf , end = 1 )
359+ i2c .write_then_readinto (buf , buf , out_end = 1 , in_end = 1 )
361360 return buf [0 ]
362361
363362 def _color_data16 (self , command ):
@@ -366,6 +365,5 @@ def _color_data16(self, command):
366365 buf = self .buf2
367366 buf [0 ] = command
368367 with self .i2c_device as i2c :
369- i2c .write (buf , end = 1 , stop = False )
370- i2c .readinto (buf )
368+ i2c .write_then_readinto (buf , buf , out_end = 1 )
371369 return buf [1 ] << 8 | buf [0 ]
0 commit comments