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 #include "../lv_conf_internal.h"
17 
18 #if LV_USE_LED != 0
19 
20 #include "../lv_core/lv_obj.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 
26 /**********************
27  *      TYPEDEFS
28  **********************/
29 
30 /*Data of led*/
31 typedef struct {
32     /*No inherited ext.*/
33     /*New data for this type */
34     uint8_t bright; /*Current brightness of the LED (0..255)*/
35 } lv_led_ext_t;
36 
37 /*Parts of LED*/
38 enum {
39     LV_LED_PART_MAIN = LV_OBJ_PART_MAIN,
40 };
41 typedef uint8_t lv_led_part_t;
42 
43 /**********************
44  * GLOBAL PROTOTYPES
45  **********************/
46 
47 /**
48  * Create a led objects
49  * @param par pointer to an object, it will be the parent of the new led
50  * @param copy pointer to a led object, if not NULL then the new object will be copied from it
51  * @return pointer to the created led
52  */
53 lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy);
54 
55 /**
56  * Set the brightness of a LED object
57  * @param led pointer to a LED object
58  * @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light)
59  */
60 void lv_led_set_bright(lv_obj_t * led, uint8_t bright);
61 
62 /**
63  * Light on a LED
64  * @param led pointer to a LED object
65  */
66 void lv_led_on(lv_obj_t * led);
67 
68 /**
69  * Light off a LED
70  * @param led pointer to a LED object
71  */
72 void lv_led_off(lv_obj_t * led);
73 
74 /**
75  * Toggle the state of a LED
76  * @param led pointer to a LED object
77  */
78 void lv_led_toggle(lv_obj_t * led);
79 
80 /**
81  * Get the brightness of a LEd object
82  * @param led pointer to LED object
83  * @return bright 0 (max. dark) ... 255 (max. light)
84  */
85 uint8_t lv_led_get_bright(const lv_obj_t * led);
86 
87 /**********************
88  *      MACROS
89  **********************/
90 
91 #endif /*LV_USE_LED*/
92 
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
96 
97 #endif /*LV_LED_H*/
98