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 "../../core/lv_obj.h"
17 
18 #if LV_USE_LED
19 
20 /*********************
21  *      DEFINES
22  *********************/
23 /** Brightness when the LED if OFF */
24 #ifndef LV_LED_BRIGHT_MIN
25 # define LV_LED_BRIGHT_MIN 80
26 #endif
27 
28 /** Brightness when the LED if ON */
29 #ifndef LV_LED_BRIGHT_MAX
30 # define LV_LED_BRIGHT_MAX 255
31 #endif
32 
33 /**********************
34  *      TYPEDEFS
35  **********************/
36 
37 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class;
38 
39 /**********************
40  * GLOBAL PROTOTYPES
41  **********************/
42 
43 /**
44  * Create a led object
45  * @param parent    pointer to an object, it will be the parent of the new led
46  * @return          pointer to the created led
47  */
48 lv_obj_t * lv_led_create(lv_obj_t * parent);
49 
50 /**
51  * Set the color of the LED
52  * @param led       pointer to a LED object
53  * @param color     the color of the LED
54  */
55 void lv_led_set_color(lv_obj_t * led, lv_color_t color);
56 
57 /**
58  * Set the brightness of a LED object
59  * @param led       pointer to a LED object
60  * @param bright    LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light)
61  */
62 void lv_led_set_brightness(lv_obj_t * led, uint8_t bright);
63 
64 /**
65  * Light on a LED
66  * @param led       pointer to a LED object
67  */
68 void lv_led_on(lv_obj_t * led);
69 
70 /**
71  * Light off a LED
72  * @param led       pointer to a LED object
73  */
74 void lv_led_off(lv_obj_t * led);
75 
76 /**
77  * Toggle the state of a LED
78  * @param led       pointer to a LED object
79  */
80 void lv_led_toggle(lv_obj_t * led);
81 
82 /**
83  * Get the brightness of a LED object
84  * @param obj       pointer to LED object
85  * @return bright   0 (max. dark) ... 255 (max. light)
86  */
87 uint8_t lv_led_get_brightness(const lv_obj_t * obj);
88 
89 /**********************
90  *      MACROS
91  **********************/
92 
93 #endif /*LV_USE_LED*/
94 
95 #ifdef __cplusplus
96 } /*extern "C"*/
97 #endif
98 
99 #endif /*LV_LED_H*/
100