mikroSDK Reference Manual
lv_meter.h
Go to the documentation of this file.
1
6#ifndef LV_METER_H
7#define LV_METER_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16#include "../../../lvgl.h"
17
18#if LV_USE_METER != 0
19
20/*Testing of dependencies*/
21#if LV_DRAW_COMPLEX == 0
22#error "lv_meter: Complex drawing is required. Enable it in lv_conf.h (LV_DRAW_COMPLEX 1)"
23#endif
24
25/*********************
26 * DEFINES
27 *********************/
28
29/**********************
30 * TYPEDEFS
31 **********************/
32
33typedef struct {
34 lv_color_t tick_color;
35 uint16_t tick_cnt;
36 uint16_t tick_length;
37 uint16_t tick_width;
38
39 lv_color_t tick_major_color;
40 uint16_t tick_major_nth;
41 uint16_t tick_major_length;
42 uint16_t tick_major_width;
43
44 int16_t label_gap;
45 int16_t label_color;
46
47 int32_t min;
48 int32_t max;
49 int16_t r_mod;
50 uint16_t angle_range;
51 int16_t rotation;
52} lv_meter_scale_t;
53
54enum {
55 LV_METER_INDICATOR_TYPE_NEEDLE_IMG,
56 LV_METER_INDICATOR_TYPE_NEEDLE_LINE,
57 LV_METER_INDICATOR_TYPE_SCALE_LINES,
58 LV_METER_INDICATOR_TYPE_ARC,
59};
60typedef uint8_t lv_meter_indicator_type_t;
61
62typedef struct {
63 lv_meter_scale_t * scale;
64 lv_meter_indicator_type_t type;
65 lv_opa_t opa;
66 int32_t start_value;
67 int32_t end_value;
68 union {
69 struct {
70 const void * src;
71 lv_point_t pivot;
72 } needle_img;
73 struct {
74 uint16_t width;
75 int16_t r_mod;
76 lv_color_t color;
77 } needle_line;
78 struct {
79 uint16_t width;
80 const void * src;
81 lv_color_t color;
82 int16_t r_mod;
83 } arc;
84 struct {
85 int16_t width_mod;
86 lv_color_t color_start;
87 lv_color_t color_end;
88 uint8_t local_grad : 1;
89 } scale_lines;
90 } type_data;
91} lv_meter_indicator_t;
92
93/*Data of line meter*/
94typedef struct {
95 lv_obj_t obj;
96 lv_ll_t scale_ll;
97 lv_ll_t indicator_ll;
98} lv_meter_t;
99
100extern const lv_obj_class_t lv_meter_class;
101
106typedef enum {
107 LV_METER_DRAW_PART_ARC,
108 LV_METER_DRAW_PART_NEEDLE_LINE,
109 LV_METER_DRAW_PART_NEEDLE_IMG,
110 LV_METER_DRAW_PART_TICK,
111} lv_meter_draw_part_type_t;
112
113/**********************
114 * GLOBAL PROTOTYPES
115 **********************/
116
122lv_obj_t * lv_meter_create(lv_obj_t * parent);
123
124/*=====================
125 * Add scale
126 *====================*/
127
134lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj);
135
145void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len,
146 lv_color_t color);
147
159void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width,
160 uint16_t len, lv_color_t color, int16_t label_gap);
161
171void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range,
172 uint32_t rotation);
173
174/*=====================
175 * Add indicator
176 *====================*/
177
187lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width,
188 lv_color_t color, int16_t r_mod);
189
200lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src,
201 lv_coord_t pivot_x, lv_coord_t pivot_y);
202
212lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color,
213 int16_t r_mod);
214
215
226lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start,
227 lv_color_t color_end, bool local, int16_t width_mod);
228
229/*=====================
230 * Set indicator value
231 *====================*/
232
239void lv_meter_set_indicator_value(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value);
240
247void lv_meter_set_indicator_start_value(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value);
248
255void lv_meter_set_indicator_end_value(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value);
256
257/**********************
258 * MACROS
259 **********************/
260
261#endif /*LV_USE_METER*/
262
263#ifdef __cplusplus
264} /*extern "C"*/
265#endif
266
267#endif /*LV_METER_H*/
Definition lv_obj_class.h:49
Definition lv_obj.h:174
Definition lv_ll.h:32
Definition lv_area.h:37