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

View File

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

View File

@ -74,11 +74,11 @@ class MPU_accel {
uint32_t model = 6886; // MPU model number uint32_t model = 6886; // MPU model number
public: public:
MPU_accel(void) {}; MPU_accel(void) {};
#ifdef ESP32 #if SOC_HP_I2C_NUM > 1
void setBus(uint32_t _bus) { myWire = _bus ? &Wire1 : &Wire; }; void setBus(uint32_t _bus) { myWire = _bus ? &Wire1 : &Wire; };
#else #else
void setBus(uint32_t _bus) { myWire = &Wire; }; void setBus(uint32_t _bus) { myWire = &Wire; };
#endif #endif
int Init(void); int Init(void);
uint32_t getModel(void) const { return model; } uint32_t getModel(void) const { return model; }
void getAccelAdc(int16_t* ax, int16_t* ay, int16_t* az); 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) { switch (sel) {
case 0: case 0:
glob_script_mem.script_i2c_addr = val; 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; if (val1 == 0) glob_script_mem.script_i2c_wire = &Wire;
else glob_script_mem.script_i2c_wire = &Wire1; else glob_script_mem.script_i2c_wire = &Wire1;
#else #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(); glob_script_mem.script_i2c_wire->endTransmission();
break; break;
case 14: case 14:
#ifdef ESP32 #if defined(ESP32) && defined(USE_I2C_BUS2)
Wire1.end(); Wire1.end();
Wire1.begin(val & 0x7f, val1); Wire1.begin(val & 0x7f, val1);
glob_script_mem.script_i2c_wire = &Wire1; 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) { if (val & 128) {
XsnsCall(FUNC_INIT); XsnsCall(FUNC_INIT);
} }
#endif #endif
break; break;
} }
return rval; return rval;

View File

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

View File

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