Skip to content

Commit 8662a81

Browse files
committed
Fixed the writeto_then_readfrom() in a better way.
I notice that the stop was removed from writeto() for a reason, so instead of adding it back I just call _write() instead.
1 parent a4fdaa9 commit 8662a81

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_bitbangio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ def scan(self):
114114
found.append(address)
115115
return found
116116

117-
def writeto(self, address, buffer, *, start=0, end=None, stop=True):
117+
def writeto(self, address, buffer, *, start=0, end=None):
118118
"""Write data from the buffer to an address"""
119119
if end is None:
120120
end = len(buffer)
121121
if self._check_lock():
122-
self._write(address, buffer[start:end], stop)
122+
self._write(address, buffer[start:end], True)
123123

124124
def readfrom_into(self, address, buffer, *, start=0, end=None):
125125
"""Read data from an address and into the buffer"""
@@ -150,7 +150,7 @@ def writeto_then_readfrom(
150150
if in_end is None:
151151
in_end = len(buffer_in)
152152
if self._check_lock():
153-
self.writeto(address, buffer_out, start=out_start, end=out_end, stop=False)
153+
self._write(address, buffer[out_start:out_end], False)
154154
self.readfrom_into(address, buffer_in, start=in_start, end=in_end)
155155

156156
def _scl_low(self):

0 commit comments

Comments
 (0)