-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
* 0 or non-zero - written number of bytes, | ||
* negative - I2C_ERROR_XXX status | ||
* 0 on success (ack), | ||
* non-0 on failure (nack) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that explains it
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
retest uvisor |
Restarted two CI that did not send the success status. |
uvisor retest |
@marhil01 - please "fix org.jenkinsci.plugins.github_branch_source.RateLimitExceededException: GitHub API rate limit exceeded" |
retest uvisor |
Description
Correct the comment before
I2C::write(int, const char*, int, bool)
specifying the right return values.Status
READY
Migrations
NO