Skip to content

Commit 89fc11e

Browse files
authored
Merge pull request #5 from tannewt/remove_stop
Remove stop kwarg and use write_then_readinto.
2 parents e19423a + 1b8f5dc commit 89fc11e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

adafruit_tmp007.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ def read_register(self, register):
166166
def _read_u8(self, address):
167167
with self._device as i2c:
168168
self._BUFFER[0] = address & 0xFF
169-
i2c.write(self._BUFFER, end=1, stop=False)
170-
i2c.readinto(self._BUFFER, end=1)
169+
i2c.write_then_readinto(self._BUFFER, self._BUFFER,
170+
out_end=1, in_end=1)
171171
return self._BUFFER[0]
172172

173173
def _read_u16(self, address):
174174
with self._device as i2c:
175175
self._BUFFER[0] = address & 0xFF
176-
i2c.write(self._BUFFER, end=1, stop=False)
177-
i2c.readinto(self._BUFFER, end=2)
176+
i2c.write_then_readinto(self._BUFFER, self._BUFFER,
177+
out_end=1, in_end=2)
178178
return self._BUFFER[0]<<8 | self._BUFFER[1]
179179

180180
def _write_u8(self, address, val):
@@ -194,5 +194,4 @@ def _write_u16(self, address, val):
194194
def _read_bytes(device, address, count, buf):
195195
with device as i2c:
196196
buf[0] = address & 0xFF
197-
i2c.write(buf, end=1, stop=False)
198-
i2c.readinto(buf, end=count)
197+
i2c.write_then_readinto(buf, buf, out_end=1, in_end=count)

0 commit comments

Comments
 (0)