mikroSDK Reference Manual
lv_hal_indev.h
Go to the documentation of this file.
1
8#ifndef LV_HAL_INDEV_H
9#define LV_HAL_INDEV_H
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/*********************
16 * INCLUDES
17 *********************/
18#include "../lv_conf_internal.h"
19
20#include <stdbool.h>
21#include <stdint.h>
22#include "../misc/lv_area.h"
23#include "../misc/lv_timer.h"
24
25/*********************
26 * DEFINES
27 *********************/
28
29/*Drag threshold in pixels*/
30#define LV_INDEV_DEF_SCROLL_LIMIT 10
31
32/*Drag throw slow-down in [%]. Greater value -> faster slow-down*/
33#define LV_INDEV_DEF_SCROLL_THROW 10
34
35/*Long press time in milliseconds.
36 *Time to send `LV_EVENT_LONG_PRESSSED`)*/
37#define LV_INDEV_DEF_LONG_PRESS_TIME 400
38
39/*Repeated trigger period in long press [ms]
40 *Time between `LV_EVENT_LONG_PRESSED_REPEAT*/
41#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
42
43
44/*Gesture threshold in pixels*/
45#define LV_INDEV_DEF_GESTURE_LIMIT 50
46
47/*Gesture min velocity at release before swipe (pixels)*/
48#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
49
50
51/**********************
52 * TYPEDEFS
53 **********************/
54
55struct _lv_obj_t;
56struct _lv_disp_t;
57struct _lv_group_t;
58struct _lv_indev_t;
59struct _lv_indev_drv_t;
60
69
71typedef enum {
72 LV_INDEV_STATE_RELEASED = 0,
73 LV_INDEV_STATE_PRESSED
75
86
88typedef struct _lv_indev_drv_t {
89
92
94 void (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
95
98 void (*feedback_cb)(struct _lv_indev_drv_t *, uint8_t);
99
100#if LV_USE_USER_DATA
101 void * user_data;
102#endif
103
105 struct _lv_disp_t * disp;
106
109
112
115
118
121
124
126 uint16_t long_press_repeat_time;
128
132typedef struct _lv_indev_proc_t {
134 /*Flags*/
135 uint8_t long_pr_sent : 1;
136 uint8_t reset_query : 1;
137 uint8_t disabled : 1;
138 uint8_t wait_until_release : 1;
139
140 union {
141 struct {
142 /*Pointer and button data*/
144 lv_point_t indev_point;
148 lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/
149 lv_point_t scroll_throw_vect;
150 lv_point_t scroll_throw_vect_ori;
151 struct _lv_obj_t * act_obj; /*The object being pressed*/
152 struct _lv_obj_t * last_obj; /*The last object which was pressed*/
153 struct _lv_obj_t * scroll_obj; /*The object being scrolled*/
154 struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
155 lv_area_t scroll_area;
156
157 lv_point_t gesture_sum; /*Count the gesture pixels to check LV_INDEV_DEF_GESTURE_LIMIT*/
158 /*Flags*/
159 lv_dir_t scroll_dir : 4;
160 lv_dir_t gesture_dir : 4;
161 uint8_t gesture_sent : 1;
162 } pointer;
163 struct {
164 /*Keypad data*/
165 lv_indev_state_t last_state;
166 uint32_t last_key;
167 } keypad;
168 } types;
169
170 uint32_t pr_timestamp;
173
176typedef struct _lv_indev_t {
177 struct _lv_indev_drv_t * driver;
178 _lv_indev_proc_t proc;
179 struct _lv_obj_t * cursor;
184
185/**********************
186 * GLOBAL PROTOTYPES
187 **********************/
188
195void lv_indev_drv_init(struct _lv_indev_drv_t * driver);
196
203
209void lv_indev_drv_update(lv_indev_t * indev, struct _lv_indev_drv_t * new_drv);
210
216
224
231
232/**********************
233 * MACROS
234 **********************/
235
236#ifdef __cplusplus
237} /*extern "C"*/
238#endif
239
240#endif
lv_indev_t * lv_indev_drv_register(struct _lv_indev_drv_t *driver)
lv_indev_type_t
Definition lv_hal_indev.h:62
@ LV_INDEV_TYPE_POINTER
Definition lv_hal_indev.h:64
@ LV_INDEV_TYPE_NONE
Definition lv_hal_indev.h:63
@ LV_INDEV_TYPE_KEYPAD
Definition lv_hal_indev.h:65
@ LV_INDEV_TYPE_BUTTON
Definition lv_hal_indev.h:66
@ LV_INDEV_TYPE_ENCODER
Definition lv_hal_indev.h:67
void lv_indev_delete(lv_indev_t *indev)
struct _lv_indev_proc_t _lv_indev_proc_t
void lv_indev_drv_update(lv_indev_t *indev, struct _lv_indev_drv_t *new_drv)
lv_indev_t * lv_indev_get_next(lv_indev_t *indev)
struct _lv_indev_t lv_indev_t
void lv_indev_drv_init(struct _lv_indev_drv_t *driver)
void _lv_indev_read(lv_indev_t *indev, lv_indev_data_t *data)
struct _lv_indev_drv_t lv_indev_drv_t
lv_indev_state_t
Definition lv_hal_indev.h:71
Definition lv_hal_disp.h:158
Definition lv_group.h:59
Definition lv_hal_indev.h:88
uint8_t scroll_throw
Definition lv_hal_indev.h:114
void(* feedback_cb)(struct _lv_indev_drv_t *, uint8_t)
Definition lv_hal_indev.h:98
lv_timer_t * read_timer
Definition lv_hal_indev.h:108
uint8_t gesture_limit
Definition lv_hal_indev.h:120
struct _lv_disp_t * disp
Definition lv_hal_indev.h:105
uint8_t scroll_limit
Definition lv_hal_indev.h:111
uint8_t gesture_min_velocity
Definition lv_hal_indev.h:117
uint16_t long_press_time
Definition lv_hal_indev.h:123
lv_indev_type_t type
Definition lv_hal_indev.h:91
Definition lv_hal_indev.h:132
lv_point_t act_point
Definition lv_hal_indev.h:143
lv_point_t last_point
Definition lv_hal_indev.h:145
lv_point_t vect
Definition lv_hal_indev.h:147
lv_point_t last_raw_point
Definition lv_hal_indev.h:146
uint32_t pr_timestamp
Definition lv_hal_indev.h:170
uint32_t longpr_rep_timestamp
Definition lv_hal_indev.h:171
lv_indev_state_t state
Definition lv_hal_indev.h:133
Definition lv_hal_indev.h:176
const lv_point_t * btn_points
Definition lv_hal_indev.h:181
struct _lv_group_t * group
Definition lv_hal_indev.h:180
struct _lv_obj_t * cursor
Definition lv_hal_indev.h:179
Definition lv_obj.h:174
Definition lv_timer.h:44
Definition lv_area.h:43
Definition lv_hal_indev.h:77
int16_t enc_diff
Definition lv_hal_indev.h:81
uint32_t btn_id
Definition lv_hal_indev.h:80
uint32_t key
Definition lv_hal_indev.h:79
bool continue_reading
Definition lv_hal_indev.h:84
lv_indev_state_t state
Definition lv_hal_indev.h:83
lv_point_t point
Definition lv_hal_indev.h:78
Definition lv_area.h:37