Skip to content

Commit

Permalink
Merge pull request #6 from ShallowGreen123/master
Browse files Browse the repository at this point in the history
Add CST816D Support
  • Loading branch information
lewisxhe authored Jan 4, 2024
2 parents 4051f81 + 178e682 commit feaf675
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/touch/TouchClassCST816.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define CST816T_CHIP_ID (0xB5)
#define CST716_CHIP_ID (0x20)
#define CST820_CHIP_ID (0xB7)
#define CST816D_CHIP_ID (0xB6)

TouchClassCST816::TouchClassCST816(PLATFORM_WIRE_TYPE &wire, int sda, int scl, uint8_t address):
__center_btn_x(0),
Expand All @@ -61,6 +62,7 @@ bool TouchClassCST816::init()
void TouchClassCST816::reset()
{
if (__rst != SENSOR_PIN_NONE) {
pinMode(__rst, OUTPUT);
digitalWrite(__rst, LOW);
delay(30);
digitalWrite(__rst, HIGH);
Expand Down Expand Up @@ -154,6 +156,8 @@ const char *TouchClassCST816::getModelName()
return "CST716";
case CST820_CHIP_ID:
return "CST820";
case CST816D_CHIP_ID:
return "CST816D";
default:
break;
}
Expand Down Expand Up @@ -212,6 +216,7 @@ void TouchClassCST816::disableAutoSleep()
case CST816S_CHIP_ID:
case CST816T_CHIP_ID:
case CST820_CHIP_ID:
case CST816D_CHIP_ID:
reset();
delay(50);
writeRegister(CST8xx_REG_DIS_AUTOSLEEP, 0x01);
Expand Down Expand Up @@ -242,6 +247,7 @@ bool TouchClassCST816::initImpl()
if (chip_id != CST816S_CHIP_ID &&
chip_id != CST816T_CHIP_ID &&
chip_id != CST820_CHIP_ID &&
chip_id != CST816D_CHIP_ID &&
(chip_id != CST716_CHIP_ID || version == 0)) {
return false;
}
Expand Down

0 comments on commit feaf675

Please sign in to comment.