Please provide a simple a working and simple example of the new I2C API (IDFGH-14090) #14902
Open
3 tasks done
Labels
Status: Opened
Issue is new
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: