Touch screen calibration application
[Applications]

This application performs touch screen calibration by utilizing the Touch driver and Workqueue system. More...

Collaboration diagram for Touch screen calibration application:

Data Structures

struct  touch_calibrate_context
 Application context. More...

Defines

#define abs(a)   (((a) < 0) ? -(a) : (a))
 Convenience macro for getting absolute value of an integer.

Functions

static DEFINE_PROGMEM (char, calibrate_help_text[])
 Calibration guide text.
static void touch_calibrate_event_handler (const struct touch_event *event)
 Touch event handler.
static void touch_calibrate_task_handler (struct workqueue_task *task)
 Application task worker.
void app_touch_calibrate_setup (struct workqueue_task *completed_task)
 Set up calibration.

Variables

static struct
touch_calibrate_context
calibrate_context
 Context pointer.
static struct font sysfont2x
 Application font to use.

Application configuration



#define CAL_OFFSET   50
 Offset from the display edges to calibration circles.
#define CAL_RADIUS   5
 Radius of calibration circles.
#define CAL_TRESHOLD   500
 Threshold for unintended touches on display.
#define CAL_BG_COLOR   GFX_COLOR(0, 0, 255)
 Background color for the application.
#define CAL_FG_COLOR   GFX_COLOR(255, 255, 255)
 Foreground color for the application.

Detailed Description

This application performs touch screen calibration by utilizing the Touch driver and Workqueue system.

The application draws three circles on the screen in sequence as the user touches them. The raw sample data from the touches are used to compute a calibration matrix for the touch driver, enabling it to compute the pixel coordinates of touch events.


Define Documentation

#define abs (  )     (((a) < 0) ? -(a) : (a))

Convenience macro for getting absolute value of an integer.

Definition at line 77 of file app_calibrate.c.

Referenced by touch_calibrate_task_handler().

#define CAL_BG_COLOR   GFX_COLOR(0, 0, 255)

Background color for the application.

Definition at line 70 of file app_calibrate.c.

Referenced by touch_calibrate_task_handler().

#define CAL_FG_COLOR   GFX_COLOR(255, 255, 255)

Foreground color for the application.

Definition at line 72 of file app_calibrate.c.

Referenced by touch_calibrate_task_handler().

#define CAL_OFFSET   50

Offset from the display edges to calibration circles.

Definition at line 64 of file app_calibrate.c.

#define CAL_RADIUS   5

Radius of calibration circles.

Definition at line 66 of file app_calibrate.c.

Referenced by touch_calibrate_task_handler().

#define CAL_TRESHOLD   500

Threshold for unintended touches on display.

Definition at line 68 of file app_calibrate.c.

Referenced by touch_calibrate_task_handler().


Function Documentation

void app_touch_calibrate_setup ( struct workqueue_task completed_task  ) 

Set up calibration.

Allocates and initializes the application context; sets up the font, touch event handler and calibration data; updates the display and then schedules the calibration task.

Parameters:
completed_task Task to schedule when calibration is complete
static DEFINE_PROGMEM ( char  ,
calibrate_help_text  [] 
) [static]

Calibration guide text.

Note:
Stored in PROGMEM to reduce memory usage.
static void touch_calibrate_event_handler ( const struct touch_event event  )  [static]

Touch event handler.

Stores the current touch event to be processed by touch_calibrate_task_handler.

Parameters:
event Touch event data

Definition at line 119 of file app_calibrate.c.

References touch_calibrate_context::event.

static void touch_calibrate_task_handler ( struct workqueue_task task  )  [static]

Application task worker.

Waits for the touch release events generated after the user has touched a calibration circle drawn on screen, then stores the calibration data and draws the circle for the next calibration point.

Three such calibration points are stored before the calibration matrix for the touch driver is computed and assigned to it.

See also:
General touch driver
Note:
If the raw samples of a calibration point do not differ by at least CAL_TRESHOLD from the previous calibration point, it is interpreted as an unintended touch and ignored.
Parameters:
task Workqueue task for this worker function

Definition at line 142 of file app_calibrate.c.

References abs, CAL_BG_COLOR, CAL_FG_COLOR, touch_calibrate_context::cal_matrix, touch_calibrate_context::cal_points, CAL_RADIUS, CAL_TRESHOLD, touch_calibrate_context::completed_task, container_of, touch_calibrate_context::event, gfx_draw_circle, GFX_WHOLE, main_workqueue, membag_free(), touch_calibrate_context::old_handler, touch_event::point, touch_point::raw_x, touch_point::raw_y, touch_calibrate_context::state, touch_calibrate_context::task, touch_compute_calibration_matrix(), touch_set_calibration_matrix(), touch_set_event_handler(), touch_event::type, and workqueue_add_task().


Variable Documentation

Context pointer.

Definition at line 98 of file app_calibrate.c.

struct font sysfont2x [static]

Application font to use.

Definition at line 101 of file app_calibrate.c.

Generated on Thu Apr 29 14:09:59 2010 for display-demo by  doxygen 1.6.3