mikroSDK Reference Manual
|
TP_MIKROE Touch Controller Driver API Reference. More...
Data Structures | |
struct | tp_mikroe_calibration_data_t |
Calibration data structure. More... | |
struct | tp_mikroe_pressure_threshold_t |
Pressure threshold data structure. More... | |
struct | tp_mikroe_cfg_t |
TP_MIKROE Configuration Object. More... | |
struct | tp_mikroe_t |
TP_MIKROE Context Object. More... | |
Macros | |
#define | VREF_VALUE 3.3f |
Defines value for vref. | |
#define | TP_MIKROE_CALIBRATION_XMIN 0 |
#define | TP_MIKROE_CALIBRATION_XMAX 0 |
#define | TP_MIKROE_CALIBRATION_YMIN 0 |
#define | TP_MIKROE_CALIBRATION_YMAX 0 |
#define | TP_MIKROE_PRESSURE_THRESHOLD_LOWER 0 |
#define | TP_MIKROE_PRESSURE_THRESHOLD_UPPER 0 |
#define | TP_MIKROE_MAP_PINS(tp_mikroe_cfg) |
Mapping for ADC config structure. | |
#define | TP_MIKROE_ADC_CONFIG(cfg) |
#define | SET_PEN() gl_set_pen( GL_WHITE, 4 ); |
Macros used to draw arrows during tp_mikroe_calibration. | |
#define | DRAW_ARROW_TOP_LEFT() |
#define | DRAW_ARROW_TOP_RIGHT() |
#define | DRAW_ARROW_BOTTOM_LEFT() |
#define | DRAW_ARROW_BOTTOM_RIGHT() |
Functions list | |
tp_err_t | tp_mikroe_process (tp_mikroe_t *ctx) |
Function processing events. | |
void | tp_mikroe_gesture (tp_mikroe_t *ctx, tp_event_t *event) |
Read gesture information. | |
tp_event_t | tp_mikroe_press_detect (tp_mikroe_t *ctx) |
Press detection function. | |
void | tp_mikroe_press_coordinates (tp_mikroe_t *ctx, tp_touch_coord_t *touch_item) |
Copies touch information from context object to touch item object. | |
void | tp_mikroe_calibrate (tp_t *tp_instance) |
Calibrates variables used for converting raw TP_MIKROE ADC values to pixel coordinates. | |
void | tp_mikroe_get_calibration_data (tp_mikroe_t *ctx, tp_mikroe_calibration_data_t *cdata) |
Utility function used for getting a copy of current calibration data. | |
void | tp_mikroe_set_calibration_data (tp_mikroe_t *ctx, const tp_mikroe_calibration_data_t *cdata) |
Utility function used for setting calibration data. | |
void | tp_mikroe_set_pressure_threshold_level (tp_mikroe_cfg_t *cfg, tp_mikroe_pressure_threshold_t pressure) |
Utility function used for setting threshold levels. | |
bool | tp_mikroe_check_pressure (tp_mikroe_t *ctx, uint16_t *x_pos, uint16_t *y_pos) |
Function for reading raw ADC data. | |
void | tp_mikroe_set_threshold (tp_mikroe_t *ctx, uint16_t threshold_upper, uint16_t threshold_lower) |
Utility function used for setting threshold levels. | |
void | tp_mikroe_update_ctx_coords (tp_mikroe_t *ctx, uint16_t x_pos, uint16_t y_pos) |
Converts x_pos & y_pos raw ADC values to coordinate values and stores them in 'touch point 0' ctx member. | |
void | tp_mikroe_calibrate_point (tp_mikroe_t *ctx, bool calibration_points_uninitialized) |
Utility function used for calibration. | |
char | tp_mikroe_pressure_level_detect (tp_mikroe_t *ctx) |
Function used for checking pressure levels. | |
void | tp_mikroe_cfg_setup (tp_mikroe_cfg_t *cfg) |
TP_MIKROE Configuration setup Function. | |
tp_err_t | tp_mikroe_init_tp (tp_mikroe_t *ctx, tp_mikroe_cfg_t *cfg, tp_drv_t *drv) |
TP_MIKROE Touch Panel initialization. This function initializes TP_MIKROE context object using configuration values from TP_MIKROE configuration object and allows touch panel driver interface object to be linked with TP_MIKROE driver functions. | |
void | tp_mikroe_default_cfg_adc (tp_mikroe_t *ctx) |
TP_MIKROE ADC pin configuration function. | |
#define DRAW_ARROW_BOTTOM_LEFT | ( | ) |
#define DRAW_ARROW_BOTTOM_RIGHT | ( | ) |
#define DRAW_ARROW_TOP_LEFT | ( | ) |
#define DRAW_ARROW_TOP_RIGHT | ( | ) |
#define TP_MIKROE_ADC_CONFIG | ( | cfg | ) |
#define TP_MIKROE_MAP_PINS | ( | tp_mikroe_cfg | ) |
void tp_mikroe_calibrate | ( | tp_t * | tp_instance | ) |
Function needs the user to touch all four corners as close to the edges as possible to find the extreme values.
[in] | *tp_instance | TP instance. See tp_mikroe_t for more information about the context structure. |
Nothing. |
void tp_mikroe_calibrate_point | ( | tp_mikroe_t * | ctx, |
bool | calibration_points_uninitialized ) |
Uses tp_mikroe_check_pressure to get raw coordinates and if any of the coordinates passes extreme value updates min_x/max_x/min_y/max_y. If callibration_points_uninitialized
is true then initializes ts extremes with read values.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | calibration_points_uninitialized | Initial point or not. |
calibration_points_uninitialized
should be true only for the first point. Nothing. |
void tp_mikroe_cfg_setup | ( | tp_mikroe_cfg_t * | cfg | ) |
Sets ADC configuration structure to appropriate values.
[in] | cfg | TP_MIKROE configuration object. See tp_mikroe_cfg_t structure definition for detailed explanation. |
Nothing. |
bool tp_mikroe_check_pressure | ( | tp_mikroe_t * | ctx, |
uint16_t * | x_pos, | ||
uint16_t * | y_pos ) |
Function reads X, Y data and checks if adequate pressure has been applied to the screen.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | x_pos | Pointer to where X AD conversion result will be placed. |
[in] | y_pos | Pointer to where Y AD conversion result will be placed. |
b True(1) or False(0) based on pressure level.
void tp_mikroe_default_cfg_adc | ( | tp_mikroe_t * | ctx | ) |
Sets ADC pins to appropriate values.
[in] | ctx | TP_MIKROE context object. See tp_mikroe_t structure definition for detailed explanation. |
Nothing. |
void tp_mikroe_gesture | ( | tp_mikroe_t * | ctx, |
tp_event_t * | event ) |
Since TP_MIKROE does not support gestures this function is purely for interfacing with the tp library. Gesture returned from the function is always no gesture.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | event | Touch panel gesture data, always TP_EVENT_GEST_NONE. See tp_event_t * definition for detailed explanation. |
Nothing. |
void tp_mikroe_get_calibration_data | ( | tp_mikroe_t * | ctx, |
tp_mikroe_calibration_data_t * | cdata ) |
Function copies data that's being used for converting raw ADC values to actual pixel coordinates.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more |
[in] | cdata | Pointer to memory where calibration data will be stored. |
Nothing. |
tp_err_t tp_mikroe_init_tp | ( | tp_mikroe_t * | ctx, |
tp_mikroe_cfg_t * | cfg, | ||
tp_drv_t * | drv ) |
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | cfg | TP_MIKROE configuration object. See tp_mikroe_cfg_t structure definition for detailed explanation. |
[in] | drv | TP driver interface object. See tp_drv_t structure definition for detailed explanation. |
li TP_OK
OK, See tp_err_t structure definition for detailed explanation.
void tp_mikroe_press_coordinates | ( | tp_mikroe_t * | ctx, |
tp_touch_coord_t * | touch_item ) |
tp_event_t tp_mikroe_press_detect | ( | tp_mikroe_t * | ctx | ) |
Retrieves information about press detection from TP_MIKROE.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
li TP_EVENT_PRESS_NOT_DET
- Touch pressure is not detected.
TP_EVENT_PRESS_DET
- Touch pressure is detected. See tp_err_t structure definition for detailed explanation. char tp_mikroe_pressure_level_detect | ( | tp_mikroe_t * | ctx | ) |
Function reads raw ADC value and checks if it's between lower and upper pressure threshold.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more |
True | if press is detected, False if not. |
tp_err_t tp_mikroe_process | ( | tp_mikroe_t * | ctx | ) |
This function checks if touch was detected and if it was, reads and stores touch information in context structure and checks if it's touch down or up.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
Always | returns TP_OK. see tp_err_t for more details. |
void tp_mikroe_set_calibration_data | ( | tp_mikroe_t * | ctx, |
const tp_mikroe_calibration_data_t * | cdata ) |
Function copies data stored in cdata
. That information will be be used for converting raw ADC values to actual pixel coordinates.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | cdata | Pointer to memory from where new calibration will be copied and set. |
Nothing. |
void tp_mikroe_set_pressure_threshold_level | ( | tp_mikroe_cfg_t * | cfg, |
tp_mikroe_pressure_threshold_t | pressure ) |
Function copies data stored in pressure
. That information will be be used for checking if adequate pressure has been applied to the screen.
[in] | cfg | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | pressure | Structure with desired threshold levels set. See tp_mikroe_pressure_threshold_t for more information about the structure. |
Nothing. |
void tp_mikroe_set_threshold | ( | tp_mikroe_t * | ctx, |
uint16_t | threshold_upper, | ||
uint16_t | threshold_lower ) |
[in] | cfx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | threshold_upper | Desired upper threshold level. |
[in] | threshold_lower | Desired lower threshold level. |
Nothing. |
void tp_mikroe_update_ctx_coords | ( | tp_mikroe_t * | ctx, |
uint16_t | x_pos, | ||
uint16_t | y_pos ) |
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[in] | x_pos | X coordinate ADC value. |
[in] | y_pos | Y coordinate ADC value. |
Nothing. |