mikroSDK Reference Manual
tp_mikroe.h File Reference

Go to the source code of this file.

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 voltage reference. More...
 
#define TP_MIKROE_CALIBRATION_XMIN   0
 X coordinate of the bottom left corner of the touch panel area. More...
 
#define TP_MIKROE_CALIBRATION_XMAX   0
 X coordinate of the upper right corner of the touch panel area. More...
 
#define TP_MIKROE_CALIBRATION_YMIN   0
 Y coordinate of the bottom left corner of the touch panel area. More...
 
#define TP_MIKROE_CALIBRATION_YMAX   0
 Y coordinate of the upper right corner of the touch panel area. More...
 
#define TP_MIKROE_PRESSURE_THRESHOLD_LOWER   0
 Lower threshold value. More...
 
#define TP_MIKROE_PRESSURE_THRESHOLD_UPPER   0
 Upper threshold value. More...
 
#define TP_MIKROE_MAP_PINS(tp_mikroe_cfg)
 Mapping for ADC config structure. More...
 
#define TP_MIKROE_ADC_CONFIG(cfg)
 TP_MIKROE ADC Configuration Object. More...
 
#define SET_PEN()   gl_set_pen( GL_WHITE, 4 );
 Configure pen for drawing arrows during touch panel calibration. More...
 
#define DRAW_ARROW_TOP_LEFT()
 Draw top left arrow during touch panel calibration. More...
 
#define DRAW_ARROW_TOP_RIGHT()
 Draw top right arrow during touch panel calibration. More...
 
#define DRAW_ARROW_BOTTOM_LEFT()
 Draw bottom left arrow during touch panel calibration. More...
 
#define DRAW_ARROW_BOTTOM_RIGHT()
 Draw bottom right arrow during touch panel calibration. More...
 

Functions

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...
 

Macro Definition Documentation

◆ VREF_VALUE

#define VREF_VALUE   3.3f

Defines value for voltage reference.

◆ TP_MIKROE_CALIBRATION_XMIN

#define TP_MIKROE_CALIBRATION_XMIN   0

X coordinate of the bottom left corner of the touch panel area.

◆ TP_MIKROE_CALIBRATION_XMAX

#define TP_MIKROE_CALIBRATION_XMAX   0

X coordinate of the upper right corner of the touch panel area.

◆ TP_MIKROE_CALIBRATION_YMIN

#define TP_MIKROE_CALIBRATION_YMIN   0

Y coordinate of the bottom left corner of the touch panel area.

◆ TP_MIKROE_CALIBRATION_YMAX

#define TP_MIKROE_CALIBRATION_YMAX   0

Y coordinate of the upper right corner of the touch panel area.

◆ TP_MIKROE_PRESSURE_THRESHOLD_LOWER

#define TP_MIKROE_PRESSURE_THRESHOLD_LOWER   0

Lower threshold value.

◆ TP_MIKROE_PRESSURE_THRESHOLD_UPPER

#define TP_MIKROE_PRESSURE_THRESHOLD_UPPER   0

Upper threshold value.

◆ TP_MIKROE_MAP_PINS

#define TP_MIKROE_MAP_PINS (   tp_mikroe_cfg)
Value:
tp_mikroe_cfg.left = TP_MIKROE_XL;\
tp_mikroe_cfg.right = TP_MIKROE_XR;\
tp_mikroe_cfg.up = TP_MIKROE_YU;\
tp_mikroe_cfg.down = TP_MIKROE_YD;

◆ TP_MIKROE_ADC_CONFIG

#define TP_MIKROE_ADC_CONFIG (   cfg)
Value:
cfg->analog_in_cfg_read_x.resolution = ANALOG_IN_RESOLUTION_CMAKE; \
cfg->analog_in_cfg_read_y.resolution = ANALOG_IN_RESOLUTION_CMAKE; \
cfg->analog_in_cfg_read_x.input_pin = TP_READ_X_CMAKE; \
cfg->analog_in_cfg_read_y.input_pin = TP_READ_Y_CMAKE; \
cfg->analog_in_cfg_read_x.vref_input = ANALOG_IN_VREF_CMAKE; \
cfg->analog_in_cfg_read_y.vref_input = ANALOG_IN_VREF_CMAKE; \
cfg->analog_in_cfg_read_x.vref_value = VREF_VALUE; \
cfg->analog_in_cfg_read_y.vref_value = VREF_VALUE;

ADC configuration object definition for TP_MIKROE touch controller.

◆ SET_PEN

#define SET_PEN ( )    gl_set_pen( GL_WHITE, 4 );

Configure pen for drawing arrows during touch panel calibration.

◆ DRAW_ARROW_TOP_LEFT

#define DRAW_ARROW_TOP_LEFT ( )
Value:
gl_draw_line( 0, 0, 10, 0 ); \
gl_draw_line( 0, 0, 0, 10 ); \
gl_draw_line( 0, 0, 15, 15 );

Draw top left arrow during touch panel calibration.

◆ DRAW_ARROW_TOP_RIGHT

#define DRAW_ARROW_TOP_RIGHT ( )
Value:
gl_draw_line( 320, 0, 320, 10 ); \
gl_draw_line( 320, 0, 310, 0 ); \
gl_draw_line( 320, 0, 305, 15 );

Draw top right arrow during touch panel calibration.

◆ DRAW_ARROW_BOTTOM_LEFT

#define DRAW_ARROW_BOTTOM_LEFT ( )
Value:
gl_draw_line( 0, 240, 0, 230 ); \
gl_draw_line( 0, 240, 10, 240 ); \
gl_draw_line( 0, 240, 15, 225 );

Draw bottom left arrow during touch panel calibration.

◆ DRAW_ARROW_BOTTOM_RIGHT

#define DRAW_ARROW_BOTTOM_RIGHT ( )
Value:
gl_draw_line( 320, 240, 320, 230 ); \
gl_draw_line( 320, 240, 310, 240 ); \
gl_draw_line( 320, 240, 305, 225 );

Draw bottom right arrow during touch panel calibration.

VREF_VALUE
#define VREF_VALUE
Defines value for voltage reference.
Definition: tp_mikroe.h:63
gl_clear
void gl_clear(gl_color_t color)
Paint whole display.
GL_BLACK
Definition: gl_colors.h:99