Skip to content

Commit 3485f21

Browse files
authored
Merge pull request #10 from tannewt/remove_stop
Remove stop kwarg and use write_then_readinto.
2 parents 995c23e + 7f1a072 commit 3485f21

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

adafruit_tsl2591.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ def _read_u8(self, address):
125125
with self._device as i2c:
126126
# Make sure to add command bit to read request.
127127
self._BUFFER[0] = (_TSL2591_COMMAND_BIT | address) & 0xFF
128-
i2c.write(self._BUFFER, end=1, stop=False)
129-
i2c.readinto(self._BUFFER, end=1)
128+
i2c.write_then_readinto(self._BUFFER, self._BUFFER, out_end=1, in_end=1)
130129
return self._BUFFER[0]
131130

132131
# Disable invalid name check since pylint isn't smart enough to know LE
@@ -138,8 +137,7 @@ def _read_u16LE(self, address):
138137
with self._device as i2c:
139138
# Make sure to add command bit to read request.
140139
self._BUFFER[0] = (_TSL2591_COMMAND_BIT | address) & 0xFF
141-
i2c.write(self._BUFFER, end=1, stop=False)
142-
i2c.readinto(self._BUFFER, end=2)
140+
i2c.write_then_readinto(self._BUFFER, self._BUFFER, out_end=1, in_end=2)
143141
return (self._BUFFER[1] << 8) | self._BUFFER[0]
144142
#pylint: enable=invalid-name
145143

0 commit comments

Comments
 (0)