|
SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
|
#include <TouchDrvFT6X36.hpp>
Public Types | |
| enum | GesTrue { NO_GESTURE , MOVE_UP , MOVE_LEFT , MOVE_DOWN , MOVE_RIGHT , ZOOM_IN , ZOOM_OUT } |
| enum | EventFlag { EVENT_PUT_DOWN , EVENT_PUT_UP , EVENT_CONTACT , EVENT_NONE } |
| enum | PowerMode { PMODE_ACTIVE = 0 , PMODE_MONITOR = 1 , PMODE_DEEP_SLEEP = 3 } |
Public Types inherited from TouchDrvInterface | |
| using | HomeButtonCallback = void(*)(void *user_data) |
| Callback type for home button events. | |
Public Member Functions | |
| TouchDrvFT6X36 ()=default | |
| Constructor for the touch driver. | |
| ~TouchDrvFT6X36 ()=default | |
| Destructor for the touch driver. | |
| void | sleep () override |
| Puts the touch driver to sleep. | |
| const TouchPoints & | getTouchPoints () override |
| Get the touch points. | |
| const char * | getModelName () override |
| Get the model name. | |
| uint8_t | getDeviceMode (void) |
| Get the device mode. | |
| uint8_t | getGesture () |
| void | setDeviceMode (uint8_t value) |
| Set the device mode. | |
| uint8_t | getThreshold (void) |
| Get the touch threshold. | |
| void | setThreshold (uint8_t value) |
| Set the touch threshold. | |
| uint8_t | getMonitorTime (void) |
| Get the monitor time. | |
| void | setMonitorTime (uint8_t sec) |
| Set the monitor time. | |
| uint16_t | getLibraryVersion () |
| Get the library version. | |
| void | interruptPolling (void) |
| Polling mode for touch interrupt. | |
| void | interruptTrigger (void) |
| Trigger mode for touch interrupt. | |
| void | setPowerMode (PowerMode mode) |
| Set the touch interrupt mode. | |
| uint8_t | getVendorID (void) |
| Get the vendor ID. | |
| uint8_t | getErrorCode (void) |
| Get the error code. | |
| virtual uint8_t | getPoint (int16_t *x_array, int16_t *y_array, uint8_t get_point=1) __attribute__((deprecated("use getTouchPoints instead of getPoint"))) |
| Retrieve touch point coordinates (deprecated). | |
Public Member Functions inherited from TouchDrvInterface | |
| TouchDrvInterface () | |
| Construct a new TouchDrvInterface object. | |
| virtual | ~TouchDrvInterface ()=default |
| Destroy the TouchDrvInterface object. | |
| virtual bool | begin (SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr) |
| Initialize the touch driver with custom communication callbacks. | |
| virtual void | setGpioCallback (SensorHalCustom::CustomMode mode_cb, SensorHalCustom::CustomWrite write_cb, SensorHalCustom::CustomRead read_cb) |
| Set custom GPIO callbacks for pin control (e.g., reset, interrupt). | |
| virtual uint8_t | getSupportTouchPoint () |
| Get the maximum number of touch points supported by the hardware. | |
| virtual void | getResolution (uint16_t &x, uint16_t &y) |
| Get the raw resolution (maximum coordinate values) of the touch panel. | |
| virtual uint16_t | getResolutionX () |
| Get the raw maximum X coordinate of the touch panel. | |
| virtual uint16_t | getResolutionY () |
| Get the raw maximum Y coordinate of the touch panel. | |
| virtual void | reset () |
| Reset the touch controller. | |
| virtual void | wakeup () |
| Wake the touch controller from sleep mode (pure virtual). | |
| virtual bool | isPressed (uint32_t filter_ms=0) |
| Check if any touch point is currently pressed. | |
| virtual uint32_t | getChipID () |
| Get the chip identifier (e.g., ID register value). | |
| virtual void | setPins (int rst, int irq) |
| Set the hardware reset and interrupt pin numbers. | |
| virtual const TouchPinsCfg & | getTouchPinsCfg () const |
| Get the current touch pins configuration. | |
| virtual void | setSwapXY (bool swap) |
| Enable or disable swapping of X and Y coordinates. | |
| virtual bool | isSwapXY () const |
| Check if X and Y coordinates are swapped. | |
| virtual void | setMirrorXY (bool mirrorX, bool mirrorY) |
| Enable or disable mirroring of X and/or Y coordinates. | |
| virtual bool | isMirrorX () const |
| Check if X coordinates are mirrored. | |
| virtual bool | isMirrorY () const |
| Check if Y coordinates are mirrored. | |
| virtual void | setMaxCoordinates (uint16_t x, uint16_t y) |
| Set the maximum coordinate values used for mirroring. | |
| virtual void | getMaxCoordinates (uint16_t &x, uint16_t &y) |
| Get the maximum coordinates used for mirroring. | |
| virtual uint16_t | getMaxX () |
| Get the maximum X coordinate (e.g., display width). | |
| virtual uint16_t | getMaxY () |
| Get the maximum Y coordinate (e.g., display height). | |
| virtual bool | isScalingEnabled () |
| Check if coordinate scaling is enabled. | |
| virtual void | setResolution (uint16_t width, uint16_t height) |
| Set the raw resolution of the touch panel (physical maximum coordinates). | |
| virtual void | setTargetResolution (uint16_t width, uint16_t height) |
| Set the target display resolution to map touch coordinates to screen pixels. | |
| virtual void | updateXY (TouchPoints &points) const |
| Apply coordinate transformations (swap, scale, mirror) to all touch points. | |
| virtual void | setHomeButtonCallback (HomeButtonCallback cb, void *user_data) |
| Register a callback for home button events. | |
| virtual void | setCenterButtonCoordinate (int16_t x, int16_t y) |
| Set the expected screen coordinates of a hardware home button. | |
Public Member Functions inherited from I2CDeviceWithHal | |
| bool | begin (SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr) |
| Initialize the sensor using custom callback interface. | |
Public Member Functions inherited from DeviceBeginCommon | |
| virtual | ~DeviceBeginCommon () |
| uint8_t | getAddress () const |
| uint8_t | getInterface () const |
Public Member Functions inherited from SensorCommWrapper | |
| SensorCommWrapper ()=default | |
| int | readReg (uint8_t reg) const |
| int | readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const |
| int | readBuff (uint8_t *buf, size_t len) const |
| int | writeReg (uint8_t reg, uint8_t val) |
| int | writeRegBuff (uint8_t reg, uint8_t *buf, size_t len) |
| int | writeBuff (uint8_t *buf, size_t len) |
| int | writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len) |
| bool | setRegBit (uint8_t reg, uint8_t bit) |
| bool | clrRegBit (uint8_t reg, uint8_t bit) |
| bool | getRegBit (uint8_t reg, uint8_t bit) |
| int | updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted) |
| void | setAddress (uint8_t address) |
| void | setAck (bool enable) |
Public Member Functions inherited from SensorCommInterface | |
| virtual | ~SensorCommInterface ()=default |
Additional Inherited Members | |
Protected Member Functions inherited from I2CDeviceWithHal | |
| bool | ensureValid () const override |
| Ensure the communication interface is valid. | |
Protected Member Functions inherited from DeviceBeginCommon | |
| DeviceBeginCommon ()=default | |
| virtual SensorCommBase * | getComm () const override |
| virtual void | afterInitSuccess (uint8_t param) |
| virtual void | onBeginFail () |
| bool | fail () |
| void | clearCommState () |
| template<typename CreateComm > | |
| bool | beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm) |
Protected Attributes inherited from TouchDrvInterface | |
| SensorHalCustom::CustomMode | _halModeCallback |
| Custom GPIO mode callback. | |
| SensorHalCustom::CustomWrite | _halWriteCallback |
| Custom GPIO write callback. | |
| SensorHalCustom::CustomRead | _halReadCallback |
| Custom GPIO read callback. | |
| uint32_t | _chipID |
| Chip identification value. | |
| HomeButtonCallback | _HButtonCallback |
| Home button callback function. | |
| void * | _userData |
| User data for home button callback. | |
| uint8_t | _maxTouchPoints |
| Maximum supported touch points. | |
| int16_t | _center_btn_x |
| X coordinate of home button center. | |
| int16_t | _center_btn_y |
| Y coordinate of home button center. | |
| uint32_t | _lastPulse |
| Timestamp of the last touch event. | |
| TouchPinsCfg | _pinsCfg |
| Configuration for reset and interrupt pins. | |
| TouchConfig | _touchConfig |
| Configuration for coordinate transformations. | |
| TouchPoints | _touchPoints |
| Touch points data. | |
Protected Attributes inherited from DeviceBeginCommon | |
| std::unique_ptr< SensorCommBase > | comm |
| std::unique_ptr< SensorHal > | hal |
| std::unique_ptr< SensorCommStatic > | staticComm |
| uint8_t | _addr = 0 |
| uint8_t | _iface = COMM_CUSTOM |
Definition at line 41 of file touch/TouchDrvFT6X36.hpp.
| Enumerator | |
|---|---|
| EVENT_PUT_DOWN | |
| EVENT_PUT_UP | |
| EVENT_CONTACT | |
| EVENT_NONE | |
Definition at line 55 of file touch/TouchDrvFT6X36.hpp.
| Enumerator | |
|---|---|
| NO_GESTURE | |
| MOVE_UP | |
| MOVE_LEFT | |
| MOVE_DOWN | |
| MOVE_RIGHT | |
| ZOOM_IN | |
| ZOOM_OUT | |
Definition at line 45 of file touch/TouchDrvFT6X36.hpp.
| Enumerator | |
|---|---|
| PMODE_ACTIVE | |
| PMODE_MONITOR | |
| PMODE_DEEP_SLEEP | |
Definition at line 62 of file touch/TouchDrvFT6X36.hpp.
|
default |
Constructor for the touch driver.
| None |
|
default |
Destructor for the touch driver.
| None |
| uint8_t TouchDrvFT6X36::getDeviceMode | ( | void | ) |
Get the device mode.
| The | device mode. |
Definition at line 91 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readReg().
| uint8_t TouchDrvFT6X36::getErrorCode | ( | void | ) |
Get the error code.
| The | error code. |
Definition at line 163 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readReg().
| uint8_t TouchDrvFT6X36::getGesture | ( | ) |
Definition at line 96 of file TouchDrvFT6X36.cpp.
References MOVE_DOWN, MOVE_LEFT, MOVE_RIGHT, MOVE_UP, NO_GESTURE, SensorCommWrapper::readReg(), ZOOM_IN, and ZOOM_OUT.
| uint16_t TouchDrvFT6X36::getLibraryVersion | ( | ) |
Get the library version.
| The | library version. |
Definition at line 136 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readRegBuff().
|
overridevirtual |
Get the model name.
| The | model name. |
Implements TouchDrvInterface.
Definition at line 78 of file TouchDrvFT6X36.cpp.
References TouchDrvInterface::_chipID.
Referenced by setup().
| uint8_t TouchDrvFT6X36::getMonitorTime | ( | void | ) |
Get the monitor time.
| The | monitor time. |
Definition at line 126 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readReg().
|
inlinevirtual |
Retrieve touch point coordinates (deprecated).
getTouchPoints() instead, which returns a richer TouchPoints object.| [out] | x_array | Pointer to array to store X coordinates. |
| [out] | y_array | Pointer to array to store Y coordinates. |
| get_point | Number of points to retrieve (max). |
Reimplemented from TouchDrvInterface.
Definition at line 288 of file touch/TouchDrvInterface.hpp.
| uint8_t TouchDrvFT6X36::getThreshold | ( | void | ) |
Get the touch threshold.
| The | touch threshold. |
Definition at line 116 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readReg().
|
overridevirtual |
Get the touch points.
| A | reference to the touch points. |
Implements TouchDrvInterface.
Definition at line 40 of file TouchDrvFT6X36.cpp.
References TouchDrvInterface::_touchPoints, TouchPoints::addPoint(), TouchPoints::clear(), i, SensorCommWrapper::readReg(), SensorCommWrapper::readRegBuff(), SENSORLIB_LOG_E, TouchDrvInterface::updateXY(), x, and y.
Referenced by loop().
| uint8_t TouchDrvFT6X36::getVendorID | ( | void | ) |
Get the vendor ID.
| The | vendor ID. |
Definition at line 158 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::readReg().
| void TouchDrvFT6X36::interruptPolling | ( | void | ) |
Polling mode for touch interrupt.
| None |
Definition at line 143 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
Referenced by setup(), and setupTouchDrv().
| void TouchDrvFT6X36::interruptTrigger | ( | void | ) |
Trigger mode for touch interrupt.
| None |
Definition at line 148 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
| void TouchDrvFT6X36::setDeviceMode | ( | uint8_t | value | ) |
Set the device mode.
| value | The device mode to set. |
| None |
Definition at line 111 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
| void TouchDrvFT6X36::setMonitorTime | ( | uint8_t | sec | ) |
Set the monitor time.
| sec | The monitor time to set. |
| None |
Definition at line 131 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
| void TouchDrvFT6X36::setPowerMode | ( | PowerMode | mode | ) |
Set the touch interrupt mode.
| mode | The interrupt mode to set. |
| None |
Definition at line 153 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
| void TouchDrvFT6X36::setThreshold | ( | uint8_t | value | ) |
Set the touch threshold.
| value | The touch threshold to set. |
| None |
Definition at line 121 of file TouchDrvFT6X36.cpp.
References SensorCommWrapper::writeReg().
|
overridevirtual |
Puts the touch driver to sleep.
| None |
Implements TouchDrvInterface.
Definition at line 35 of file TouchDrvFT6X36.cpp.
References PMODE_DEEP_SLEEP, and SensorCommWrapper::writeReg().