73#define VREF_VALUE 3.3f
75#ifndef TP_MIKROE_CALIBRATION_XMIN
76#define TP_MIKROE_CALIBRATION_XMIN 0
78#ifndef TP_MIKROE_CALIBRATION_XMAX
79#define TP_MIKROE_CALIBRATION_XMAX 0
82#ifndef TP_MIKROE_CALIBRATION_YMIN
83#define TP_MIKROE_CALIBRATION_YMIN 0
85#ifndef TP_MIKROE_CALIBRATION_YMAX
86#define TP_MIKROE_CALIBRATION_YMAX 0
89#ifndef TP_MIKROE_PRESSURE_THRESHOLD_LOWER
90#define TP_MIKROE_PRESSURE_THRESHOLD_LOWER 0
92#ifndef TP_MIKROE_PRESSURE_THRESHOLD_UPPER
93#define TP_MIKROE_PRESSURE_THRESHOLD_UPPER 0
99#define TP_MIKROE_MAP_PINS( tp_mikroe_cfg ) \
100 tp_mikroe_cfg.left = TP_MIKROE_XL;\
101 tp_mikroe_cfg.right = TP_MIKROE_XR;\
102 tp_mikroe_cfg.up = TP_MIKROE_YU;\
103 tp_mikroe_cfg.down = TP_MIKROE_YD;
149#define TP_MIKROE_ADC_CONFIG( cfg ) \
150 cfg->analog_in_cfg_read_x.resolution = ANALOG_IN_RESOLUTION_CMAKE; \
151 cfg->analog_in_cfg_read_y.resolution = ANALOG_IN_RESOLUTION_CMAKE; \
152 cfg->analog_in_cfg_read_x.input_pin = TP_READ_X_CMAKE; \
153 cfg->analog_in_cfg_read_y.input_pin = TP_READ_Y_CMAKE; \
154 cfg->analog_in_cfg_read_x.vref_input = ANALOG_IN_VREF_CMAKE; \
155 cfg->analog_in_cfg_read_y.vref_input = ANALOG_IN_VREF_CMAKE; \
156 cfg->analog_in_cfg_read_x.vref_value = VREF_VALUE; \
157 cfg->analog_in_cfg_read_y.vref_value = VREF_VALUE;
193 gl_set_pen( GL_WHITE, 4 );
195#define DRAW_ARROW_TOP_LEFT() \
196 gl_clear( GL_BLACK ); \
197 gl_draw_line( 0, 0, 10, 0 ); \
198 gl_draw_line( 0, 0, 0, 10 ); \
199 gl_draw_line( 0, 0, 15, 15 );
201#define DRAW_ARROW_TOP_RIGHT() \
202 gl_clear( GL_BLACK ); \
203 gl_draw_line( 320, 0, 320, 10 ); \
204 gl_draw_line( 320, 0, 310, 0 ); \
205 gl_draw_line( 320, 0, 305, 15 );
207#define DRAW_ARROW_BOTTOM_LEFT() \
208 gl_clear( GL_BLACK ); \
209 gl_draw_line( 0, 240, 0, 230 ); \
210 gl_draw_line( 0, 240, 10, 240 ); \
211 gl_draw_line( 0, 240, 15, 225 );
213#define DRAW_ARROW_BOTTOM_RIGHT() \
214 gl_clear( GL_BLACK ); \
215 gl_draw_line( 320, 240, 320, 230 ); \
216 gl_draw_line( 320, 240, 310, 240 ); \
217 gl_draw_line( 320, 240, 305, 225 );
API for Analog input driver.
API for Digital input driver.
API for Digital output driver.
hal_pin_name_t pin_name_t
Definition drv_name.h:74
mikroSDK Graphic Library API.
void tp_mikroe_gesture(tp_mikroe_t *ctx, tp_event_t *event)
Read gesture information.
tp_err_t tp_mikroe_process(tp_mikroe_t *ctx)
Function processing events.
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.
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 mem...
void tp_mikroe_set_calibration_data(tp_mikroe_t *ctx, const tp_mikroe_calibration_data_t *cdata)
Utility function used for setting calibration data.
tp_event_t tp_mikroe_press_detect(tp_mikroe_t *ctx)
Press detection function.
void tp_mikroe_default_cfg_adc(tp_mikroe_t *ctx)
TP_MIKROE ADC pin configuration function.
char tp_mikroe_pressure_level_detect(tp_mikroe_t *ctx)
Function used for checking pressure levels.
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_calibrate(tp_t *tp_instance)
Calibrates variables used for converting raw TP_MIKROE ADC values to pixel coordinates.
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_cfg_setup(tp_mikroe_cfg_t *cfg)
TP_MIKROE Configuration setup 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_get_calibration_data(tp_mikroe_t *ctx, tp_mikroe_calibration_data_t *cdata)
Utility function used for getting a copy of current calibration data.
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 config...
void tp_mikroe_calibrate_point(tp_mikroe_t *ctx, bool calibration_points_uninitialized)
Utility function used for calibration.
Analog input driver configuration structure.
Definition drv_analog_in.h:108
Analog input driver context structure, consisted of the following fields :
Definition drv_analog_in.h:128
Touch Panel Driver Interface Items.
Definition tp.h:199
Calibration data structure.
Definition tp_mikroe.h:109
uint16_t max_x
Definition tp_mikroe.h:113
uint16_t min_x
Definition tp_mikroe.h:111
uint16_t min_y
Definition tp_mikroe.h:115
TP_MIKROE Configuration Object.
Definition tp_mikroe.h:133
pin_name_t down
Definition tp_mikroe.h:137
analog_in_config_t analog_in_cfg_read_x
Definition tp_mikroe.h:139
pin_name_t right
Definition tp_mikroe.h:135
pin_name_t left
Definition tp_mikroe.h:134
pin_name_t up
Definition tp_mikroe.h:136
uint16_t height
Definition tp_mikroe.h:146
analog_in_config_t analog_in_cfg_read_y
Definition tp_mikroe.h:140
uint16_t width
Definition tp_mikroe.h:145
Pressure threshold data structure.
Definition tp_mikroe.h:124
uint16_t tp_mikroe_pressure_threshold_upper
Definition tp_mikroe.h:126
uint16_t tp_mikroe_pressure_threshold_lower
Definition tp_mikroe.h:125
TP_MIKROE Context Object.
Definition tp_mikroe.h:163
analog_in_t analog_in_x
Definition tp_mikroe.h:169
tp_event_t gesture
Definition tp_mikroe.h:174
pin_name_t up
Definition tp_mikroe.h:166
pin_name_t left
Definition tp_mikroe.h:164
tp_touch_coord_t touch
Definition tp_mikroe.h:173
uint16_t width
Definition tp_mikroe.h:185
bool pen_down
Definition tp_mikroe.h:177
tp_mikroe_pressure_threshold_t pressure_threshold_level
Definition tp_mikroe.h:180
pin_name_t down
Definition tp_mikroe.h:167
analog_in_t analog_in_y
Definition tp_mikroe.h:170
tp_rotate_t rotate
Definition tp_mikroe.h:175
pin_name_t right
Definition tp_mikroe.h:165
tp_event_t press_det
Definition tp_mikroe.h:172
uint16_t height
Definition tp_mikroe.h:186
Touch Panel Context Object.
Definition tp.h:224
Touch Point Object Definition.
Definition tp.h:137
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:81
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:65
tp_rotate_t
Touch Panel Placement (Orientation) Definition.
Definition tp.h:117