Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_lmeter.h
1476 views
1
/**
2
* @file lv_lmeter.h
3
*
4
*/
5
6
#ifndef LV_LMETER_H
7
#define LV_LMETER_H
8
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
13
/*********************
14
* INCLUDES
15
*********************/
16
#ifdef LV_CONF_INCLUDE_SIMPLE
17
#include "lv_conf.h"
18
#else
19
#include "../../lv_conf.h"
20
#endif
21
22
#if USE_LV_LMETER != 0
23
24
#include "../lv_core/lv_obj.h"
25
26
/*********************
27
* DEFINES
28
*********************/
29
30
/**********************
31
* TYPEDEFS
32
**********************/
33
/*Data of line meter*/
34
typedef struct
35
{
36
/*No inherited ext.*/ /*Ext. of ancestor*/
37
/*New data for this type */
38
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
39
uint8_t line_cnt; /*Count of lines */
40
int16_t cur_value;
41
int16_t min_value;
42
int16_t max_value;
43
} lv_lmeter_ext_t;
44
45
/**********************
46
* GLOBAL PROTOTYPES
47
**********************/
48
49
/**
50
* Create a line meter objects
51
* @param par pointer to an object, it will be the parent of the new line meter
52
* @param copy pointer to a line meter object, if not NULL then the new object will be copied from it
53
* @return pointer to the created line meter
54
*/
55
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy);
56
57
/*=====================
58
* Setter functions
59
*====================*/
60
61
/**
62
* Set a new value on the line meter
63
* @param lmeter pointer to a line meter object
64
* @param value new value
65
*/
66
void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value);
67
68
/**
69
* Set minimum and the maximum values of a line meter
70
* @param lmeter pointer to he line meter object
71
* @param min minimum value
72
* @param max maximum value
73
*/
74
void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max);
75
76
/**
77
* Set the scale settings of a line meter
78
* @param lmeter pointer to a line meter object
79
* @param angle angle of the scale (0..360)
80
* @param line_cnt number of lines
81
*/
82
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
83
84
/**
85
* Set the styles of a line meter
86
* @param lmeter pointer to a line meter object
87
* @param bg set the style of the line meter
88
*/
89
static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg)
90
{
91
lv_obj_set_style(lmeter, bg);
92
}
93
94
/*=====================
95
* Getter functions
96
*====================*/
97
98
/**
99
* Get the value of a line meter
100
* @param lmeter pointer to a line meter object
101
* @return the value of the line meter
102
*/
103
int16_t lv_lmeter_get_value(const lv_obj_t *lmeter);
104
105
/**
106
* Get the minimum value of a line meter
107
* @param lmeter pointer to a line meter object
108
* @return the minimum value of the line meter
109
*/
110
int16_t lv_lmeter_get_min_value(const lv_obj_t * lmeter);
111
112
/**
113
* Get the maximum value of a line meter
114
* @param lmeter pointer to a line meter object
115
* @return the maximum value of the line meter
116
*/
117
int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter);
118
119
/**
120
* Get the scale number of a line meter
121
* @param lmeter pointer to a line meter object
122
* @return number of the scale units
123
*/
124
uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter);
125
126
/**
127
* Get the scale angle of a line meter
128
* @param lmeter pointer to a line meter object
129
* @return angle of the scale
130
*/
131
uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
132
133
/**
134
* Get the style of a line meter
135
* @param lmeter pointer to a line meter object
136
* @return pointer to the line meter's style
137
*/
138
static inline lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter)
139
{
140
return lv_obj_get_style(lmeter);
141
}
142
143
/**********************
144
* MACROS
145
**********************/
146
147
#endif /*USE_LV_LMETER*/
148
149
#ifdef __cplusplus
150
} /* extern "C" */
151
#endif
152
153
#endif /*LV_LMETER_H*/
154
155