Skip to content

Remove stop kwarg and use write_then_readinto. #8

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 1 commit into from
Aug 28, 2019
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
7 changes: 5 additions & 2 deletions adafruit_si4713.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ def _read_u8(self, address):
# Read an 8-bit unsigned value from the specified 8-bit address.
with self._device as i2c:
self._BUFFER[0] = address & 0xFF
i2c.write(self._BUFFER, end=1, stop=True)
# TODO: This is probably wrong and should be write_then_readinto to avoid a stop before
# repeated start.
i2c.write(self._BUFFER, end=1)
i2c.readinto(self._BUFFER, end=1)
return self._BUFFER[0]

Expand All @@ -169,8 +171,9 @@ def _write_from(self, buf, count=None):
if count is None:
count = len(buf)
# Send command.
# TODO: This probably needs to be one write_then_readinto.
with self._device as i2c:
i2c.write(buf, end=count, stop=True)
i2c.write(buf, end=count)
# Poll the status bit waiting for success or throwing a timeout error.
start = time.monotonic()
while True:
Expand Down