Skip to content

Commit

Permalink
Fixed CSTXXX Sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Oct 10, 2023
1 parent f4a4221 commit 76075a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/touch/TouchClassCST226.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ uint8_t TouchClassCST226::getPoint(int16_t *x_array, int16_t *y_array, uint8_t g
updateXY(point, report.x, report.y);

#ifdef LOG_PORT
for (int i = 0; i < 5; i++) {
for (int i = 0; i < point; i++) {
LOG_PORT.printf("[%d]-X:%u Y:%u P:%u sta:%u ", report.id[i], report.x[i], report.y[i], report.pressure[i], report.status[i]);
}
LOG_PORT.println();
Expand Down Expand Up @@ -140,7 +140,7 @@ const char *TouchClassCST226::getModelName()

void TouchClassCST226::sleep()
{
writeRegister(0xE5, 0x03);
writeRegister(0xD1, 0x05);
#ifdef ESP32
if (__irq != SENSOR_PIN_NONE) {
pinMode(__irq, OPEN_DRAIN);
Expand Down
5 changes: 4 additions & 1 deletion src/touch/TouchClassCST816.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,18 @@ bool TouchClassCST816::initImpl()
{
setRegAddressLenght(1);

reset();

int chip_id = readRegister(CST8xx_REG_CHIP_ID);
log_i("Chip ID:0x%x", chip_id);

int version = readRegister(CST8xx_REG_FW_VERSION);
log_i("Version :0x%x", version);

//CST226SE : A7 = 0X20
if (chip_id != CST816S_CHIP_ID &&
chip_id != CST816T_CHIP_ID &&
chip_id != CST716_CHIP_ID) {
(chip_id != CST716_CHIP_ID || version == 0)) {
return false;
}
__chipID = chip_id;
Expand Down

0 comments on commit 76075a4

Please sign in to comment.