Android Bottom Drive learning focaltech Touch Screen Example Understanding
This week contacted a specific driver instance-----Focaltech Company's touch IC. The following summary of my personal understanding of touch-screen drive, divided into two aspects: hardware and software-driven aspects
Hardware aspects:
1. Brief introduction of the development of touch screen
With the popularization of computer technology, in the the early 1990s, a new human-computer interaction technology-touch screen technology emerged. By using this technology, the user can touch the graphics or text on the computer screen with a finger to achieve the host operation, thus getting rid of the keyboard and mouse operation and making the human-machine interaction more straightforward. Therefore, touch screen technology has become the most convenient human-machine communication input equipment.
2. The touch screen is made up of what.
For our developers, touch screen is actually by the display + touch IC, the common driving development refers to the touch IC, below a simple diagram to simulate my personal understanding of the touch screen:
In our display, the Touch IC is installed on the display screen, and then the Touch IC is connected with the peripheral circuit of the CPU, and then the driver is used to establish the software connection between the CPU and the touch IC.
3. How does the touch screen work?
At present, there are several touch screens, such as resistors, capacitors, infra-red, surface acoustic waves, etc., currently used more than capacitive touch screen.
The capacitive touch screen consists of a four-layer composite glass screen, four points out of four electrodes, because the person is a conductor, when the hands touch the screen, will cause the current from the four electrode flow, the touch IC can be detected by four electrodes out of the current worth of the proportion to determine the location of the touch.
The schematic diagram is as follows: By reading 1, 2, 3, 4 electrodes received the current ratio, calculate the contact point a position, and interrupt to enable, the point of position information on the CPU.
4. How does the touch IC transmit data to the CPU?
At present, the basic communication interface used in capacitive touch IC has three kinds: IIC, UART, SPI, at present generally only use IIC interface, the main interface pins are: VDD, GND, SCL, SDA, INT, RESET, Vddio.
definition |
Description |
Vdd |
Touch IC Power port, for TP power supply, generally for 3.3v/2.8v |
GND |
Ground wire for Touch ICS |
Scl |
I2C communication Interface Clock Line, control I2C bus transmission rate |
Sda |
I2C Communication Interface Data cable, transmit data between host and TP |
Int |
Touch IC Interrupt Signal interface, issued by the Touch IC end, used to inform the host to read the coordinate data, generally low level trigger |
RESET |
The reset signal of the Touch IC is issued by the host end, usually the touch IC will be reset for low power. |
Vddio |
The IO port voltage of the touch IC is generally 2.8v/1.8v and must be lower than VDD |
or compare with the diagram to express the meaning, the individual prefers this way, haha, the following is the CPU and touch IC electrical Connection diagram, note the direction of the arrow.
5. Do not want to see the specific internal hardware map Ah, haha, meet you.
Can't see clearly, then let's look at the local map separately:
Enlarge diagram One enlarge figure two
In the enlarged figure one, we can look at the interrupt generation process, the process: touch the screen--à position information passed to the touch Ic--à interrupt pin ts_int_n enable----to execute the Interrupt service program in the software
Similarly magnified figure two is the other pin's hardware connection diagram. In fact, for touch-screen drive, just care about ts_int_n interrupt interface, as for SDA, SCL these are control data transmission, is the display driver to do, this piece in the back can slowly understand, should still be very interesting.
The above is the understanding of the touch screen principle and hardware connection this week.
Software-driven aspects:
1. Understand the touch screen hardware implementation, the following is not to look at the implementation of software-driven aspects.
A) Register the I2C interface of the initial touch IC
b Establish the Touch IC software structure and initialize internal parameters (name, Fw-name, Irq-gpio, Reset-gpio, power on, let touch screen work, etc.)
C SET TP int PIN, register interrupt, load interrupt vector table, create interrupt Service Program
D Create various debug methods (Debugfs, SYSFS, etc.)
(e) Wait for interrupt information, read finger-touch coordinate data (via I2C fetch-Interface is fts_i2c_read) and escalate to system
Parameter name |
Parameter meaning |
Fts_upgrade_info Info |
Update the required information such as CHIP_ID, etc. |
Char *name |
The name of the touch screen is like fts_ts |
Char *fw_name |
Software version Name |
U32 Irq_gpio |
Corresponding to the interrupt port, the initialization of the set is good |
U32 Reset_gpio |
corresponding to the reset port, the initialization will be set |
U32 family_id |
|
U32 X_max, Y_max, X_min, y_min |
The range of coordinates displayed |
U32 Panel_minx, Panel_miny, Panel_maxx, Panel_maxy |
Display the coordinate range of the screen |
U32 group_id |
|
U32 hard_rst_dly, soft_rst_dly |
The required delay value of hardware and software when reset |
U32 num_max_touches |
Maximum touch points supported by touch screen |
U32 Button_map[4] |
|
U8 Num_button |
Number of keys |
BOOL Fw_vkey_support |
|
BOOL No_force_update |
|
BOOL I2c_pull_up |
|
BOOL Ignore_id_check |
|
BOOL Psensor_support |
|
Int (*power_init) (BOOL) |
Power initialization function |
Int (*power_on) (BOOL) |
Control POWER Switch function |
See below for specific details:
(i). focaltech_core.c file, touch screen module initialization and registration I2C driver.
(b) reading each parameter from the equipment tree, assigning the value to the touch screen structure, completing the initialization of the internal parameters of the touch screen
(iii) registered input device analog IO port
(iv) Power initialization and power supply to the touch screen on the electricity
(v) define reset for outlet, IRQ as input port, build software variable and hardware link
(vi) Registration interrupt put the interrupt program into the interrupt vector table
(vii) Create a contact screen information that needs to be found when the interrupt occurs
(eight) Establishment of DEBUGFS debugging mode