Skip to content
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

After Wire.requestFrom() there is no need for a timeout and no endTransmission. #12

Open
Koepel opened this issue Oct 8, 2016 · 0 comments

Comments

@Koepel
Copy link

Koepel commented Oct 8, 2016

In the function readReg(), there is a Wire.endTransmission() after the Wire.requestFrom(). That should not be there. The Wire.endTransmission() is only used when writing data.

In the function read(), there is a timeout after Wire.requestFrom(). That timeout is not needed. The Wire.requestFrom() waits until the I2C transmission has completely finished. After that, the received data is in a buffer in the Wire library. The Wire.available() shows how many bytes there are in that buffer.

The return value of Wire.requestFrom() or the Wire.available() could be be used to check if the correct number of bytes was received or if a bus error did occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant