-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
drivers: i2c: Move "Use 10-bit addressing" option to i2c_msg #9334
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9334 +/- ##
=======================================
Coverage 52.28% 52.28%
=======================================
Files 213 213
Lines 25964 25964
Branches 5598 5598
=======================================
Hits 13576 13576
Misses 10150 10150
Partials 2238 2238 Continue to review full report at Codecov.
|
drivers/i2c/i2c_nrfx_twi.c
Outdated
@@ -90,10 +94,6 @@ static int i2c_nrfx_twi_configure(struct device *dev, u32_t dev_config) | |||
{ | |||
nrfx_twi_t const *inst = &(get_dev_config(dev)->twi); | |||
|
|||
if (I2C_ADDR_10_BITS & dev_config) { | |||
return -EINVAL; |
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 think this should stay. As long as the flag is available in the API, though it is marked as deprecated, it should be handled correctly to keep the backward compatibility.
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.
Added it back
117b210
to
770bc2b
Compare
@carlescufi @nashif Could we get this merged? |
This commit adds I2C_MSG_ADDR_10_BITS flag, while keeping I2C_ADDR_10_BITS for backward compatibility. I2C_ADDR_10_BITS flag should be removed as soon as all drivers are modified to use message flag. Signed-off-by: Mieszko Mierunski <[email protected]>
10 bit addressing is still not supported on nrf chips, but now I2C_MSG_ADDR_10_BITS flag is checked. Signed-off-by: Mieszko Mierunski <[email protected]>
@@ -52,7 +52,7 @@ extern "C" { | |||
#define I2C_SPEED_GET(cfg) (((cfg) & I2C_SPEED_MASK) \ | |||
>> I2C_SPEED_SHIFT) | |||
|
|||
/** Use 10-bit addressing. */ | |||
/** Use 10-bit addressing. DEPRECATED - Use I2C_MSG_ADDR_10_BITS instead. */ | |||
#define I2C_ADDR_10_BITS (1 << 0) |
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.
I2C_SLAVE_FLAGS_ADDR_10_BITS
references this macro in line 66 (I can't put the comment there). I guess (1 << 0)
should be used there directly.
770bc2b
to
af6c270
Compare
@MaureenHelm @galak can you take a look at this 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.
What about all the other controllers? I wondering if we should say if the controller supports the feature at all, and than handle the error checking there?
Fixes #3806
Added new message flag I2C_MSG_ADDR_10_BITS while keeping the old flag for 10 bit addressing for backward compatibility.
Modified nrf i2c driver to check this flag instead, now all other drivers should be modified in the same way.