Skip to content

Commit fda6ee3

Browse files
committed
switch to write and readinto
1 parent 74a7a7f commit fda6ee3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_vl6180x.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,15 @@ def _read_8(self, address):
276276
# Read and return a byte from the specified 16-bit register address.
277277
with self._device as i2c:
278278
result = bytearray(1)
279-
i2c.write_then_readinto(bytes([(address >> 8) & 0xFF, address & 0xFF]), result)
279+
i2c.write(bytes([(address >> 8) & 0xFF, address & 0xFF]))
280+
i2c.readinto(result)
280281
return result[0]
281282

282283
def _read_16(self, address):
283284
# Read and return a 16-bit unsigned big endian value read from the
284285
# specified 16-bit register address.
285286
with self._device as i2c:
286287
result = bytearray(2)
287-
i2c.write_then_readinto(bytes([(address >> 8) & 0xFF, address & 0xFF]), result)
288+
i2c.write(bytes([(address >> 8) & 0xFF, address & 0xFF]))
289+
i2c.readinto(result)
288290
return (result[0] << 8) | result[1]

0 commit comments

Comments
 (0)