{"id":23392999,"url":"https://github.com/mrmoses1911/tdisplays3_touch","last_synced_at":"2025-04-11T11:42:08.205Z","repository":{"id":198818144,"uuid":"629144680","full_name":"MrMoses1911/TDisplayS3_Touch","owner":"MrMoses1911","description":"Touchscreen control library for the T-Display S3 Touch","archived":false,"fork":false,"pushed_at":"2024-12-19T00:47:52.000Z","size":12,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T08:02:44.265Z","etag":null,"topics":["esp32","esp32-arduino","lilygo","lilygo-tdisplay-s3","touch"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrMoses1911.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-17T18:01:46.000Z","updated_at":"2025-01-21T08:54:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"b98d2e3d-59f0-44be-885b-b24c8f241688","html_url":"https://github.com/MrMoses1911/TDisplayS3_Touch","commit_stats":null,"previous_names":["mrmoses1911/tdisplays3_touch"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FTDisplayS3_Touch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FTDisplayS3_Touch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FTDisplayS3_Touch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FTDisplayS3_Touch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrMoses1911","download_url":"https://codeload.github.com/MrMoses1911/TDisplayS3_Touch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248385541,"owners_count":21094903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","esp32-arduino","lilygo","lilygo-tdisplay-s3","touch"],"created_at":"2024-12-22T05:16:57.863Z","updated_at":"2025-04-11T11:42:08.184Z","avatar_url":"https://github.com/MrMoses1911.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TDisplayS3_Touch\n\nThis library provides a reliable and straightforward solution for utilizing the touch features of LilyGo's \"T-Display S3 Touch\" model. It was developed as an alternative to the official \"TouchLib\" library, which is known to have significant issues and an overly complex implementation.\n\n## Features\n- Simplified integration for touch capabilities of the T-Display S3 Touch.\n- Support for gestures such as swipe, single click, double click, and long press.\n- Access to touch coordinates, gesture types, and radial button states.\n\n## Examples\n\n### DisplayTouch Example\nThis example demonstrates how to use the \"T-Display S3 Touch\" screen for graphical touch input. Open the serial monitor to observe the output.\n\n```cpp\n#include \u003cTFT_eSPI.h\u003e\n#include \u003cTDS3_CST816.h\u003e\n\nTFT_eSPI tft = TFT_eSPI();\nTDS3_CST816 touch(18, 17, 21, 16);  // SDA, SCL, RST, IRQ pins of T-Display S3 Touch.\n\nString full_y, x_tft, gesture;\nbool radial_bt;\n\nvoid setup() {\n  touch.begin();  // Initiate I2C communication with CST816 touch display IC.\n\n  tft.begin();\n  tft.setRotation(0);\n  tft.fillScreen(TFT_BLACK);\n}\n\nvoid loop() {\n  if (touch.available()) {\n      x_tft = String(touch.data.x);\n      full_y = String(touch.data.full_y);\n      radial_bt = touch.data.radial_button;\n      gesture = touch.gesture();\n  }\n\n  tft.drawString(\"X:  \" + x_tft + \"         \", 0, 0, 4);\n  tft.drawString(\"Y:  \" + full_y + \"        \", 0, 28, 4);\n  tft.drawString(gesture + \"                       \", 0, 120, 4);\n\n  if (radial_bt == true) {\n    tft.drawString(\"  Radial Button                 \", 0, 200, 4);\n    tft.drawString(\"       Pressed!                 \", 0, 226, 4);\n  } else {\n    tft.drawString(\"                                \", 0, 200, 4);\n    tft.drawString(\"                                \", 0, 226, 4);\n  }\n}\n```\n\n### SerialTouch Example\nThis example demonstrates how to use the \"T-Display S3 Touch\" screen for serial output of touch data. Open the serial monitor to see the touch data in action.\n\n```cpp\n#include \u003cTDS3_CST816.h\u003e\n\nTDS3_CST816 touch(18, 17, 21, 16);  // SDA, SCL, RST, IRQ pins of T-Display S3 Touch.\n\nvoid setup() {\n  Serial.begin(115200);  // Initiate serial communication with ESP32-S3.\n  touch.begin();         // Initiate I2C communication with CST816 touch display IC.\n}\n\nvoid loop() {\n  if (touch.available()) {  // Check for touch input and retrieve parameters in the \"data\" structure.\n    Serial.print(\"Gesture: \");\n    Serial.print(touch.gesture());  // Gesture ID: NONE, SWIPE DOWN, SWIPE UP, etc.\n    Serial.print(\"\\t\");\n    Serial.print(\"X: \");\n    Serial.print(touch.data.x);  // X coordinate (0 to 170).\n    Serial.print(\"\\t\");\n    Serial.print(\"Y: \");\n    Serial.print(touch.data.y);  // Y coordinate (0 to 255).\n    Serial.print(\"\\t\");\n    Serial.print(\"Sector: \");\n    Serial.print(touch.data.sector);  // Screen division into sectors.\n    Serial.print(\"\\t\");\n    Serial.print(\"Full Y: \");\n    Serial.print(touch.data.full_y);  // Full Y coordinate (0 to 359).\n    Serial.print(\"\\t\");\n    Serial.print(\"Radial button: \");\n    Serial.println(touch.data.radial_button);  // Radial button state.\n  }\n}\n```\n\n## API Overview\n### Class `TDS3_CST816`\n#### Constructor\n```cpp\nTDS3_CST816(int sda, int scl, int rst, int irq);\n```\n- `sda`: I2C data pin.\n- `scl`: I2C clock pin.\n- `rst`: Reset pin for the touch IC.\n- `irq`: Interrupt pin for the touch IC.\n\n#### Methods\n- **`void begin(int interrupt = RISING)`**: Initializes the touch screen with the specified interrupt type.\n- **`void sleep()`**: Puts the touch screen into standby mode.\n- **`bool available()`**: Checks if a touch event is available.\n- **`String gesture()`**: Retrieves the name of the current gesture.\n\n#### Data Structure\n```cpp\nstruct data_struct {\n  byte gestureID;         // Gesture ID.\n  byte points;            // Number of touch points.\n  byte event;             // Event type (0 = Down, 1 = Up, 2 = Contact).\n  uint16_t x;             // X coordinate (0 to 170).\n  uint16_t y;             // Y coordinate (0 to 255).\n  uint16_t full_y;        // Full Y coordinate (0 to 359).\n  uint16_t sector;        // Screen sector.\n  bool radial_button;     // Radial button state.\n  uint8_t version;        // Version of the touch IC.\n  uint8_t versionInfo[3]; // Additional version information.\n};\n```\n\n## License\nThis library is released under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmoses1911%2Ftdisplays3_touch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmoses1911%2Ftdisplays3_touch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmoses1911%2Ftdisplays3_touch/lists"}