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

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

Merged
merged 1 commit into from Mar 14, 2017

Conversation

Projects
None yet
4 participants
@betzw
Contributor

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)

This comment has been minimized.

@0xc0170

0xc0170 Feb 23, 2017

Member

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?

This comment has been minimized.

@betzw

betzw Feb 23, 2017

Contributor

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)!

This comment has been minimized.

@0xc0170

0xc0170 Feb 23, 2017

Member

thanks, that explains it

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Feb 23, 2017

/morph test

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Feb 23, 2017

@mbed-bot

This comment has been minimized.

mbed-bot commented Feb 23, 2017

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 0xc0170 added ready for merge and removed needs: CI labels Feb 23, 2017

@0xc0170 0xc0170 added needs: CI and removed ready for merge labels Mar 6, 2017

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 6, 2017

retest uvisor

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 6, 2017

Restarted two CI that did not send the success status.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 9, 2017

uvisor retest

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 9, 2017

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

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Mar 14, 2017

retest uvisor

@adbridge adbridge merged commit 693f14e into ARMmbed:master Mar 14, 2017

4 checks passed

Cam-CI uvisor Build & Test Success
Details
ci/morph-test Job has started
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment