-
Notifications
You must be signed in to change notification settings - Fork 918
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
Add I2C last_abort_reason #1370
base: develop
Are you sure you want to change the base?
Add I2C last_abort_reason #1370
Conversation
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.
This looks good to me.
30f37a6
to
37a61a7
Compare
Fixed build issue |
assigning to myself; i think i'd rather return the abort reason in the top half of a 64 bit rc (and do some API massaging) |
I don't think you liked this change? I could add a variant of the functions to return int64_t if that sounds like what you wanted? |
yeah, i guess returning a struct with two elements in a replacement APIs and picking the result out for the existing APIs is good |
37a61a7
to
60f5901
Compare
@@ -246,6 +251,7 @@ static inline i2c_inst_t *i2c_get_instance(uint num) { | |||
* | |||
* \return Number of bytes written, or PICO_ERROR_GENERIC if address not acknowledged, no device present, or PICO_ERROR_TIMEOUT if a timeout occurred. | |||
*/ | |||
i2c_result_t i2c_write_result_blocking_until(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, absolute_time_t until); |
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.
Does this (and the other new _result_
functions) need to be added to the header file after the old functions, in order not to invalidate the documented doxygen \return
parameter?
@@ -130,7 +130,7 @@ void i2c_set_slave_mode(i2c_inst_t *i2c, bool slave, uint8_t addr) { | |||
i2c->hw->enable = 1; | |||
} | |||
|
|||
static int i2c_write_blocking_internal(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, | |||
static i2c_result_t i2c_write_blocking_internal(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src, size_t len, bool nostop, |
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.
For consistency with function-names and return-types, I wonder if i2c_write_blocking_internal
ought to be renamed to i2c_write_result_blocking_internal
? 🤔 (It's an internal-only function name, so I think we're free to rename it?)
Fixes #1049