-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlv_tc_screen.h
More file actions
80 lines (61 loc) · 2.6 KB
/
lv_tc_screen.h
File metadata and controls
80 lines (61 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "stdbool.h"
#include "lvgl.h"
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_TC_START_DELAY_DISABLED = 0,
LV_TC_START_DELAY_ENABLED = 1
} lv_tc_start_delay_t;
typedef struct {
lv_obj_t screenObj; /* The screen object */
lv_obj_t *indicatorObj; /* The crosshair image object */
lv_obj_t *msgLabelObj; /* The message label object */
lv_obj_t *recalibrateBtnObj; /* The recalibration button object */
lv_obj_t *acceptBtnObj; /* The confirmation button object */
bool inputEnabled; /* A flag which determines whether the screen accepts input from the touch driver.
Makes sure pressing the crosshair is only handled once until releasing */
lv_point_t scrPoints[3]; /* The points to be pressed (in the coordinate space of the screen) */
lv_point_t tchPoints[3]; /* The touched points during the current calibration (in the coordinate space of the touch driver) */
uint8_t currentStep; /* The current calibration step */
lv_timer_t *startDelayTimer; /* The timer for delaying user input after opening the screen */
lv_timer_t *recalibrateTimer; /* The timer for automatic recalibration */
} lv_tc_screen_t;
extern const lv_obj_class_t lv_tc_screen_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a touch calibration screen.
* @returns a pointer to the newly created screen (lv_obj_t*)
*/
lv_obj_t* lv_tc_screen_create();
/**
* Set the points on screen to perform the calibration with.
* @param screenObj a pointer to the calibration screen (lv_obj_t*)
* @param scrPoints a pointer to the first element of an array holding the three new points
*/
void lv_tc_screen_set_points(lv_obj_t *screenObj, lv_point_t *scrPoints);
/**
* Start the calibration process.
* This function can also be used to restart an already ongoing calibration process.
* @param screenObj a pointer to the calibration screen (lv_obj_t*)
*/
void lv_tc_screen_start(lv_obj_t *screenObj);
/**
* Start the calibration process.
* This function can also be used to restart an already ongoing calibration process.
* @param screenObj a pointer to the calibration screen (lv_obj_t*)
* @param startDelayEnabled set whether to enable a delay before starting the calibration
*/
void lv_tc_screen_start_with_config(lv_obj_t *screenObj, lv_tc_start_delay_t startDelayEnabled);
#ifdef __cplusplus
}
#endif