8000 Wire.endTransmission() return value doesn't match documentation · Issue #40 · arduino/ArduinoCore-megaavr · GitHub
[go: up one dir, main page]

Skip to content
Wire.endTransmission() return value doesn't match documentation #40
Closed
@per1234

Description

@per1234

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
4002

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0