UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.43k stars 441 forks source link

Difference between Definitions of i2c_dev_t in esp-idf-lib and esp-idf #332

Closed lpitt10 closed 2 years ago

lpitt10 commented 2 years ago

The issue

Definition of i2c_dev_t in "esp-idf-lib/components/i2cdev/i2cdev.h": ...

include <driver/i2c.h>

... typedef struct { i2c_port_t port; //!< I2C port number i2c_config_t cfg; //!< I2C driver configuration uint8_t addr; //!< Unshifted address SemaphoreHandle_t mutex; //!< Device mutex uint32_t timeout_ticks; /!< HW I2C bus timeout (stretch time), in ticks. 80MHz APB clock ticks for ESP-IDF, CPU ticks for ESP8266. When this value is 0, I2CDEV_MAX_STRETCH_TIME will be used / } i2c_dev_t;

But Definition of i2c_dev_t in "esp-idf/components/soc/esp32/include/soc/i2c_struct.h": ... typedef volatile struct i2c_dev_s { union { struct { uint32_t period:14; /This register is used to configure the low level width of SCL clock./ uint32_t reserved14: 18; }; uint32_t val; } scl_low_period; ... uint32_t reserved_fc; uint32_t ram_data[32]; /This the start address for ram when use apb nonfifo access./ } i2c_dev_t;

There are two different Definitions of i2c_dev_t in "esp-idf-lib/components/i2cdev/i2cdev.c". Is this a bug?

Which SDK are you using?

esp-idf

Which version of SDK are you using?

master

Which build target have you used?

Component causing the issue

i2cdev

Anything in the logs that might be useful for us?

No response

Additional information or context

No response

Confirmation

UncleRus commented 2 years ago

First, you have already created one issue on this topic (#330) and there is no need to create another one.

No, this is not a bug. At build time, the hal component, which has its own definition of i2c_dev_t, knows nothing about my component i2cdev. And vice versa. There will be no conflict unless you include both of these components in the same source file and I can't imagine a situation in which this would have to be done. Have you tried building any example from this repository yet? If not, try it and see for yourself.