{"id":18625712,"url":"https://github.com/fbiego/cst816s","last_synced_at":"2025-04-09T10:09:47.707Z","repository":{"id":43598095,"uuid":"394892686","full_name":"fbiego/CST816S","owner":"fbiego","description":"An Arduino library for the Hynitron CST816S capacitive touch screen IC","archived":false,"fork":false,"pushed_at":"2024-10-27T19:04:03.000Z","size":46,"stargazers_count":59,"open_issues_count":8,"forks_count":23,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T02:39:49.779Z","etag":null,"topics":["arduino-library","cst816s","hynitron","library","touch","touchscreen"],"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/fbiego.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":"2021-08-11T06:56:06.000Z","updated_at":"2025-02-19T17:38:03.000Z","dependencies_parsed_at":"2024-10-27T20:41:08.029Z","dependency_job_id":"c9040f81-adf8-4774-bfbc-15f490c1da4a","html_url":"https://github.com/fbiego/CST816S","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbiego%2FCST816S","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbiego%2FCST816S/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbiego%2FCST816S/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fbiego%2FCST816S/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fbiego","download_url":"https://codeload.github.com/fbiego/CST816S/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018061,"owners_count":21034048,"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":["arduino-library","cst816s","hynitron","library","touch","touchscreen"],"created_at":"2024-11-07T04:35:46.727Z","updated_at":"2025-04-09T10:09:47.671Z","avatar_url":"https://github.com/fbiego.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CST816S\n An Arduino library for the CST816S capacitive touch screen IC\n \n [![arduino-library-badge](https://www.ardu-badge.com/badge/CST816S.svg?)](https://www.arduinolibraries.info/libraries/cst816-s)\n\n## Auto Sleep Control\n\nAuto Sleep is referred to as Standby Mode in this [Waveshare document](https://www.waveshare.com/w/upload/5/51/CST816S_Datasheet_EN.pdf). Disabling of auto sleep or auto standby will keep the touch display in Dynamic mode. This will improve responsiveness, at the cost of about ~1.6mA.\n\nBy default, auto sleep is **enabled** with a timeout of 2 seconds. The following functions allow you to manage auto sleep behavior:\n\n- **`void disable_auto_sleep();`**  \n  Disables auto sleep, keeping the device active indefinitely.\n\n- **`void enable_auto_sleep();`**  \n  Re-enables auto sleep with the current timeout (default is 2 seconds).\n\n- **`void set_auto_sleep_time(int seconds);`**  \n  Sets the auto sleep timeout in seconds (1-255).  \n  Example: `set_auto_sleep_time(10);` sets a 10-second timeout.\n\n## User-Provided Interrupt\n\nThe CST816S library allows you to attach a custom interrupt function to handle touch events according to your application's needs. By providing a user-defined interrupt, you can trigger specific actions upon touch events, such as waking the device from a low-power state, checking gestures, or executing custom logic without constantly polling the device.\n\n**Feature Highlights:**\n- **Custom Event Handling**: Define and attach a user function that executes on each touch interrupt, allowing immediate responses to touch events.\n- **Power Management**: Ideal for applications needing to manage power, such as waking from sleep modes, as the interrupt triggers only on touch.\n- **Gesture-Based Logic**: Use the interrupt to wake, then analyze gestures to decide on further actions, enabling efficient and gesture-responsive behavior.\n\n\n\n ## Register Information\n\n The following information was extracted from [this document](https://www.waveshare.com/w/upload/c/c2/CST816S_register_declaration.pdf) provided by Waveshare.\n\n | Register Name     | Address | Bit Description                                       | Default Value | Configuration Options                                          |\n|-------------------|---------|-------------------------------------------------------|---------------|----------------------------------------------------------------|\n| GestureID         | 0x01    | Gesture code for detected gestures                    | N/A           | - 0x00: None  \u003cbr\u003e - 0x01: Slide Up  \u003cbr\u003e - 0x02: Slide Down  \u003cbr\u003e - 0x03: Slide Left  \u003cbr\u003e - 0x04: Slide Right  \u003cbr\u003e - 0x05: Single Click  \u003cbr\u003e - 0x0B: Double Click  \u003cbr\u003e - 0x0C: Long Press |\n| FingerNum         | 0x02    | Number of fingers detected                            | N/A           | - 0: No finger \u003cbr\u003e - 1: One finger                            |\n| XposH             | 0x03    | High 4 bits of X coordinate                           | N/A           | -                                                              |\n| XposL             | 0x04    | Low 8 bits of X coordinate                            | N/A           | -                                                              |\n| YposH             | 0x05    | High 4 bits of Y coordinate                           | N/A           | -                                                              |\n| YposL             | 0x06    | Low 8 bits of Y coordinate                            | N/A           | -                                                              |\n| BPC0H             | 0xB0    | High 8 bits of BPC0 value                             | N/A           | -                                                              |\n| BPC0L             | 0xB1    | Low 8 bits of BPC0 value                              | N/A           | -                                                              |\n| BPC1H             | 0xB2    | High 8 bits of BPC1 value                             | N/A           | -                                                              |\n| BPC1L             | 0xB3    | Low 8 bits of BPC1 value                              | N/A           | -                                                              |\n| ChipID            | 0xA7    | Chip model identifier                                 | N/A           | -                                                              |\n| ProjID            | 0xA8    | Project number                                        | N/A           | -                                                              |\n| FwVersion         | 0xA9    | Firmware version number                               | N/A           | -                                                              |\n| MotionMask        | 0xEC    | Enable continuous gesture actions and double-click    | 0x00          | - Bit 0: EnDClick (enable double-click) \u003cbr\u003e - Bit 1: EnConUD (enable continuous up/down swipe) \u003cbr\u003e - Bit 2: EnConLR (enable continuous left/right swipe) |\n| IrqPluseWidth     | 0xED    | Interrupt pulse width (0.1 ms units)                  | 10            | 1-200                                                          |\n| NorScanPer        | 0xEE    | Normal scan period (10 ms units)                      | 1             | 1-30                                                           |\n| MotionSlAngle     | 0xEF    | Gesture detection sliding angle control (Angle = tan(c) * 10, where c is the angle relative to the positive X-axis) | N/A           | - |\n| LpScanRaw1H       | 0xF0    | High 8 bits of low-power scan channel 1 reference      | N/A           | -                                                              |\n| LpScanRaw1L       | 0xF1    | Low 8 bits of low-power scan channel 1 reference       | N/A           | -                                                              |\n| LpScanRaw2H       | 0xF2    | High 8 bits of low-power scan channel 2 reference      | N/A           | -                                                              |\n| LpScanRaw2L       | 0xF3    | Low 8 bits of low-power scan channel 2 reference       | N/A           | -                                                              |\n| LpAutoWakeTime    | 0xF4    | Low-power mode auto recalibration interval (in minutes) | 5 minutes     | 1-5 minutes                                                    |\n| LpScanTH          | 0xF5    | Low-power scan wake threshold. The smaller the value, the more sensitive it is. | 48            | 1-255                                                          |\n| LpScanWin         | 0xF6    | Low-power scan range. The larger the value, the more sensitive it is, but power consumption increases. | 3             | 0-3                                                            |\n| LpScanFreq        | 0xF7    | Low-power scan frequency. The smaller the value, the more sensitive it is. | 7             | 1-255                                                          |\n| LpScanIdac        | 0xF8    | Low-power scan current. The smaller the value, the more sensitive it is. | N/A           | 1-255                                                          |\n| AutoSleepTime     | 0xF9    | Time in seconds before entering standby mode after inactivity | 2 seconds     | 1-255 seconds                                                  |\n| IrqCtl            | 0xFA    | Control of interrupt behavior                         | N/A           | - Bit 7: EnTest (Enable test, periodically sends low pulses) \u003cbr\u003e - Bit 6: EnTouch (Sends low pulse on touch detection) \u003cbr\u003e - Bit 5: EnChange (Sends low pulse on touch state change) \u003cbr\u003e - Bit 4: EnMotion (Sends low pulse on gesture detection) \u003cbr\u003e - Bit 0: OnceWLP (Sends one low pulse on long press) |\n| AutoReset         | 0xFB    | Auto-reset time after detecting touch with no valid gesture | 5 seconds     | - 0: Disable \u003cbr\u003e - 1-5: Time in seconds before auto-reset      |\n| LongPressTime     | 0xFC    | Time (in seconds) for a long press to trigger reset    | 10 seconds    | - 0: Disable \u003cbr\u003e - 1-10: Long press duration in seconds         |\n| IOCtl             | 0xFD    | IO control settings including soft reset and power options | N/A           | - Bit 2: SOFT_RST (0: Disable soft reset, 1: Enable soft reset) \u003cbr\u003e - Bit 1: IIC_OD (0: Pull-up resistor, 1: Open-drain) \u003cbr\u003e - Bit 0: En1v8 (0: VDD, 1: 1.8V) |\n| DisAutoSleep      | 0xFE    | Disable automatic entry into low-power mode            | 0 (enabled)   | - 0: Enable auto sleep \u003cbr\u003e - Non-zero: Disable auto sleep       |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbiego%2Fcst816s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffbiego%2Fcst816s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffbiego%2Fcst816s/lists"}