当前位置:
文档之家› MTK_Touch_panel_Driver(MTK平台触摸屏驱动)
MTK_Touch_panel_Driver(MTK平台触摸屏驱动)
The main reason is LCD size and transform speed
For example: 256*256 LCD with 12 bits ADC converter
The distance between two adjacent pixels could reach 16 units (ADC coordinate)
10
Driver: MTK Calibration(1/2)
2 points calibration with extra one point determination
Calibration Flow Calibration Point Position
Avoid boundary points Use relative ADC difference to verify calibration points ⇒ ADC difference is in proportion to coordinate difference
9
Driver: 2-points Calibration(2/2)
Coord. at ACD X - axis Coord. at LCD X - axis
distance
≈
distance
Hence we need two predefined calibration points to get a, b, c, d P = aX + b Q = cY + d
MTK Touch panel
2010/10/14
Agenda
Introduction
Features Files Framework
Driver Touch Panel Introduction Touch Panel Calibration Process Touch panel event
Flow diagram Exercise: tocuh panel event
2
Features
Enable touch panel in project(CUSTOM_PROJECT.mak)
TOUCH_PANEL_SUPPORT = TRUE HAND_WRITING = MMI_HANWANG # MMI_HANWANG, MMI_PENPOWER
Enable touch panel in MMI(MMI_features.h,do not modify)
Wgui_draw_manager.c (plutommi\mmi\gui\gui_src) Wgui_draw_manager.h (plutommi\mmi\gui\gui_inc) Wgui_touch_screen.c (plutommi\mmi\gui\gui_src) Wgui_touch_screen.h (plutommi\mmi\gui\gui_inc) CustCoordinates.c (plutommi\customer\custresource) EditorPen.c (plutommi\mmi\editorpen\editorpensrc)
Touch_panel_custom.c (custom\drv\misc_drv\BOARD_VER) Touch_panel_custom.h (custom\drv\misc_drv\BOARD_VER) Touch_panel_spi.c (custom\drv\misc_drv\BOARD_VER) Touch_panel_spi.h (custom\drv\misc_drv\BOARD_VER)
How to get a touch point coordinate?
3. Use calibration data to transformed ADC value into coordinate. 4.Turn on X+, X- and repeat step 1 and step 2.
8
Driver: 2-points Calibration(1/2)
#ifdef TOUCH_PANEL_SUPPORT #define __MMI_TOUCH_SCREEN__ #endif #ifdef __MMI_TOUCH_SCREEN__ #define __MMI_TOUCH_DIAL_SCREEN__ #define __MMI_DRAW_MANAGER__ #define __MMI_WGUI_CSK_ENABLE__ #endif
13 SPI_DOUT_PIN
Touch panel event flow(Touch panel task)
14
Touch panel event flow(MMI task)
15
Exercise: touch panel event
#include #include #include #include #include #include void void void void void void void void "MMI_features.h" "PixtelDataTypes.h" "wgui_categories.h" "gdi_include.h" "lcd_sw_rnd.h" "wgui_draw_manager.h"
my_pen_up_hdlr(mmi_pen_point_struct point); my_pen_down_hdlr(mmi_pen_point_struct point); my_pen_move_hdlr(mmi_pen_point_struct point); my_pen_abort_hdlr(mmi_pen_point_struct point); my_pen_repeat_hdlr(mmi_pen_point_struct point); my_pen_long_tap_hdlr(mmi_pen_point_struct point); start_handwriting(); end_handwriting();
11
Driver: MTK Calibration(2/2)
Factory Mode
12
Driver: Custom const variables
Members TOUCH_PANEL_ADC_X_START TOUCH_PANEL_ADC_X_EDN TOUCH_PANEL_ADC_Y_START TOUCH_PANEL_ADC_Y_EDN TOUCH_PANEL_COORD_X_START TOUCH_PANEL_COORD_X_EDN TOUCH_PANEL_COORD_Y_START TOUCH_PANEL_COORD_Y_EDN TOUCH_PANEL_START_BIT TOUCH_PANEL_X_PLUS TOUCH_PANEL_Y_PLUS TOUCH_PANEL_ADC3 TOUCH_PANEL_ADC4 TOUCH_PANEL_12BIT_SAMPLE TOUCH_PANEL_8BIT_SAMPLE TOUCH_PANEL_DIFF_MODE TOUCH_PANEL_SINGLE_MODE TOUCH_PANEL_PWD_ENBLE TOUCH_PANEL_IRQ_DISABLE TOUCH_PANEL_PWD_DISABLE TOUCH_PANEL_PWD_RESER SPI_DIN_PIN SPI_CLK_PIN Description ADC of the left-upper x coordinate ADC of the right-lower x coordinate ADC of the left-upper y coordinate ADC of the right-lower y coordinate Minimum value of the x coordinate Maximum value of the x coordinate Minimum value of the y coordinate Maximum value of the y coordinate Start bit setting of touch panel module X plus setting of touch panel module Y plus setting of touch panel module ADC3 setting of touch panel module ADC4 setting of touch panel module 12 bits sample setting of touch panel module 8 bits sample setting of touch panel module Differential mode setting of touch panel module Single-ended mode setting of touch panel module Power down enable setting of touch panel module Interrupt disable setting of touch panel module Power down disable setting of touch panel module Reset setting of touch panel module GPIO used to be input GPIO used to be clock GPIO used to be output
y
( X ,Y )
q
(P , Q )
p
( P, Q) : LCD coodrinare ( X , Y ) : Touch panel coodrinare Assumption 1: X, Y are not correlative Assumption 2 : The linearity error is small enough to be ignored P = aX + b Q = cY + d