blob: 4f7b446b9861af0125597a27aa8a5080d19869bc (
plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/**
* @file lv_barcode.c
*
*/
#ifndef LV_BARCODE_H
#define LV_BARCODE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../misc/lv_types.h"
#include "../../misc/lv_color.h"
#include "../../widgets/canvas/lv_canvas.h"
#if LV_USE_BARCODE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of barcode*/
typedef struct {
lv_canvas_t canvas;
lv_color_t dark_color;
lv_color_t light_color;
uint16_t scale;
lv_dir_t direction;
} lv_barcode_t;
LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_barcode_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an empty barcode (an `lv_canvas`) object.
* @param parent point to an object where to create the barcode
* @return pointer to the created barcode object
*/
lv_obj_t * lv_barcode_create(lv_obj_t * parent);
/**
* Set the dark color of a barcode object
* @param obj pointer to barcode object
* @param color dark color of the barcode
*/
void lv_barcode_set_dark_color(lv_obj_t * obj, lv_color_t color);
/**
* Set the light color of a barcode object
* @param obj pointer to barcode object
* @param color light color of the barcode
*/
void lv_barcode_set_light_color(lv_obj_t * obj, lv_color_t color);
/**
* Set the scale of a barcode object
* @param obj pointer to barcode object
* @param scale scale factor
*/
void lv_barcode_set_scale(lv_obj_t * obj, uint16_t scale);
/**
* Set the direction of a barcode object
* @param obj pointer to barcode object
* @param direction draw direction (`LV_DIR_HOR` or `LB_DIR_VER`)
*/
void lv_barcode_set_direction(lv_obj_t * obj, lv_dir_t direction);
/**
* Set the data of a barcode object
* @param obj pointer to barcode object
* @param data data to display
* @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error
*/
lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data);
/**
* Get the dark color of a barcode object
* @param obj pointer to barcode object
* @return dark color of the barcode
*/
lv_color_t lv_barcode_get_dark_color(lv_obj_t * obj);
/**
* Get the light color of a barcode object
* @param obj pointer to barcode object
* @return light color of the barcode
*/
lv_color_t lv_barcode_get_light_color(lv_obj_t * obj);
/**
* Get the scale of a barcode object
* @param obj pointer to barcode object
* @return scale factor
*/
uint16_t lv_barcode_get_scale(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_BARCODE*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_BARCODE_H*/
|