Fix next core I2C2 compilation

This commit is contained in:
Theo Arends 2024-10-11 14:11:00 +02:00
parent 154f478b5c
commit b53ac4a14e
6 changed files with 17 additions and 17 deletions

View File

@ -242,7 +242,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
if (wire_n == 1) {
wire = &Wire;
} else {
#ifdef ESP32
#if SOC_HP_I2C_NUM > 1
wire = &Wire1;
#else
wire = &Wire;
@ -636,7 +636,7 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
if (ut_mode == 1) {
ut_wire = &Wire;
} else {
#ifdef ESP32
#if SOC_HP_I2C_NUM > 1
ut_wire = &Wire1;
#else
ut_wire = &Wire;
@ -1076,7 +1076,7 @@ Renderer *uDisplay::Init(void) {
if (wire_n == 0) {
wire = &Wire;
}
#ifdef ESP32
#if SOC_HP_I2C_NUM > 1
if (wire_n == 1) {
wire = &Wire1;
}

View File

@ -24,11 +24,11 @@ typedef struct
class BM8563 {
public:
BM8563();
#ifdef ESP32
void setBus(uint32_t _bus) { myWire = _bus ? &Wire1 : &Wire; };
#else
void setBus(uint32_t _bus) { myWire = &Wire; };
#endif
#if SOC_HP_I2C_NUM > 1
void setBus(uint32_t _bus) { myWire = _bus ? &Wire1 : &Wire; };
#else
void setBus(uint32_t _bus) { myWire = &Wire; };
#endif
void begin(void);
void GetBm8563Time(void);

View File

@ -74,11 +74,11 @@ class MPU_accel {
uint32_t model = 6886; // MPU model number
public:
MPU_accel(void) {};
#ifdef ESP32
#if SOC_HP_I2C_NUM > 1
void setBus(uint32_t _bus) { myWire = _bus ? &Wire1 : &Wire; };
#else
#else
void setBus(uint32_t _bus) { myWire = &Wire; };
#endif
#endif
int Init(void);
uint32_t getModel(void) const { return model; }
void getAccelAdc(int16_t* ax, int16_t* ay, int16_t* az);

View File

@ -13160,7 +13160,7 @@ uint32_t script_i2c(uint8_t sel, uint16_t val, uint32_t val1) {
switch (sel) {
case 0:
glob_script_mem.script_i2c_addr = val;
#ifdef ESP32
#if defined(ESP32) && defined(USE_I2C_BUS2)
if (val1 == 0) glob_script_mem.script_i2c_wire = &Wire;
else glob_script_mem.script_i2c_wire = &Wire1;
#else
@ -13209,7 +13209,7 @@ uint32_t script_i2c(uint8_t sel, uint16_t val, uint32_t val1) {
glob_script_mem.script_i2c_wire->endTransmission();
break;
case 14:
#ifdef ESP32
#if defined(ESP32) && defined(USE_I2C_BUS2)
Wire1.end();
Wire1.begin(val & 0x7f, val1);
glob_script_mem.script_i2c_wire = &Wire1;
@ -13217,7 +13217,7 @@ uint32_t script_i2c(uint8_t sel, uint16_t val, uint32_t val1) {
if (val & 128) {
XsnsCall(FUNC_INIT);
}
#endif
#endif
break;
}
return rval;

View File

@ -397,7 +397,7 @@ Renderer *Init_uDisplay(const char *desc) {
if (!wire_n) {
GT911_Touch_Init(&Wire, irq, rst, xs, ys);
}
#ifdef ESP32
#if defined(ESP32) && defined(USE_I2C_BUS2)
else {
GT911_Touch_Init(&Wire1, irq, rst, xs, ys);
}
@ -414,7 +414,7 @@ Renderer *Init_uDisplay(const char *desc) {
if (!wire_n) {
FT5206_Touch_Init(Wire);
}
#ifdef ESP32
#if defined(ESP32) && defined(USE_I2C_BUS2)
else {
FT5206_Touch_Init(Wire1);
}

View File

@ -75,7 +75,7 @@ void sen5x_Init(void) {
sen5x = new SensirionI2CSen5x();
if (1 == usingI2cBus) {
#ifdef ESP32
#if defined(ESP32) && defined(USE_I2C_BUS2)
sen5x->begin(Wire1);
#else
sen5x->begin(Wire);