mikroSDK Reference Manual
|
TP_MIKROE Touch Controller Driver API Reference. More...
Functions list | |
tp_err_t | tp_mikroe_process (tp_mikroe_t *ctx) |
Function processing events. More... | |
void | tp_mikroe_gesture (tp_mikroe_t *ctx, tp_event_t *event) |
Read gesture information. More... | |
tp_event_t | tp_mikroe_press_detect (tp_mikroe_t *ctx) |
Press detection function. More... | |
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. More... | |
void | tp_mikroe_calibrate (tp_t *tp_instance) |
Calibrates variables used for converting raw TP_MIKROE ADC values to pixel coordinates. More... | |
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. More... | |
void | tp_mikroe_set_calibration_data (tp_mikroe_t *ctx, const tp_mikroe_calibration_data_t *cdata) |
Utility function used for setting calibration data. More... | |
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. More... | |
bool | tp_mikroe_check_pressure (tp_mikroe_t *ctx, uint16_t *x_pos, uint16_t *y_pos) |
Function for reading raw ADC data. More... | |
void | tp_mikroe_set_threshold (tp_mikroe_t *ctx, uint16_t threshold_upper, uint16_t threshold_lower) |
Utility function used for setting threshold levels. More... | |
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. More... | |
void | tp_mikroe_calibrate_point (tp_mikroe_t *ctx, bool calibration_points_uninitialized) |
Utility function used for calibration. More... | |
char | tp_mikroe_pressure_level_detect (tp_mikroe_t *ctx) |
Function used for checking pressure levels. More... | |
void | tp_mikroe_cfg_setup (tp_mikroe_cfg_t *cfg) |
TP_MIKROE Configuration setup Function. More... | |
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. More... | |
void | tp_mikroe_default_cfg_adc (tp_mikroe_t *ctx) |
TP_MIKROE ADC pin configuration function. More... | |
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_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. |
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. |
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. void tp_mikroe_press_coordinates | ( | tp_mikroe_t * | ctx, |
tp_touch_coord_t * | touch_item | ||
) |
This function is necessary for interfacing with touch panel library as it's address is stored in tp_drv_t driver structure during the TP_MIKROE context initialization.
[in] | ctx | Initialized TP_MIKROE context structure. See tp_mikroe_t for more information about the context structure. |
[out] | touch_item | : Touch item data. See tp_touch_coord_t structure definition for detailed explanation. |
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. |
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. |
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. |
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. |
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. |
void tp_mikroe_set_threshold | ( | tp_mikroe_t * | ctx, |
uint16_t | threshold_upper, | ||
uint16_t | threshold_lower | ||
) |
[in] | ctx | 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. |
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. |
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. 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 |
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. |
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. |
TP_OK
OK See tp_err_t structure definition for detailed explanation. 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. |