1

我正在开发一个使用 Wire.h 库的ESP32应用程序。但是,我收到一个i2c_t不是类型名称的错误。下面是源代码和错误代码输出。我怎么解决这个问题?

#include <Wire.h>
#include <Temperature_LM75_Derived.h>

TI_TMP100 myTmp100;
    
void initTmp100()
{  
    Wire.begine(); // errors in this part
    myTmp100.setResolution(myTmp100.Resolution_12_bits); // errors in this part as well
}

相同的项目适用于具有相同电路板的 platformio(DOIT ESP32 DEVKIT V1)。

以下是错误代码输出的一部分:

Wire.cpp:32: In file included from
     
Wire.h: 44:5: error: 'i2c_t' does not name a type; did you mean 'ino_t'?
       i2c_t * i2c
       ^~~~~
       ino_t
     
Wire.h: 64:5: error: 'i2c_err_t' does not name a type; did you mean 'esp_err_t'?
       i2c_err_t last_error; \\ @stickBreaker from esp32-hal-i2c.h
       ^~~~~~~~~
       esp_err_t
     
Wire.h: 87:5: error: 'i2c_err_t' does not name a type; did you mean 'esp_err_t'?
       i2c_err_t writeTransmission(uint16_t address, uint8_t* buff, uint16_t size, bool sendStop=true)
       ^~~~~~~~~
       esp_err_t 
4

0 回答 0