CST816S
CST816S copied to clipboard
Compilation errors with ESP32-C3 and ESP8266
I think it has some issues. Tried to compile with Arduino-IDE 2.2,1
Here is the compilation errors when I try to compile for ESP32C3. Also there are some compilation errors with ESP8266..
/home/death/Arduino/libraries/CST816S/CST816S.cpp: In member function 'uint8_t CST816S::i2c_read(uint16_t, uint8_t, uint8_t*, uint32_t)':
/home/death/Arduino/libraries/CST816S/CST816S.cpp:173:38: error: call of overloaded 'requestFrom(uint16_t&, uint32_t&, bool)' is ambiguous
Wire.requestFrom(addr, length, true);
^
In file included from /home/death/Arduino/libraries/CST816S/CST816S.cpp:26:
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:119:12: note: candidate: 'size_t TwoWire::requestFrom(uint16_t, size_t, bool)'
size_t requestFrom(uint16_t address, size_t size, bool sendStop);
^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:120:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool)'
uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop);
^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:121:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, uint8_t)'
uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop);
^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:122:12: note: candidate: 'size_t TwoWire::requestFrom(uint8_t, size_t, bool)'
size_t requestFrom(uint8_t address, size_t len, bool stopBit);
^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:124:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)'
uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop);
^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:126:13: note: candidate: 'uint8_t TwoWire::requestFrom(int, int, int)'
uint8_t requestFrom(int address, int size, int sendStop);
^~~~~~~~~~~
exit status 1
Compilation error: exit status 1
For fixing it, you should use size_t at wire definitions...
uint8_t i2c_read(uint16_t addr, uint8_t reg_addr, uint8_t * reg_data, size_t length);
uint8_t i2c_write(uint8_t addr, uint8_t reg_addr, const uint8_t * reg_data, size_t length);