Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_led.h
1476 views
1
/**
2
* @file lv_led.h
3
*
4
*/
5
6
#ifndef LV_LED_H
7
#define LV_LED_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_LED != 0
23
24
#include "../lv_core/lv_obj.h"
25
26
/*********************
27
* DEFINES
28
*********************/
29
30
/**********************
31
* TYPEDEFS
32
**********************/
33
34
/*Data of led*/
35
typedef struct
36
{
37
/*No inherited ext.*/
38
/*New data for this type */
39
uint8_t bright; /*Current brightness of the LED (0..255)*/
40
} lv_led_ext_t;
41
42
/**********************
43
* GLOBAL PROTOTYPES
44
**********************/
45
46
/**
47
* Create a led objects
48
* @param par pointer to an object, it will be the parent of the new led
49
* @param copy pointer to a led object, if not NULL then the new object will be copied from it
50
* @return pointer to the created led
51
*/
52
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy);
53
54
/**
55
* Set the brightness of a LED object
56
* @param led pointer to a LED object
57
* @param bright 0 (max. dark) ... 255 (max. light)
58
*/
59
void lv_led_set_bright(lv_obj_t * led, uint8_t bright);
60
61
/**
62
* Light on a LED
63
* @param led pointer to a LED object
64
*/
65
void lv_led_on(lv_obj_t * led);
66
67
/**
68
* Light off a LED
69
* @param led pointer to a LED object
70
*/
71
void lv_led_off(lv_obj_t * led);
72
73
/**
74
* Toggle the state of a LED
75
* @param led pointer to a LED object
76
*/
77
void lv_led_toggle(lv_obj_t * led);
78
79
/**
80
* Set the style of a led
81
* @param led pointer to a led object
82
* @param style pointer to a style
83
*/
84
static inline void lv_led_set_style(lv_obj_t *led, lv_style_t *style)
85
{
86
lv_obj_set_style(led, style);
87
}
88
89
/**
90
* Get the brightness of a LEd object
91
* @param led pointer to LED object
92
* @return bright 0 (max. dark) ... 255 (max. light)
93
*/
94
uint8_t lv_led_get_bright(const lv_obj_t * led);
95
96
/**
97
* Get the style of an led object
98
* @param led pointer to an led object
99
* @return pointer to the led's style
100
*/
101
static inline lv_style_t* lv_led_get_style(const lv_obj_t *led)
102
{
103
return lv_obj_get_style(led);
104
}
105
106
/**********************
107
* MACROS
108
**********************/
109
110
#endif /*USE_LV_LED*/
111
112
#ifdef __cplusplus
113
} /* extern "C" */
114
#endif
115
116
#endif /*LV_LED_H*/
117
118