Skip to content

Wire.endTransmission() return value doesn't match documentation #40

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

Closed
per1234 opened this issue Jul 31, 2019 · 0 comments
Closed

Wire.endTransmission() return value doesn't match documentation #40

per1234 opened this issue Jul 31, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@per1234
Copy link
Contributor

per1234 commented Jul 31, 2019

Wire.endTransmission()'s reference page says:

Returns
byte, which indicates the status of the transmission:

  • 0:success
  • 1:data too long to fit in transmit buffer
  • 2:received NACK on transmit of address
  • 3:received NACK on transmit of data
  • 4:other error

From my reading of this repository's Wire library code, it doesn't seem to comply with the documentation. Wire.endTransmission() returns the return value of TWI_MasterWrite(), which returns the return value of TWI_MasterWriteRead(), which, contrary to its documentation:

 *  \retval true  If transaction could be started.
 *  \retval false If transaction could not be started.

actually returns:

  • false: if twi_mode != TWI_MODE_MASTER
  • bytes really read: if the bytes_to_read parameter > 0
  • 0: if success (huh?)
  • 1: if failure (huh?)
  • 1: if master_trans_status != TWIM_STATUS_READY
@facchinm facchinm added the bug Something isn't working label Jul 31, 2019
@facchinm facchinm self-assigned this Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants