Open cjinn opened 4 years ago
Forgot to mention my library/environment versions:
I noticed, when trying out this library for a ESP32 and I2C project, this library does not compile due to the following errors:
libraries\Arduino_LSM6DS3\src\LSM6DS3.cpp: In member function 'void LSM6DS3Class::end()':` `libraries\Arduino_LSM6DS3\src\LSM6DS3.cpp:110:12: error: 'class TwoWire' has no member named 'end'_wire->end()';
This issue is only present when compiling for any ESP32 boards. When I switched the board to a Arduino board, it compiles.
Further investigate reveals, on both Arduino ESP32's Wire.h and the Arduino Standard Library use endTransmission(), not end().
A hotfix inside LSM6DS3.cpp that got my library to compile would be of the following:
void LSM6DS3Class::end() { if (_spi != NULL) { _spi->end(); digitalWrite(_csPin, LOW); pinMode(_csPin, INPUT); } else { writeRegister(LSM6DS3_CTRL2_G, 0x00); writeRegister(LSM6DS3_CTRL1_XL, 0x00); _wire->end(); // This does not compile for esp32. Somehow works for Arduino. Legacy code? // _wire->endTransmission(); } }
I'm wondering if the above code is all that is required to fix this issue.
Thank you for this, I'm using ESP8266 and I was getting this error as well. After changing this I could compile and upload. My settings are: Platformio(v2.5.1) on VS Code, Platform espressif8266, board = nodemcuv2, framework = Arduino.
Regards
I noticed, when trying out this library for a ESP32 and I2C project, this library does not compile due to the following errors:
This issue is only present when compiling for any ESP32 boards. When I switched the board to a Arduino board, it compiles.
Further investigate reveals, on both Arduino ESP32's Wire.h and the Arduino Standard Library use endTransmission(), not end().
A hotfix inside LSM6DS3.cpp that got my library to compile would be of the following:
I'm wondering if the above code is all that is required to fix this issue.