You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
Since version v5.2 there's a new API for I2C devices, and the old one is deprecated. There's only an example in the repo, but it's IMHO overly complicated and not very applicable to a lot of people.
It is a simple device where it's configured, and it's shown how to read from a register and write to a register. Very few lines of code, and enough to get a gist of the API.
github-actionsbot
changed the title
Please provide a simple a working and simple example of the new I2C API
Please provide a simple a working and simple example of the new I2C API (IDFGH-14090)
Nov 17, 2024
@suda-morris Hi there! I noticed that my pull request hasn't received any feedback since August. As this is my first time submitting a pull request to the esp-idf repo, I wanted to check if there's anything I need to address or improve. Any guidance would be greatly appreciated. Thank you!
Answers checklist.
General issue report
Since version v5.2 there's a new API for I2C devices, and the old one is deprecated. There's only an example in the repo, but it's IMHO overly complicated and not very applicable to a lot of people.
See the old example:
https://github.com/espressif/esp-idf/tree/release/v5.1/examples/peripherals/i2c/i2c_simple
It is a simple device where it's configured, and it's shown how to read from a register and write to a register. Very few lines of code, and enough to get a gist of the API.
And now compare this to the new example, for reading and writing from an EEPROM:
https://github.com/espressif/esp-idf/tree/master/examples/peripherals/i2c/i2c_eeprom
it's a mess with a ton of type definitions, apparently for no reason:
esp-idf/examples/peripherals/i2c/i2c_eeprom/components/i2c_eeprom/i2c_eeprom.h
Line 27 in 7a305c0
memory allocations where in the old one none was needed:
esp-idf/examples/peripherals/i2c/i2c_eeprom/components/i2c_eeprom/i2c_eeprom.c
Lines 28 to 40 in 7a305c0
managing a buffer manually:
esp-idf/examples/peripherals/i2c/i2c_eeprom/main/i2c_eeprom_main.c
Lines 56 to 60 in 7a305c0
etc. It just looks overly verbose and complicated.
So please provide a simple example for the new I2C API where it's shown how to:
The text was updated successfully, but these errors were encountered: