30#include "../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_TOUCH_CSTXXX
35TouchDrvCSTXXX::DriverCreator TouchDrvCSTXXX::driverCreators[TouchDrvCSTXXX::driverCreatorMaxNum] = {
36 []() -> std::unique_ptr<TouchDrvInterface> {
return std::make_unique<TouchDrvCST226>(); },
37 []() -> std::unique_ptr<TouchDrvInterface> {
return std::make_unique<TouchDrvCST816>(); },
38 []() -> std::unique_ptr<TouchDrvInterface> {
return std::make_unique<TouchDrvCST92xx>(); },
39 []() -> std::unique_ptr<TouchDrvInterface> {
return std::make_unique<TouchDrvCST3530>(); }
50void TouchDrvCSTXXX::setupDriver()
61 return beginImpl(wire, addr, sda, scl);
63#elif defined(ESP_PLATFORM)
64#if defined(SENSORLIB_USE_I2C_LEGACY)
67 return beginImpl(port_num, addr, sda, scl);
72 return beginImpl(handle, addr);
99 if (!_drv)
return false;
100 return _drv->isPressed(filter_ms);
105 return _drv ? _drv->getModelName() :
"NULL";
110 return _drv ? _drv->getChipID() : 0;
127 return _drv ? _drv->getSupportTouchPoint() : 0;
133 _drv->getResolution(
x,
y);
139 return _drv ? _drv->getResolutionY() : 0;
144 return _drv ? _drv->getResolutionX() : 0;
185 _drv->setSwapXY(swap);
191 _drv->setMirrorXY(mirrorX, mirrorY);
197 _drv->setMaxCoordinates(
x,
y);
uint32_t(*)(Operation op, void *param1, void *param2) CustomHalCallback
bool(*)(uint8_t addr, uint8_t reg, uint8_t *buf, size_t len, bool writeReg, bool isWrite) CustomCallback
void sleep() override
Puts the touch driver to sleep.
TouchDrvCSTXXX()
Constructor for the touch driver.
uint16_t getResolutionY() override
Gets the touch point resolution.
void setSwapXY(bool swap) override
Set the swap XY flag.
uint8_t getSupportTouchPoint() override
Gets the number of supported touch points.
void reset() override
Reset the touch driver.
void setHomeButtonCallback(TouchDrvInterface::HomeButtonCallback callback, void *user_data=NULL) override
Set the home button callback.
bool begin(SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr) override
Initialize the touch driver for custom communication.
const char * getModelName() override
Get the model name.
bool isPressed(uint32_t filter_ms=0) override
Check if any touch point is currently pressed.
const TouchPoints & getTouchPoints() override
Get the touch points.
void wakeup() override
Wake up the touch driver.
void disableAutoSleep()
Disable automatic sleep.
uint32_t getChipID() override
Get the chip ID.
void getResolution(uint16_t &x, uint16_t &y) override
Gets the touch point coordinates.
void enableAutoSleep()
Enable automatic sleep.
void setCenterButtonCoordinate(int16_t x, int16_t y) override
Set the center button coordinate.
uint16_t getResolutionX() override
Gets the touch point resolution.
void setMaxCoordinates(uint16_t x, uint16_t y) override
Set the maximum coordinates.
void setTouchDrvModel(TouchDrvType model)
Set the touch driver model.
void setMirrorXY(bool mirrorX, bool mirrorY) override
Set the mirror XY flag.
void(*)(void *user_data) HomeButtonCallback
Callback type for home button events.
SensorHalCustom::CustomMode _halModeCallback
Custom GPIO mode callback.
TouchPinsCfg _pinsCfg
Configuration for reset and interrupt pins.
SensorHalCustom::CustomWrite _halWriteCallback
Custom GPIO write callback.
TouchPoints _touchPoints
Touch points data.
SensorHalCustom::CustomRead _halReadCallback
Custom GPIO read callback.
Container for touch point data and optional gesture information.
uint32_t hal_callback(SensorCommCustomHal::Operation op, void *param1, void *param2)