mikroSDK Reference Manual
tp.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2024 MikroElektronika d.o.o.
4** Contact: https://www.mikroe.com/contact
5**
6** This file is part of the mikroSDK package
7**
8** Commercial License Usage
9**
10** Licensees holding valid commercial NECTO compilers AI licenses may use this
11** file in accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The MikroElektronika Company.
14** For licensing terms and conditions see
15** https://www.mikroe.com/legal/software-license-agreement.
16** For further information use the contact form at
17** https://www.mikroe.com/contact.
18**
19**
20** GNU Lesser General Public License Usage
21**
22** Alternatively, this file may be used for
23** non-commercial projects under the terms of the GNU Lesser
24** General Public License version 3 as published by the Free Software
25** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
26**
27** The above copyright notice and this permission notice shall be
28** included in all copies or substantial portions of the Software.
29**
30** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
34** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
36** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37**
38****************************************************************************/
39
48#ifndef _TP_H_
49#define _TP_H_
50
51#include <stdint.h>
52#include <stddef.h>
53
58#define TP_N_TOUCHES_MAX 5
59
75
96
111
124
130typedef uint16_t tp_coord_t;
131
144
150typedef struct
151{
153 uint8_t n_touches;
156
161typedef tp_event_t ( * tp_press_det_t )( void * );
162
167typedef void ( * tp_press_coord_t )( void *, tp_touch_item_t * );
168
173typedef void ( * tp_gesture_t )( void *, tp_event_t * );
174
179typedef tp_err_t ( * tp_process_t )( void * );
180
187
192typedef void ( * tp_gesture_callback_t )( tp_event_t );
193
206
211typedef struct
212{
213 uint16_t width;
214 uint16_t height;
217} tp_cfg_t;
218
223typedef struct
224{
225 // Touch panel interface.
226
228 void * tp_drv_ctx;
233 // Touch panel size and orientation.
234
235 uint16_t width;
236 uint16_t height;
237 uint16_t coord_x_max;
238 uint16_t coord_y_max;
240 uint8_t curr_pos;
243 // Touch panel current and previous data.
244
252 uint8_t release;
254} tp_t;
255
268#ifdef __cplusplus
269extern "C"{
270#endif
271
291void
293
345tp_init( tp_t * ctx, tp_cfg_t * cfg, tp_drv_t * drv, void * drv_ctx );
346
370void
372
395void
397
416void
417tp_rotate( tp_t * ctx, tp_rotate_t rotate );
418
440
461void
462tp_get_size( tp_t * ctx, uint16_t * width, uint16_t * height );
463
488
518
541void
542tp_gesture( tp_t * ctx, tp_event_t * event );
543
572
573#ifdef __cplusplus
574}
575#endif
576#endif // _TP_H_
577
578 // tpgroup
579 // apigroup
580
581// ------------------------------------------------------------------------ END
void tp_rotate(tp_t *ctx, tp_rotate_t rotate)
Touch Panel Rotate Function.
tp_err_t tp_init(tp_t *ctx, tp_cfg_t *cfg, tp_drv_t *drv, void *drv_ctx)
Touch Panel Initialization Function.
tp_event_t tp_press_detect(tp_t *ctx)
Touch Panel Pressure Detector Function.
void tp_gesture_callback_setup(tp_t *ctx, tp_gesture_callback_t cb)
Touch Panel Callback Setup Function.
void tp_gesture(tp_t *ctx, tp_event_t *event)
Touch Panel Gesture Check Function.
void tp_get_size(tp_t *ctx, uint16_t *width, uint16_t *height)
Touch Panel Size Check Function.
tp_err_t tp_press_coordinates(tp_t *ctx, tp_touch_coord_t *touch_item)
Touch Panel Pressure Coordinates Check Function.
void tp_cfg_setup(tp_cfg_t *cfg)
Touch Panel Configuration Function.
tp_rotate_t tp_get_orientation(tp_t *ctx)
Touch Panel Orientation Check Function.
void tp_press_callback_setup(tp_t *ctx, tp_press_callback_t cb)
Touch Panel Callback Setup Function.
tp_err_t tp_process(tp_t *ctx)
Touch Panel Process Function.
Touch Panel Size And Placement Configuration Object.
Definition tp.h:212
uint16_t height
Definition tp.h:214
uint16_t width
Definition tp.h:213
tp_rotate_t start_pos
Definition tp.h:215
Touch Panel Driver Interface Items.
Definition tp.h:199
tp_press_coord_t tp_press_coordinates_f
Definition tp.h:201
tp_gesture_t tp_gesture_f
Definition tp.h:202
tp_press_det_t tp_press_detect_f
Definition tp.h:200
tp_process_t tp_process_f
Definition tp.h:203
Touch Panel Context Object.
Definition tp.h:224
tp_gesture_callback_t gesture_callback_f
Definition tp.h:231
tp_rotate_t start_pos
Definition tp.h:239
tp_event_t gesture
Definition tp.h:246
tp_touch_item_t touch_prev
Definition tp.h:248
tp_touch_item_t touch
Definition tp.h:245
uint16_t coord_x_max
Definition tp.h:237
tp_event_t gesture_prev
Definition tp.h:249
tp_rotate_t rotate
Definition tp.h:241
uint8_t release
Definition tp.h:252
uint16_t width
Definition tp.h:235
tp_touch_item_t touch_prev_mirr
Definition tp.h:250
uint16_t coord_y_max
Definition tp.h:238
void * tp_drv_ctx
Definition tp.h:228
tp_drv_t * tp_drv
Definition tp.h:227
uint16_t height
Definition tp.h:236
tp_press_callback_t press_callback_f
Definition tp.h:230
uint8_t curr_pos
Definition tp.h:240
Touch Point Object Definition.
Definition tp.h:137
tp_event_t event
Definition tp.h:140
tp_coord_t coord_y
Definition tp.h:139
tp_coord_t coord_x
Definition tp.h:138
tp_touch_id_t id
Definition tp.h:141
Touch Item Definition.
Definition tp.h:151
uint8_t n_touches
Definition tp.h:153
void(* tp_gesture_callback_t)(tp_event_t)
Touch Panel Gesture Callback Function.
Definition tp.h:192
#define TP_N_TOUCHES_MAX
Touch Panel Touch Limit.
Definition tp.h:58
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:81
@ TP_EVENT_GEST_UP
Definition tp.h:90
@ TP_EVENT_GEST_ZOOM_OUT
Definition tp.h:93
@ TP_EVENT_GEST_RIGHT
Definition tp.h:89
@ TP_EVENT_GEST_LEFT
Definition tp.h:88
@ TP_EVENT_GEST_DOWN
Definition tp.h:91
@ TP_EVENT_GEST_ZOOM_IN
Definition tp.h:92
@ TP_EVENT_GEST_NONE
Definition tp.h:87
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:65
@ TP_ERR_N_DATA
Definition tp.h:72
@ TP_ERR_N_TOUCHES
Definition tp.h:71
tp_rotate_t
Touch Panel Placement (Orientation) Definition.
Definition tp.h:117
@ TP_TOUCH_ID_4
Definition tp.h:107
@ TP_TOUCH_ID_3
Definition tp.h:106
@ TP_TOUCH_ID_1
Definition tp.h:104
@ TP_TOUCH_ID_2
Definition tp.h:105
@ TP_TOUCH_ID_5
Definition tp.h:108
@ TP_TOUCH_ID_0
Definition tp.h:103
void(* tp_gesture_t)(void *, tp_event_t *)
Touch Panel Driver Interface Definition.
Definition tp.h:173
tp_event_t(* tp_press_det_t)(void *)
Touch Panel Driver Interface Definition.
Definition tp.h:118
tp_err_t(* tp_process_t)(void *)
Touch Panel Driver Interface Definition.
Definition tp.h:130
uint16_t tp_coord_t
Touch Point Coordinates Data Type.
Definition tp.h:101
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:69
@ TP_EVENT_PRESS_NOT_DET
Definition tp.h:73
@ TP_EVENT_PRESS_DOWN
Definition tp.h:70
@ TP_EVENT_PRESS_MOVE
Definition tp.h:72
@ TP_EVENT_PRESS_DET
Definition tp.h:74
@ TP_EVENT_PRESS_UP
Definition tp.h:71
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:57
@ TP_ERR_INIT_DRV
Definition tp.h:59
@ TP_ERR_UNSUPPORTED_PIN
Definition tp.h:60
@ TP_ERR_SIZE
Definition tp.h:61
@ TP_ERR_PRESS_COORD
Definition tp.h:62
@ TP_OK
Definition tp.h:58
void(* tp_press_coord_t)(void *, tp_touch_coord_t *)
Touch Panel Driver Interface Definition.
Definition tp.h:124
void(* tp_press_callback_t)(tp_event_t, tp_coord_t, tp_coord_t, tp_touch_id_t)
Touch Panel Touch Callback Function.
Definition tp.h:136
tp_rotate_t
Touch Panel Placement (Orientation) Definition.
Definition tp.h:89
@ TP_ROTATE_270
Definition tp.h:93
@ TP_ROTATE_180
Definition tp.h:92
@ TP_ROTATE_90
Definition tp.h:91
@ TP_ROTATE_0
Definition tp.h:90
tp_touch_id_t
Touch Point ID Definition.
Definition tp.h:81