fix ft5206 watch touch controller

This commit is contained in:
gemu2015 2020-08-06 08:53:09 +02:00
parent 5d102f52f7
commit 649053007a
2 changed files with 7 additions and 6 deletions

View File

@ -35,10 +35,12 @@ int FT5206_Class::begin(TwoWire &port, uint8_t addr)
_address = addr; _address = addr;
uint8_t val; uint8_t val;
_readByte(FT5206_VENDID_REG, 1, &val); _readByte(FT5206_VENDID_REG, 1, &val);
//Serial.printf("vend id %d\n",val );
if (val != FT5206_VENDID) { if (val != FT5206_VENDID) {
return false; // return false;
} }
_readByte(FT5206_CHIPID_REG, 1, &val); _readByte(FT5206_CHIPID_REG, 1, &val);
//Serial.printf("chip id %d\n",val );
if ((val != FT6206_CHIPID) && (val != FT6236_CHIPID) && (val != FT6236U_CHIPID) && (val != FT5206U_CHIPID)) { if ((val != FT6206_CHIPID) && (val != FT6236_CHIPID) && (val != FT6236U_CHIPID) && (val != FT5206U_CHIPID)) {
return false; return false;
} }
@ -103,4 +105,4 @@ void FT5206_Class::_readRegister()
_y[i] |= _data[TOUCH1_YL + i * 6]; _y[i] |= _data[TOUCH1_YL + i * 6];
_id[i] = _data[TOUCH1_YH + i * 6] >> 4; _id[i] = _data[TOUCH1_YH + i * 6] >> 4;
} }
} }

View File

@ -53,7 +53,6 @@ Arduino_ST7789 *st7789;
#ifdef USE_TOUCH_BUTTONS #ifdef USE_TOUCH_BUTTONS
extern VButton *buttons[]; extern VButton *buttons[];
#endif #endif
TwoWire I2C2 = TwoWire(1);
FT5206_Class *touchp; FT5206_Class *touchp;
uint8_t FT5206_found; uint8_t FT5206_found;
TP_Point st7789_pLoc; TP_Point st7789_pLoc;
@ -142,11 +141,11 @@ void ST7789_InitDriver()
// start digitizer with fixed adress and pins for esp32 // start digitizer with fixed adress and pins for esp32
#define SDA_2 23 #define SDA_2 23
#define SCL_2 32 #define SCL_2 32
I2C2.begin(SDA_2, SCL_2, 400000); Wire1.begin(SDA_2, SCL_2, 400000);
touchp = new FT5206_Class(); touchp = new FT5206_Class();
if (touchp->begin(I2C2, FT5206_address)) { if (touchp->begin(Wire1, FT5206_address)) {
FT5206_found=1; FT5206_found=1;
I2cSetDevice(FT5206_address); //I2cSetDevice(FT5206_address);
I2cSetActiveFound(FT5206_address, "FT5206"); I2cSetActiveFound(FT5206_address, "FT5206");
} else { } else {
FT5206_found=0; FT5206_found=0;