Skip to content

Correct return values for I2C::write(int, const char*, int, bool) #3827

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
Mar 14, 2017

Conversation

betzw
Copy link
Contributor

@betzw betzw commented Feb 23, 2017

Description

Correct the comment before I2C::write(int, const char*, int, bool) specifying the right return values.

Status

READY

Migrations

NO

* 0 or non-zero - written number of bytes,
* negative - I2C_ERROR_XXX status
* 0 on success (ack),
* non-0 on failure (nack)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall this was updated not that long ago. Is a positive number really a failure?

This came from i2c HAL write that specifies the following:

`/** Blocking sending data
 *
 *  @param obj     The I2C object
 *  @param address 7-bit address (last bit is 0)
 *  @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 
 *      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);

How many targets do follow this new update? how does it map to the current one?

Copy link
Contributor Author

@betzw betzw Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there a two different methods/functions: one is
method I2C::write(int, const char*, int, bool) declared in drivers/I2C.h,
the other one is
function i2c_write(i2c_t*, int, const char, int, int) declared in hal/i2c_api.h.

Method I2C::write(int, const char*, int, bool) uses function i2c_write(i2c_t*, int, const char, int, int) to implement its functionality (see here, especially line #66).

In particular note that the return value of method I2C::write(int, const char*, int, bool) is computed in this line ... and is different from the return value of function i2c_write(i2c_t*, int, const char, int, int)!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, that explains it

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 23, 2017

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1686

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 6, 2017

retest uvisor

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 6, 2017

Restarted two CI that did not send the success status.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2017

uvisor retest

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2017

@marhil01 - please "fix org.jenkinsci.plugins.github_branch_source.RateLimitExceededException: GitHub API rate limit exceeded"

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 14, 2017

retest uvisor

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

Successfully merging this pull request may close these issues.

4 participants