RobTillaart / INA226

Arduino library for INA226 power sensor
MIT License
54 stars 14 forks source link

refactor API to support ESP32-S3 and others #31

Closed RobTillaart closed 11 months ago

RobTillaart commented 11 months ago
zalexzperez commented 11 months ago

Is this library not compatible with the ESP32-S3?

RobTillaart commented 11 months ago

Is this library not compatible with the ESP32-S3? In fact not tested (no hardware).

In the code there is a special begin() call that sets the SDA and the SCL for Wire. This method does not work for the RP2040 and possibly for the ESP32-S3. So by removing the ability of this library to set the pins (user should do that outside this library) the portability of the library improves.

There were reports about breaking changes between ESP32 (s1) and ESP32-S3 wrt the SPI interface. I had a similar feature in some SPI libraries to set pins that should be set outside those libs. So I decided to remove all the pin settings in my libraries that should be done outside the libraries. And I copied more or less the issue title.

Furthermore I have encountered other problems with a ESP32-S3 boards / compiler that e.g. redefines analogWrite() which causes problems with existing libraries. So my goal of this action is to reduce dependencies of ESP32 code.

FYI, I still have about 70 libraries to check and update coming months (keeps me busy during the long winter evenings).