This service provides an interface for handling resistive touch component.
The resistive touch service consists of the following:
The resistive touch service provides an general interface to be used by the application or by libraries. It can support various touch component and also provide convenient routines to handle touch screen calibration.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the Resistive Touch Service. | |
ADS7843 Touch Controller | |
This is hardware specific configuration that configures the resistive touch service for use with the ADS7843 touch controller. | |
Data Structures | |
struct | rtouch_calibration_point_struct |
Storage structure for calibration point (actual and raw positions). More... | |
struct | rtouch_calibration_points_struct |
Collection of the five calibration points required to compute calibration. More... | |
struct | rtouch_event_struct |
User touch event structure. More... | |
struct | rtouch_point_struct |
Point definition. More... | |
Typedefs | |
typedef struct rtouch_calibration_point_struct | rtouch_calibration_point_t |
Storage structure for calibration point (actual and raw positions). More... | |
typedef struct rtouch_calibration_points_struct | rtouch_calibration_points_t |
Collection of the five calibration points required to compute calibration. More... | |
typedef void(* | rtouch_event_handler_t )(rtouch_event_t const *event) |
typedef struct rtouch_event_struct | rtouch_event_t |
User touch event structure. More... | |
typedef enum rtouch_event_type_enum | rtouch_event_type_t |
Touch events enumeration. More... | |
typedef struct rtouch_point_struct | rtouch_point_t |
Point definition. More... | |
Enumerations | |
enum | rtouch_event_type_enum { RTOUCH_PRESS, RTOUCH_MOVE, RTOUCH_RELEASE } |
Touch events enumeration. More... | |
Functions | |
uint32_t | rtouch_compute_calibration (rtouch_calibration_point_t *points) |
Perform the calibration process using the provided points. More... | |
void | rtouch_disable (void) |
Disable the resistive touch service. More... | |
void | rtouch_enable (void) |
Enable the resistive touch service for touch detection and sampling. More... | |
rtouch_event_handler_t | rtouch_get_event_handler (void) |
Get the touch event handler. More... | |
uint32_t | rtouch_init (const uint32_t ul_width, const uint32_t ul_height) |
Initialize the resistive touch service. More... | |
void | rtouch_process (void) |
Core function for resistive touch service. More... | |
void | rtouch_set_calibration_parameter (int32_t xslope, int32_t yslope, int32_t rawx, int32_t rawy) |
Set calibration parameters when manual calibration procedure is not performed. More... | |
void | rtouch_set_event_handler (rtouch_event_handler_t handler) |
Set the touch event handler. More... | |
void | rtouch_wait_pressed (void) |
Wait touch pressed. More... | |
void | rtouch_wait_released (void) |
Wait touch released. More... | |
typedef struct rtouch_calibration_point_struct rtouch_calibration_point_t |
Storage structure for calibration point (actual and raw positions).
typedef struct rtouch_calibration_points_struct rtouch_calibration_points_t |
Collection of the five calibration points required to compute calibration.
typedef void(* rtouch_event_handler_t)(rtouch_event_t const *event) |
typedef struct rtouch_event_struct rtouch_event_t |
User touch event structure.
typedef enum rtouch_event_type_enum rtouch_event_type_t |
Touch events enumeration.
typedef struct rtouch_point_struct rtouch_point_t |
Point definition.
uint32_t rtouch_compute_calibration | ( | rtouch_calibration_point_t * | points | ) |
Perform the calibration process using the provided points.
points | Calibration and raw points. |
Calculate slopes using the calibration data Theory behind those calculations:
Backup calibration point 0, used for point processing
Check resulting x and y
Check calibration result
References MULTI_FACTOR, rtouch_calibration_point_struct::panel, POINTS_MAX_ERROR, rtouch_calibration_point_struct::raw, rtouch_get_calibrated_point(), rtouch_point_struct::x, and rtouch_point_struct::y.
Referenced by rtouch_calibrate().
void rtouch_disable | ( | void | ) |
Disable the resistive touch service.
Touch interrupt will be disabled as well.
References rtouch_disable_pen_interrupt().
void rtouch_enable | ( | void | ) |
Enable the resistive touch service for touch detection and sampling.
References rtouch_enable_pen_interrupt().
Referenced by main().
rtouch_event_handler_t rtouch_get_event_handler | ( | void | ) |
Get the touch event handler.
References event_handler.
uint32_t rtouch_init | ( | const uint32_t | ul_width, |
const uint32_t | ul_height | ||
) |
Initialize the resistive touch service.
ul_width | The panel width in pixels. |
ul_height | The panel height in pixels. |
References rtouch_init_device.
Referenced by main().
void rtouch_process | ( | void | ) |
Core function for resistive touch service.
Get the current position of the pen if penIRQ has low value (pen pressed)
Get the current position of the pressed pen
call the callback function
Filter move event if the move is too low
Determine the pen state
Touch pressed: reinit the last time when release
pen is pressed during an enough time : the state change
call the callback function
Touch released: reinit the last time when release
pen is pressed during an enough time : the state change
call the callback function
References DEBOUNCE_TIME, event_handler, g_ul_timepress, g_ul_timerelease, g_ul_timestamp, rtouch_event_struct::panel, POINTS_MAX_ERROR, rtouch_event_struct::raw, rtouch_get_calibrated_point(), rtouch_get_raw_point, rtouch_is_calibrated(), rtouch_is_pressed, RTOUCH_MOVE, RTOUCH_PRESS, RTOUCH_RELEASE, STATE_PEN_DEBOUNCE, STATE_PEN_PRESSED, STATE_PEN_RELEASED, rtouch_point_struct::x, and rtouch_point_struct::y.
Referenced by SysTick_Handler().
void rtouch_set_calibration_parameter | ( | int32_t | xslope, |
int32_t | yslope, | ||
int32_t | rawx, | ||
int32_t | rawy | ||
) |
Set calibration parameters when manual calibration procedure is not performed.
References rtouch_calibration_point_struct::raw, rtouch_point_struct::x, and rtouch_point_struct::y.
void rtouch_set_event_handler | ( | rtouch_event_handler_t | handler | ) |
Set the touch event handler.
handler | Pointer to the touch event handler, or NULL to disable the handler. |
This needs to be an atomic operation, in case an interrupt fires while we change the handler. ENTER_CRITICAL_SECTION( SET_HANDLER );
LEAVE_CRITICAL_SECTION( SET_HANDLER );
Referenced by main().
void rtouch_wait_pressed | ( | void | ) |
Wait touch pressed.
Wait for touch & end of conversion
References STATE_PEN_PRESSED, and STATE_PEN_RELEASED.
Referenced by rtouch_calibrate().
void rtouch_wait_released | ( | void | ) |
Wait touch released.
Wait for contact loss
References STATE_PEN_PRESSED, and STATE_PEN_RELEASED.
Referenced by rtouch_calibrate().