Skip to content

I2C - correct return values for write functions (docs) - part 1 #3301

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
Dec 2, 2016
Merged
Show file tree
Hide file tree
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: 5 additions & 4 deletions drivers/I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class I2C {
* @param repeated Repeated start, true - do not send stop at end
*
* @returns
* 0 on success (ack),
* non-0 on failure (nack)
* 0 or non-zero - written number of bytes,
* negative - I2C_ERROR_XXX status
*/
int write(int address, const char *data, int length, bool repeated = false);

Expand All @@ -127,8 +127,9 @@ class I2C {
* @param data data to write out on bus
*
* @returns
* '1' if an ACK was received,
* '0' otherwise
* '0' - NAK was received
* '1' - ACK was received,
* '2' - timeout
*/
int write(int data);

Expand Down
4 changes: 3 additions & 1 deletion hal/i2c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
* @param data The buffer for sending
* @param length Number of bytes to write
* @param stop Stop to be generated after the transfer is done
* @return Number of written bytes
* @return
* zero or non-zero - Number of written bytes
* negative - I2C_ERROR_XXX status
*/
int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);

Expand Down