This driver offers resistive touch measurements by using the on-chip ADC.
In addition it offers calibration and a callback function for the application.
To improve the overall results four ADC channels are used to measure the touch position. That means the measurements are done from each direction of the touch surface.
Data Structures | |
struct | rtouch_calibration_matrix_struct |
Calibration matrix coefficients, computed from three calibration points. More... | |
struct | rtouch_calibration_point_struct |
Info for one calibration point, raw samples and actual panel position. More... | |
struct | rtouch_calibration_points_struct |
Collection of the three calibration points required to compute calibration. More... | |
struct | rtouch_event_struct |
User-friendly touch event structure. More... | |
Typedefs | |
typedef struct rtouch_calibration_matrix_struct | rtouch_calibration_matrix_t |
Calibration matrix coefficients, computed from three calibration points. More... | |
typedef struct rtouch_calibration_point_struct | rtouch_calibration_point_t |
Info for one calibration point, raw samples and actual panel position. More... | |
typedef struct rtouch_calibration_points_struct | rtouch_calibration_points_t |
Collection of the three calibration points required to compute calibration. More... | |
typedef void(* | rtouch_event_handler_t )(rtouch_event_t const *event) |
Type definition for a user touch event callback function. More... | |
typedef struct rtouch_event_struct | rtouch_event_t |
User-friendly touch event structure. More... | |
typedef enum rtouch_event_type_enum | rtouch_event_type_t |
Event type used by event struct rtouch_event_t. More... | |
Enumerations | |
enum | rtouch_event_type_enum { RTOUCH_NO_EVENT, RTOUCH_PRESS, RTOUCH_MOVE, RTOUCH_RELEASE } |
Event type used by event struct rtouch_event_t. More... | |
Functions | |
void | rtouch_compute_calibration_matrix (rtouch_calibration_points_t const *points, rtouch_calibration_matrix_t *matrix) |
Compute a raw coordinate to screen coordinate calibration matrix. More... | |
void | rtouch_disable (void) |
Disables the resistive touch screen driver. More... | |
void | rtouch_enable (void) |
Enables touch detection of the driver once initialized. More... | |
void | rtouch_get_calibration_matrix (rtouch_calibration_matrix_t *destination) |
Gets the currently set touch driver calibration matrix. More... | |
void | rtouch_get_event (rtouch_event_t *event) |
Retrieve the last touch event. More... | |
rtouch_event_handler_t | rtouch_get_event_handler (void) |
Gets the currently set touch screen event handler callback function. More... | |
void | rtouch_init (void) |
bool | rtouch_is_touched (void) |
Determine if the screen is currently being touched. More... | |
void | rtouch_set_calibration_matrix (rtouch_calibration_matrix_t const *source) |
Set the touch driver calibration matrix. More... | |
void | rtouch_set_event_handler (rtouch_event_handler_t handler) |
Set the touch screen event handler callback function. More... | |
typedef struct rtouch_calibration_matrix_struct rtouch_calibration_matrix_t |
Calibration matrix coefficients, computed from three calibration points.
typedef struct rtouch_calibration_point_struct rtouch_calibration_point_t |
Info for one calibration point, raw samples and actual panel position.
typedef struct rtouch_calibration_points_struct rtouch_calibration_points_t |
Collection of the three calibration points required to compute calibration.
typedef void(* rtouch_event_handler_t)(rtouch_event_t const *event) |
Type definition for a user touch event callback function.
typedef struct rtouch_event_struct rtouch_event_t |
User-friendly touch event structure.
typedef enum rtouch_event_type_enum rtouch_event_type_t |
Event type used by event struct rtouch_event_t.
Event type used by event struct rtouch_event_t.
Enumerator | |
---|---|
RTOUCH_NO_EVENT | |
RTOUCH_PRESS | |
RTOUCH_MOVE | |
RTOUCH_RELEASE |
void rtouch_compute_calibration_matrix | ( | rtouch_calibration_points_t const * | points, |
rtouch_calibration_matrix_t * | matrix | ||
) |
Compute a raw coordinate to screen coordinate calibration matrix.
This function computes a calibration matrix from a set of three calibration points provided by the caller. Use the raw sample values from the event struct when filling data into the calibration point struct. The calibration matrix will be copied into the struct also provided by the user. Use the rtouch_SetCalibrationMatrix() function to assign a calibration matrix to the driver.
points | Pointer to a calibration point set. |
matrix | Pointer to the struct where the matrix will be copied. |
References rtouch_calibration_matrix_struct::A, rtouch_calibration_matrix_struct::B, rtouch_calibration_matrix_struct::C, rtouch_calibration_matrix_struct::D, rtouch_calibration_matrix_struct::E, rtouch_calibration_matrix_struct::F, rtouch_calibration_matrix_struct::K, rtouch_calibration_point_struct::panelX, rtouch_calibration_point_struct::panelY, rtouch_calibration_points_struct::point1, rtouch_calibration_points_struct::point2, rtouch_calibration_points_struct::point3, rtouch_calibration_point_struct::rawX, and rtouch_calibration_point_struct::rawY.
void rtouch_disable | ( | void | ) |
Disables the resistive touch screen driver.
This function disables the driver, stopping all touch detection and sampling. This will save power.
References rtouch, rtouch_disable_adc_int(), rtouch_disable_detect_int(), RTOUCH_DISABLED, rtouch_ground_x_surface(), and rtouch_ground_y_surface().
Referenced by rtouch_init().
void rtouch_enable | ( | void | ) |
Enables touch detection of the driver once initialized.
This function enables the driver, resuming touch detecting and sampling.
References rtouch, rtouch_clear_adc_flag(), rtouch_clear_detect_flag(), RTOUCH_DISABLED, rtouch_enable_adc_int(), rtouch_enable_detect_int(), rtouch_ground_x_surface(), RTOUCH_NO_EVENT, RTOUCH_NOT_TOUCHED, and rtouch_pullup_y_surface().
void rtouch_get_calibration_matrix | ( | rtouch_calibration_matrix_t * | destination | ) |
Gets the currently set touch driver calibration matrix.
This function retrieves the current calibration matrix from the driver. Use this function to store a calibration matrix to e.g. EEPROM.
destination | Pointer to struct where matrix will be copied. |
References rtouch.
void rtouch_get_event | ( | rtouch_event_t * | event | ) |
Retrieve the last touch event.
This function will copy the last event information to a struct. The caller is responsible for providing memory.
event | Pointer to the struct where event will be copied. |
References rtouch.
rtouch_event_handler_t rtouch_get_event_handler | ( | void | ) |
Gets the currently set touch screen event handler callback function.
This function returns the old event handler. Use this to store the old handler while replacing it for a short while, e.g. for calibration.
References rtouch.
void rtouch_init | ( | void | ) |
bool rtouch_is_touched | ( | void | ) |
Determine if the screen is currently being touched.
This function returns true if the touch panel is currently touched.
true
if panel touched. References rtouch, RTOUCH_MOVE, and RTOUCH_PRESS.
void rtouch_set_calibration_matrix | ( | rtouch_calibration_matrix_t const * | source | ) |
Set the touch driver calibration matrix.
This function assigns a calibration matrix to the driver. The calibration matrix must be retained in RAM while the driver is used.
source | Pointer to matrix data. |
References rtouch.
void rtouch_set_event_handler | ( | rtouch_event_handler_t | handler | ) |
Set the touch screen event handler callback function.
This function sets a new touch event handler. The handler is called whenever the position or state of the touch screen changes.
handler | Pointer to new event handler, or NULL to disable handler. |
References rtouch.