This application performs touch screen calibration by utilizing the Touch driver and Workqueue system. More...
|
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. | |
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 abs | ( | a | ) | (((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().
| 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.
| completed_task | Task to schedule when calibration is complete |
| static DEFINE_PROGMEM | ( | char | , | |
| calibrate_help_text | [] | |||
| ) | [static] |
Calibration guide text.
| 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.
| 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.
| 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().
struct touch_calibrate_context* calibrate_context [static] |
Context pointer.
Definition at line 98 of file app_calibrate.c.
Application font to use.
Definition at line 101 of file app_calibrate.c.
1.6.3