Skip to content

Update adafruit_bitbangio.py #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions adafruit_bitbangio.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def scan(self):
found.append(address)
return found

def writeto(self, address, buffer, *, start=0, end=None, stop=True):
def writeto(self, address, buffer, *, start=0, end=None):
"""Write data from the buffer to an address"""
if end is None:
end = len(buffer)
if self._check_lock():
self._write(address, buffer[start:end], stop)
self._write(address, buffer[start:end], True)

def readfrom_into(self, address, buffer, *, start=0, end=None):
"""Read data from an address and into the buffer"""
Expand All @@ -147,8 +147,7 @@ def writeto_then_readfrom(
out_start=0,
out_end=None,
in_start=0,
in_end=None,
stop=True
in_end=None
):
"""Write data from buffer_out to an address and then
read data from an address and into buffer_in
Expand All @@ -158,7 +157,7 @@ def writeto_then_readfrom(
if in_end is None:
in_end = len(buffer_in)
if self._check_lock():
self.writeto(address, buffer_out, start=out_start, end=out_end, stop=stop)
self.writeto(address, buffer_out, start=out_start, end=out_end)
self.readfrom_into(address, buffer_in, start=in_start, end=in_end)

def _scl_low(self):
Expand Down