Skip to content

Commit

Permalink
Switch to new BusDevice api read_into/write.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Apr 11, 2017
1 parent d7aee4c commit f08e8cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adafruit_si7021.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def init(self):
try:
data = bytearray([_READ_USER1])
with self.i2c_device as i2c:
i2c.writeto(data, stop=False)
i2c.readfrom_into(data)
i2c.write(data, stop=False)
i2c.read_into(data)
value = data[0]
except OSError as e:
if e.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV
Expand All @@ -97,7 +97,7 @@ def _data(self):
# While busy, the sensor doesn't respond to reads.
try:
with self.i2c_device as i2c:
i2c.readfrom_into(data)
i2c.read_into(data)
except OSError as e:
if e.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV
raise
Expand Down

0 comments on commit f08e8cf

Please sign in to comment.