Skip to content

Commit

Permalink
Fix FT63X6 Reset Pin no set
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 29, 2024
1 parent 5cd8b9e commit f8ba819
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions src/TouchDrvFT6X36.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class TouchDrvFT6X36 :

const char *getModelName()
{
switch (chipID) {
switch (__chipID) {
case FT6206_CHIPID: return "FT6206";
case FT6236_CHIPID: return "FT6236";
case FT6236U_CHIPID: return "FT6236U";
Expand All @@ -345,7 +345,7 @@ class TouchDrvFT6X36 :
void reset()
{
if (__rst != SENSOR_PIN_NONE) {

this->setGpioMode(__rst, OUTPUT);
this->setGpioLevel(__rst, HIGH);
delay(10);
this->setGpioLevel(__rst, LOW);
Expand All @@ -368,32 +368,41 @@ class TouchDrvFT6X36 :
private:
bool initImpl()
{
uint8_t vendId = readRegister(FT6X36_REG_VENDOR1_ID);
chipID = readRegister(FT6X36_REG_CHIPID);
if (__irq != SENSOR_PIN_NONE) {
this->setGpioMode(__irq, INPUT);
}

log_i("Vend ID: 0x%X", vendId);
log_i("Chip ID: 0x%X", chipID);
log_i("Firm Version: 0x%X", readRegister(FT6X36_REG_FIRMVERS));
log_i("Point Rate Hz: %u", readRegister(FT6X36_REG_PERIODACTIVE));
log_i("Thresh : %u", readRegister(FT6X36_REG_THRESHHOLD));
reset();

uint8_t vendId = readRegister(FT6X36_REG_VENDOR1_ID);

// change threshhold to be higher/lower
writeRegister(FT6X36_REG_THRESHHOLD, 60);

if (vendId != FT6X36_VENDID) {
log_e("Vendor id is not match!");
log_e("Vendor id is 0x%X not match!\n", vendId);
return false;
}
if ((chipID != FT6206_CHIPID) &&
(chipID != FT6236_CHIPID) &&
(chipID != FT6236U_CHIPID) &&
(chipID != FT3267_CHIPID)

__chipID = readRegister(FT6X36_REG_CHIPID);

if ((__chipID != FT6206_CHIPID) &&
(__chipID != FT6236_CHIPID) &&
(__chipID != FT6236U_CHIPID) &&
(__chipID != FT3267_CHIPID)
) {
log_e("Vendor id is not match!");
log_e("ChipID:0x%x should be 0x06 or 0x36 or 0x64\n", chipID);
log_e("Vendor id is not match!\n");
log_e("ChipID:0x%lx should be 0x06 or 0x36 or 0x64\n", __chipID);
return false;
}

log_i("Vend ID: 0x%X\n", vendId);
log_i("Chip ID: 0x%lx\n", __chipID);
log_i("Firm Version: 0x%X\n", readRegister(FT6X36_REG_FIRMVERS));
log_i("Point Rate Hz: %u\n", readRegister(FT6X36_REG_PERIODACTIVE));
log_i("Thresh : %u\n", readRegister(FT6X36_REG_THRESHHOLD));

// change threshhold to be higher/lower
writeRegister(FT6X36_REG_THRESHHOLD, 60);

log_i("Chip library version : 0x%x\n", getLibraryVersion());

// This register describes period of monitor status, it should not less than 30.
Expand All @@ -410,8 +419,6 @@ class TouchDrvFT6X36 :
return -1;
}

protected:
uint8_t chipID;
};


Expand Down

0 comments on commit f8ba819

Please sign in to comment.