Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Committer:
WiredHome
Date:
Sun Apr 04 20:14:06 2021 +0000
Revision:
209:08fc22dea762
Parent:
198:9b6851107426
Fix a long-standing defect in the FT5206 where it reported 'touch' code even for hold and release events.

Who changed what in which revision?

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