-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fix I2CBus::write() bug and add i2c documentation #5947
Conversation
I fixed the length of the buffer incorrectly specified as an uin8_t to of a size_t. Added a lot of documentation to the i2c library Added alias NO_ERROR to ERROR_OK On branch drcoolzic_fix_i2c Changes to be committed: modified: esphome/components/i2c/i2c.h modified: esphome/components/i2c/i2c_bus.h
Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration ( |
lint does not like slave and bit(s) in comments ?
methods are prohibited
Is there a way to fix the bug in Wire.h of the Arduino library? |
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 @DrCoolzic
The Wire.h code is part of the Arduino Framework and would need to be changed there (If it is not already in a newer Arduino version). |
I fixed a bug where the buffer length was incorrectly specified as a uin8_t instead of a size_t.
I have also added a lot of documentation to the i2c library, as well as aliased ERROR_OK to NO_ERROR
File affected:
What does this implement/fix?
The only code changes are:
As been replaced by
Plus the addition of the alias NO_ERROR in i2c_bus.h.
As far as the documentation is concerned, I've added information on classes, methods and attributes to help users of the I2C library. Please note that my native language is not English, so it's likely that the text contains errors. Please feel free to correct them.
Note also that I have used a syntax that allow detailed documentation in Doxygen output when looking the API, but that is hidden (only the details are hidden) when hovering in intellisense.
What does this PR do not fix?
Unfortunately, this PR does not fix the problem of not being able to read messages with 256 or bytes when using the Arduino framework is used. Fixing this problem requires to modify the Wire.h file in the Arduino framework and I do not know how to do that (or even if it is possible). However, as a courtesy I provide the code to do so in case you know how to modify Arduino framework.
In Wire.h the following code:
Needs to be replaced by
PR Summary
When integrated this fix will allow to use buffers of 256 or more bytes in i2c library when using the ESP-IDF framework.
Unfortunately for the Arduino framework the buffer size will still be limited to 255 until the framework is also fixed.
Types of changes
Test Environment
Example entry for
config.yaml
:more info in this document
Bus i2c problems and solutions en-us.pdf
Checklist:
tests/
folder).