SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
touch/TouchDrvFT6X36.hpp
Go to the documentation of this file.
1
30#pragma once
31
32#include "../SensorBuildOpt.h"
33#if !SENSORLIB_EXCLUDE_TOUCH_FT6X36
34
35#include "TouchDrvInterface.hpp"
36
37static constexpr uint8_t FT3267_SLAVE_ADDRESS = (0x38);
38static constexpr uint8_t FT5206_SLAVE_ADDRESS = (0x38);
39static constexpr uint8_t FT6X36_SLAVE_ADDRESS = (0x38);
40
42{
43public:
54
61
62 enum PowerMode {
63 PMODE_ACTIVE = 0, // ~4mA
64 PMODE_MONITOR = 1, // ~3mA
65 PMODE_DEEP_SLEEP = 3, // ~100uA The reset pin must be pulled down to wake up
66 } ;
67
72 TouchDrvFT6X36() = default;
73
78 ~TouchDrvFT6X36() = default;
79
87 void sleep() override;
88
94 const TouchPoints &getTouchPoints() override;
95
101 const char *getModelName() override;
102
108 uint8_t getDeviceMode(void);
109
110 // Obtaining gestures depends on whether the built-in firmware of the chip has this function
111 uint8_t getGesture();
112
113
120 void setDeviceMode(uint8_t value);
121
127 uint8_t getThreshold(void);
128
129
136 void setThreshold(uint8_t value);
137
143 uint8_t getMonitorTime(void);
144
151 void setMonitorTime(uint8_t sec);
152
153
159 uint16_t getLibraryVersion();
160
166 void interruptPolling(void);
167
173 void interruptTrigger(void);
174
181 void setPowerMode(PowerMode mode);
182
188 uint8_t getVendorID(void);
189
195 uint8_t getErrorCode(void);
196
197private:
198 bool initImpl(uint8_t) override;
199
200 void beforeBegin() override
201 {
204 }
205
206
207 static constexpr uint8_t BYTES_PER_POINT = (6);
208 static constexpr uint8_t MAX_FINGER_NUM = (5);
209
210 static constexpr uint8_t FT_VEND_ID1 = (0x11);
211 static constexpr uint8_t FT_VEND_ID2 = (0xCD);
212 static constexpr uint8_t FT_VEND_ID3 = (0x51);
213
214 static constexpr uint8_t FT3267_CHIP_ID = (0x33);
215 static constexpr uint8_t FT3068_CHIP_ID = (0xA0);
216 static constexpr uint8_t FT5336_CHIP_ID = (0x14);
217 static constexpr uint8_t FT6206_CHIP_ID = (0x06);
218 static constexpr uint8_t FT6236_CHIP_ID = (0x36);
219 static constexpr uint8_t FT6336U_CHIP_ID = (0x64);
220
221 static constexpr uint8_t FT6X36_REG_MODE = (0x00);
222 static constexpr uint8_t FT6X36_REG_GEST = (0x01);
223 static constexpr uint8_t FT6X36_REG_STATUS = (0x02);
224 static constexpr uint8_t FT6X36_REG_TOUCH1_XH = (0x03);
225 static constexpr uint8_t FT6X36_REG_TOUCH1_XL = (0x04);
226 static constexpr uint8_t FT6X36_REG_TOUCH1_YH = (0x05);
227 static constexpr uint8_t FT6X36_REG_TOUCH1_YL = (0x06);
228 static constexpr uint8_t FT6X36_REG_THRESHOLD = (0x80);
229 static constexpr uint8_t FT6X36_REG_MONITOR_TIME = (0x87);
230 static constexpr uint8_t FT6X36_REG_PERIOD_ACTIVE = (0x88);
231 static constexpr uint8_t FT6X36_REG_PERIOD_MONITOR = (0x89);
232 static constexpr uint8_t FT6X36_REG_AUTO_CLB_MODE = (0xA0);
233 static constexpr uint8_t FT6X36_REG_LIB_VERSION_H = (0xA1);
234 static constexpr uint8_t FT6X36_REG_LIB_VERSION_L = (0xA2);
235 static constexpr uint8_t FT6X36_REG_INT_STATUS = (0xA4);
236 static constexpr uint8_t FT6X36_REG_POWER_MODE = (0xA5);
237 static constexpr uint8_t FT6X36_REG_FIRM_VERS = (0xA6);
238 static constexpr uint8_t FT6X36_REG_CHIP_ID = (0xA3);
239 static constexpr uint8_t FT6X36_REG_VENDOR1_ID = (0xA8);
240 static constexpr uint8_t FT6X36_REG_ERROR_STATUS = (0xA9);
241};
242
243#endif
void interruptPolling(void)
Polling mode for touch interrupt.
uint16_t getLibraryVersion()
Get the library version.
const char * getModelName() override
Get the model name.
void interruptTrigger(void)
Trigger mode for touch interrupt.
uint8_t getThreshold(void)
Get the touch threshold.
uint8_t getVendorID(void)
Get the vendor ID.
void setThreshold(uint8_t value)
Set the touch threshold.
const TouchPoints & getTouchPoints() override
Get the touch points.
TouchDrvFT6X36()=default
Constructor for the touch driver.
uint8_t getMonitorTime(void)
Get the monitor time.
void setMonitorTime(uint8_t sec)
Set the monitor time.
void setPowerMode(PowerMode mode)
Set the touch interrupt mode.
uint8_t getDeviceMode(void)
Get the device mode.
void setDeviceMode(uint8_t value)
Set the device mode.
~TouchDrvFT6X36()=default
Destructor for the touch driver.
void sleep() override
Puts the touch driver to sleep.
uint8_t getErrorCode(void)
Get the error code.
Abstract base class for touch screen drivers.
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).
TouchPinsCfg _pinsCfg
Configuration for reset and interrupt pins.
Container for touch point data and optional gesture information.