Merge pull request #5 from tannewt/remove_stop

Remove stop kwarg and use write_then_readinto.
This commit is contained in:
Kattni 2019-08-27 15:10:03 -04:00 committed by GitHub
commit 4e70f39b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,7 +74,7 @@ def _eeprom_i2c_wait(i2c, i2c_addr, mem_addr, timeout=1.0):
timestamp = time.monotonic()
while time.monotonic() < timestamp + timeout:
try:
i2c.writeto(i2c_addr, bytearray([mem_addr]), end=1, stop=False)
i2c.writeto(i2c_addr, bytearray([mem_addr]), end=1)
return True
except OSError:
pass
@ -113,7 +113,7 @@ def _eeprom_i2c_read_byte(i2c, i2c_addr, mem_addr, timeout=1.0):
# Finish the read
buf = bytearray(1)
i2c.readfrom_into(i2c_addr, buf)
i2c.writeto_then_readfrom(i2c_addr, bytearray([mem_addr]), buf)
return True, buf