This is the David Smart RA8875 Library with mods for working with FRDM-K64F
RA8875_Touch_FT5206.h@165:695c24cc5197, 2019-02-24 (annotated)
- Committer:
- WiredHome
- Date:
- Sun Feb 24 00:40:00 2019 +0000
- Revision:
- 165:695c24cc5197
- Child:
- 166:53fd4a876dac
Initial refactoring to add support for another Cap Sense touch controller - based on the GSL1680.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 165:695c24cc5197 | 1 | /// FT5206 Touch Controller definitions |
WiredHome | 165:695c24cc5197 | 2 | /// |
WiredHome | 165:695c24cc5197 | 3 | /// |
WiredHome | 165:695c24cc5197 | 4 | |
WiredHome | 165:695c24cc5197 | 5 | #ifndef RA8875_TOUCH_FT5206_H |
WiredHome | 165:695c24cc5197 | 6 | #define RA8875_TOUCH_FT5206_H |
WiredHome | 165:695c24cc5197 | 7 | |
WiredHome | 165:695c24cc5197 | 8 | /// FT5206 definitions follow |
WiredHome | 165:695c24cc5197 | 9 | #define FT5206_I2C_FREQUENCY 400000 |
WiredHome | 165:695c24cc5197 | 10 | #define FT5206_I2C_ADDRESS 0x38 |
WiredHome | 165:695c24cc5197 | 11 | |
WiredHome | 165:695c24cc5197 | 12 | #define FT5206_NUMBER_OF_REGISTERS 31 // there are more registers, but this |
WiredHome | 165:695c24cc5197 | 13 | // is enough to get all 5 touch coordinates. |
WiredHome | 165:695c24cc5197 | 14 | |
WiredHome | 165:695c24cc5197 | 15 | #define FT5206_NUMBER_OF_TOTAL_REGISTERS 0xFE |
WiredHome | 165:695c24cc5197 | 16 | |
WiredHome | 165:695c24cc5197 | 17 | #define FT5206_DEVICE_MODE 0x00 // Normal, test, etc. |
WiredHome | 165:695c24cc5197 | 18 | #define FT5206_GEST_ID 0x01 // Gesture detected |
WiredHome | 165:695c24cc5197 | 19 | #define FT5206_TD_STATUS 0x02 // How many points detected (3:0). 1-5 is valid. |
WiredHome | 165:695c24cc5197 | 20 | |
WiredHome | 165:695c24cc5197 | 21 | #define FT5206_TOUCH1_XH 0x03 // Event Flag, Touch X Position |
WiredHome | 165:695c24cc5197 | 22 | #define FT5206_TOUCH1_XL 0x04 |
WiredHome | 165:695c24cc5197 | 23 | #define FT5206_TOUCH1_YH 0x05 // Touch ID, Touch Y Position |
WiredHome | 165:695c24cc5197 | 24 | #define FT5206_TOUCH1_YL 0x06 |
WiredHome | 165:695c24cc5197 | 25 | |
WiredHome | 165:695c24cc5197 | 26 | #define FT5206_TOUCH2_XH 0x09 // Event Flag, Touch X Position |
WiredHome | 165:695c24cc5197 | 27 | #define FT5206_TOUCH2_XL 0x0a |
WiredHome | 165:695c24cc5197 | 28 | #define FT5206_TOUCH2_YH 0x0b // Touch ID, Touch Y Position |
WiredHome | 165:695c24cc5197 | 29 | #define FT5206_TOUCH2_YL 0x0c |
WiredHome | 165:695c24cc5197 | 30 | |
WiredHome | 165:695c24cc5197 | 31 | #define FT5206_TOUCH3_XH 0x0f // Event Flag, Touch X Position |
WiredHome | 165:695c24cc5197 | 32 | #define FT5206_TOUCH3_XL 0x10 |
WiredHome | 165:695c24cc5197 | 33 | #define FT5206_TOUCH3_YH 0x11 // Touch ID, Touch Y Position |
WiredHome | 165:695c24cc5197 | 34 | #define FT5206_TOUCH3_YL 0x12 |
WiredHome | 165:695c24cc5197 | 35 | |
WiredHome | 165:695c24cc5197 | 36 | #define FT5206_TOUCH4_XH 0x15 // Event Flag, Touch X Position |
WiredHome | 165:695c24cc5197 | 37 | #define FT5206_TOUCH4_XL 0x16 |
WiredHome | 165:695c24cc5197 | 38 | #define FT5206_TOUCH4_YH 0x17 // Touch ID, Touch Y Position |
WiredHome | 165:695c24cc5197 | 39 | #define FT5206_TOUCH4_YL 0x18 |
WiredHome | 165:695c24cc5197 | 40 | |
WiredHome | 165:695c24cc5197 | 41 | #define FT5206_TOUCH5_XH 0x1b // Event Flag, Touch X Position |
WiredHome | 165:695c24cc5197 | 42 | #define FT5206_TOUCH5_XL 0x1c |
WiredHome | 165:695c24cc5197 | 43 | #define FT5206_TOUCH5_YH 0x1d // Touch ID, Touch Y Position |
WiredHome | 165:695c24cc5197 | 44 | #define FT5206_TOUCH5_YL 0x1e |
WiredHome | 165:695c24cc5197 | 45 | |
WiredHome | 165:695c24cc5197 | 46 | // For typical usage, the registers listed below are not used. |
WiredHome | 165:695c24cc5197 | 47 | #define FT5206_ID_G_THGROUP 0x80 // Valid touching detect threshold |
WiredHome | 165:695c24cc5197 | 48 | #define FT5206_ID_G_THPEAK 0x81 // Valid touching peak detect threshold |
WiredHome | 165:695c24cc5197 | 49 | #define FT5206_ID_G_THCAL 0x82 // The threshold when calculating the focus of touching |
WiredHome | 165:695c24cc5197 | 50 | #define FT5206_ID_G_THWATER 0x83 // The threshold when there is surface water |
WiredHome | 165:695c24cc5197 | 51 | #define FT5206_ID_G_THTEMP 0x84 // The threshold of temperature compensation |
WiredHome | 165:695c24cc5197 | 52 | #define FT5206_ID_G_CTRL 0x86 // Power control mode |
WiredHome | 165:695c24cc5197 | 53 | #define FT5206_ID_G_TIME_ENTER_MONITOR 0x87 // The timer of entering monitor status |
WiredHome | 165:695c24cc5197 | 54 | #define FT5206_ID_G_PERIODACTIVE 0x88 // Period Active |
WiredHome | 165:695c24cc5197 | 55 | #define FT5206_ID_G_PERIODMONITOR 0x89 // The timer of entering idle while in monitor status |
WiredHome | 165:695c24cc5197 | 56 | #define FT5206_ID_G_AUTO_CLB_MODE 0xA0 // Auto calibration mode |
WiredHome | 165:695c24cc5197 | 57 | |
WiredHome | 165:695c24cc5197 | 58 | #define FT5206_TOUCH_LIB_VERSION_H 0xA1 // Firmware Library Version H byte |
WiredHome | 165:695c24cc5197 | 59 | #define FT5206_TOUCH_LIB_VERSION_L 0xA2 // Firmware Library Version L byte |
WiredHome | 165:695c24cc5197 | 60 | #define FT5206_ID_G_CIPHER 0xA3 // Chip vendor ID |
WiredHome | 165:695c24cc5197 | 61 | #define FT5206_G_MODE 0xA4 // The interrupt status to host |
WiredHome | 165:695c24cc5197 | 62 | #define FT5206_ID_G_PMODE 0xA5 // Power Consume Mode |
WiredHome | 165:695c24cc5197 | 63 | #define FT5206_FIRMID 0xA6 // Firmware ID |
WiredHome | 165:695c24cc5197 | 64 | #define FT5206_ID_G_STATE 0xA7 // Running State |
WiredHome | 165:695c24cc5197 | 65 | #define FT5206_ID_G_FT5201ID 0xA8 // CTPM Vendor ID |
WiredHome | 165:695c24cc5197 | 66 | #define FT5206_ID_G_ERR 0xA9 // Error Code |
WiredHome | 165:695c24cc5197 | 67 | #define FT5206_ID_G_CLB 0xAA // Configure TP module during calibration in Test Mode |
WiredHome | 165:695c24cc5197 | 68 | #define FT5206_ID_G_B_AREA_TH 0xAE // The threshold of big area |
WiredHome | 165:695c24cc5197 | 69 | #define FT5206_LOG_MSG_CNT 0xFE // The log MSG count |
WiredHome | 165:695c24cc5197 | 70 | #define FT5206_LOG_CUR_CHA 0xFF // Current character of log message, will point to the next |
WiredHome | 165:695c24cc5197 | 71 | // character when one character is read. |
WiredHome | 165:695c24cc5197 | 72 | #define FT5206_GEST_ID_MOVE_UP 0x10 |
WiredHome | 165:695c24cc5197 | 73 | #define FT5206_GEST_ID_MOVE_LEFT 0x14 |
WiredHome | 165:695c24cc5197 | 74 | #define FT5206_GEST_ID_MOVE_DOWN 0x18 |
WiredHome | 165:695c24cc5197 | 75 | #define FT5206_GEST_ID_MOVE_RIGHT 0x1c |
WiredHome | 165:695c24cc5197 | 76 | #define FT5206_GEST_ID_ZOOM_IN 0x48 |
WiredHome | 165:695c24cc5197 | 77 | #define FT5206_GEST_ID_ZOOM_OUT 0x49 |
WiredHome | 165:695c24cc5197 | 78 | #define FT5206_GEST_ID_NO_GESTURE 0x00 |
WiredHome | 165:695c24cc5197 | 79 | |
WiredHome | 165:695c24cc5197 | 80 | #define FT5206_EVENT_FLAG_PUT_DOWN 0x00 |
WiredHome | 165:695c24cc5197 | 81 | #define FT5206_EVENT_FLAG_PUT_UP 0x01 |
WiredHome | 165:695c24cc5197 | 82 | #define FT5206_EVENT_FLAG_CONTACT 0x02 |
WiredHome | 165:695c24cc5197 | 83 | #define FT5206_EVENT_FLAG_RESERVED 0x03 |
WiredHome | 165:695c24cc5197 | 84 | |
WiredHome | 165:695c24cc5197 | 85 | #define FT5206_ID_G_POLLING_MODE 0x00 |
WiredHome | 165:695c24cc5197 | 86 | #define FT5206_ID_G_TRIGGER_MODE 0x01 |
WiredHome | 165:695c24cc5197 | 87 | |
WiredHome | 165:695c24cc5197 | 88 | #define FT5206_ID_G_PMODE_ACTIVE 0x00 |
WiredHome | 165:695c24cc5197 | 89 | #define FT5206_ID_G_PMODE_MONITOR 0x01 |
WiredHome | 165:695c24cc5197 | 90 | #define FT5206_ID_G_PMODE_HIBERNATE 0x03 |
WiredHome | 165:695c24cc5197 | 91 | |
WiredHome | 165:695c24cc5197 | 92 | #define FT5206_ID_G_STATE_CONFIGURE 0x00 |
WiredHome | 165:695c24cc5197 | 93 | #define FT5206_ID_G_STATE_WORK 0x01 |
WiredHome | 165:695c24cc5197 | 94 | #define FT5206_ID_G_STATE_CALIBRATION 0x02 |
WiredHome | 165:695c24cc5197 | 95 | #define FT5206_ID_G_STATE_FACTORY 0x03 |
WiredHome | 165:695c24cc5197 | 96 | #define FT5206_ID_G_STATE_AUTO_CALIBRATION 0x04 |
WiredHome | 165:695c24cc5197 | 97 | |
WiredHome | 165:695c24cc5197 | 98 | /// end of FT5206 definitions |
WiredHome | 165:695c24cc5197 | 99 | |
WiredHome | 165:695c24cc5197 | 100 | #endif // RA8875_TOUCH_FT5206_H |