29#include "../SensorBuildOpt.h"
30#if !SENSORLIB_EXCLUDE_TOUCH_CST816
36 static constexpr uint8_t POINT_BUFFER_SIZE = 13;
37 uint8_t buffer[POINT_BUFFER_SIZE] = {0};
38 uint16_t
x = 0,
y = 0;
46 if (buffer[2] == 0x00 || buffer[2] == 0xFF) {
50 uint8_t numPoints = buffer[2] & 0x0F;
57 x = ((buffer[3] & 0x0F) << 8 | buffer[4]);
58 y = ((buffer[5] & 0x0F) << 8 | buffer[6]);
132bool TouchDrvCST816::initImpl(uint8_t)
150 SENSORLIB_LOG_E(
"Chip ID does not match, should be CST816S:0X%02X , CST816T:0X%02X , CST816D:0X%02X , CST820:0X%02X , CST716:0X%02X",
#define SENSORLIB_LOG_I(...)
#define SENSORLIB_LOG_E(...)
std::unique_ptr< SensorHal > hal
int readReg(uint8_t reg) const
int writeReg(uint8_t reg, uint8_t val)
int readRegBuff(uint8_t reg, uint8_t *buf, size_t len) const
void sleep() override
Puts the touch driver to sleep.
static constexpr uint8_t CST8xx_REG_SLEEP
static constexpr uint8_t MAX_FINGER_NUM
const TouchPoints & getTouchPoints() override
Get the touch points.
void enableAutoSleep()
Enable auto sleep mode.
static constexpr uint8_t CST820_CHIP_ID
static constexpr uint8_t CST8xx_REG_DIS_AUTOSLEEP
static constexpr uint8_t CST816D_CHIP_ID
static constexpr uint8_t CST816S_CHIP_ID
static constexpr uint8_t CST8xx_REG_FW_VERSION
void disableAutoSleep()
Disable auto sleep mode.
static constexpr uint8_t CST8xx_REG_STATUS
static constexpr uint8_t CST8xx_REG_CHIP_ID
static constexpr uint8_t CST716_CHIP_ID
const char * getModelName() override
Get the model name.
static constexpr uint8_t CST816T_CHIP_ID
uint32_t _chipID
Chip identification value.
virtual void reset()
Reset the touch controller.
void * _userData
User data for home button callback.
virtual void updateXY(TouchPoints &points) const
Apply coordinate transformations (swap, scale, mirror) to all touch points.
int16_t _center_btn_y
Y coordinate of home button center.
int16_t _center_btn_x
X coordinate of home button center.
TouchPoints _touchPoints
Touch points data.
uint8_t _maxTouchPoints
Maximum supported touch points.
HomeButtonCallback _HButtonCallback
Home button callback function.
Container for touch point data and optional gesture information.
bool addPoint(uint16_t x, uint16_t y, uint16_t pressure=0, uint8_t id=0, uint8_t event=0)
Adds a touch point to the container.
void clear()
Clears all stored touch points and gesture.