|
Data Structures | |
| struct | touch_point |
| Panel coordinate and measurement data of a single touch. More... | |
| struct | touch_calibration_matrix |
| Calibration matrix coefficients. More... | |
| struct | touch_event |
| Contains touch event type and touch point data. More... | |
Modules | |
| 4-wire resistive touch driver general implementation | |
| Board-specific ADC control for resistive touch driver | |
Defines | |
| #define | TOUCH_NR_CALIBRATION_POINTS 3 |
| Number of calibration points needed for driver. | |
Typedefs | |
| typedef struct touch_point | touch_calibration_points_t [TOUCH_NR_CALIBRATION_POINTS] |
| Array to hold calibration points. | |
| typedef void(* | touch_event_handler_t )(const struct touch_event *event) |
| Pointer to touch event handler function. | |
Enumerations | |
| enum | touch_event_types |
Enumeration of different touch event types for the touch_event struct. More... | |
Functions | |
| void | touch_init (void) |
| Initialize the touch driver. | |
| void | touch_enable (void) |
| Enable touch detection and sampling. | |
| void | touch_disable (void) |
| Disable touch detection and sampling. | |
| void | touch_get_event (struct touch_event *buffer) |
| Get last detected touch event from driver to buffer. | |
| bool | touch_is_touched (void) |
| Return current state of touch driver. | |
| void | touch_set_calibration_matrix (const struct touch_calibration_matrix *matrix) |
| Assign a calibration matrix to the driver. | |
| void | touch_get_calibration_matrix (struct touch_calibration_matrix *buffer) |
| Copy calibration matrix from driver to a buffer. | |
| void | touch_compute_calibration_matrix (const touch_calibration_points_t points, struct touch_calibration_matrix *matrix) |
| Compute a calibration matrix. | |
| void | touch_set_event_handler (touch_event_handler_t handler) |
| Set touch event handler for driver. | |
| touch_event_handler_t | touch_get_event_handler (void) |
| Get current touch event handler from driver. | |
For resistive touch the driver implementation utilizes GPIO pin interrupts, if needed, for touch detection and the ADC for position measurements.
If CONFIG_SOFTIRQ is defined, the driver will make use of the soft IRQ with ID SOFTIRQ_TOUCH_PROCESS for processing of measurements and calling the current touch event handler function.
| #define TOUCH_NR_CALIBRATION_POINTS 3 |
| typedef struct touch_point touch_calibration_points_t[TOUCH_NR_CALIBRATION_POINTS] |
Array to hold calibration points.
Meant for use with touch_compute_calibration_matrix().
| typedef void(* touch_event_handler_t)(const struct touch_event *event) |
| enum touch_event_types |
Enumeration of different touch event types for the touch_event struct.
| void touch_compute_calibration_matrix | ( | const touch_calibration_points_t | points, | |
| struct touch_calibration_matrix * | matrix | |||
| ) |
Compute a calibration matrix.
Computes the calibration matrix that is used to get the panel coordinates from raw measurements of the touch surface.
This requires that the
| points | Pointer to array containing calibration points. | |
| matrix | Pointer to storage buffer for the calibration matrix. |
Definition at line 270 of file touch.c.
References touch_calibration_matrix::a, assert, touch_calibration_matrix::b, touch_calibration_matrix::c, touch_calibration_matrix::d, touch_calibration_matrix::e, touch_calibration_matrix::f, and touch_calibration_matrix::k.
Referenced by touch_calibrate_task_handler().
| void touch_disable | ( | void | ) |
Disable touch detection and sampling.
Disables interrupts for the GPIO and the ADC.
Definition at line 160 of file touch.c.
References cpu_irq_restore(), cpu_irq_save(), touch_priv_adc_disable_int(), and touch_priv_port_disable_int().
Referenced by touch_init().
| void touch_enable | ( | void | ) |
Enable touch detection and sampling.
Resets the driver and touch state, configures GPIO pins for touch detection and enables interrupts for GPIO and the ADC.
Definition at line 137 of file touch.c.
References touch_last_event, TOUCH_NOT_TOUCHED, touch_priv_adc_clear_int_flag(), touch_priv_adc_enable_int(), touch_priv_port_clear_int_flag(), touch_priv_port_enable_int(), touch_priv_port_set_detection(), touch_state, and touch_event::type.
| void touch_get_calibration_matrix | ( | struct touch_calibration_matrix * | buffer | ) |
Copy calibration matrix from driver to a buffer.
| buffer | Address of buffer to copy calibration matrix to. |
Definition at line 250 of file touch.c.
References assert, and touch_matrix.
| void touch_get_event | ( | struct touch_event * | buffer | ) |
Get last detected touch event from driver to buffer.
| buffer | Buffer to store touch event in. |
Definition at line 179 of file touch.c.
References assert, cpu_irq_restore(), cpu_irq_save(), and touch_last_event.
| touch_event_handler_t touch_get_event_handler | ( | void | ) |
Get current touch event handler from driver.
Definition at line 226 of file touch.c.
References touch_event_handler.
| void touch_init | ( | void | ) |
Initialize the touch driver.
Initializes the GPIO pins and ADC for touch detection and measurements, as well as the driver states.
Must be called before any other function in this driver.
Definition at line 111 of file touch.c.
References softirq_set_handler(), touch_disable(), touch_event_handler, touch_last_event, TOUCH_NOT_TOUCHED, touch_priv_adc_init(), touch_priv_port_init(), touch_priv_process_samples(), touch_state, and touch_event::type.
| bool touch_is_touched | ( | void | ) |
Return current state of touch driver.
| true | Driver is sensing a touch. | |
| false | Driver is not sensing a touch. |
Definition at line 198 of file touch.c.
References touch_last_event, and touch_event::type.
| void touch_set_calibration_matrix | ( | const struct touch_calibration_matrix * | matrix | ) |
Assign a calibration matrix to the driver.
| matrix | Address of calibration matrix for the driver to copy. |
Definition at line 237 of file touch.c.
References assert, and touch_matrix.
Referenced by touch_calibrate_task_handler().
| void touch_set_event_handler | ( | touch_event_handler_t | handler | ) |
Set touch event handler for driver.
| handler | Address of new handler function. |
Definition at line 210 of file touch.c.
References cpu_irq_restore(), cpu_irq_save(), and touch_event_handler.
Referenced by touch_calibrate_task_handler().
1.6.3