Skip to content

Commit

Permalink
Added home button func
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 9, 2025
1 parent 6579d20 commit 2a25517
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/lv_demos/lv_demos.ino
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,26 @@ static void lv_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data
touch.setMaxCoordinates(320, 170);
touch.setMirrorXY(true, false);
touch.setSwapXY(true);

// Press the circular touch button on the screen to get the coordinate point,
// and set it as the coordinate of the touch button
// T-Display-S3 CST328 touch panel, touch button coordinates are is 85 , 360
touch.setCenterButtonCoordinate(85, 360);

// Depending on the touch panel, not all touch panels have touch buttons.
touch.setHomeButtonCallback([](void *user_data) {
Serial.println("Home key pressed!");
static uint32_t checkMs = 0;
if (millis() > checkMs) {
if (digitalRead(PIN_LCD_BL)) {
digitalWrite(PIN_LCD_BL, LOW);
} else {
digitalWrite(PIN_LCD_BL, HIGH);
}
}
checkMs = millis() + 200;
}, NULL);

#endif

// link
Expand Down

0 comments on commit 2a25517

Please sign in to comment.