acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_led.h (2316B)
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 "../../../lvgl.h" 17 18 #if LV_USE_LED 19 20 21 /********************* 22 * DEFINES 23 *********************/ 24 /** Brightness when the LED if OFF */ 25 #ifndef LV_LED_BRIGHT_MIN 26 # define LV_LED_BRIGHT_MIN 80 27 #endif 28 29 /** Brightness when the LED if ON */ 30 #ifndef LV_LED_BRIGHT_MAX 31 # define LV_LED_BRIGHT_MAX 255 32 #endif 33 34 /********************** 35 * TYPEDEFS 36 **********************/ 37 38 /*Data of led*/ 39 typedef struct { 40 lv_obj_t obj; 41 lv_color_t color; 42 uint8_t bright; /**< Current brightness of the LED (0..255)*/ 43 } lv_led_t; 44 45 extern const lv_obj_class_t lv_led_class; 46 47 /** 48 * `type` field in `lv_obj_draw_part_dsc_t` if `class_p = lv_led_class` 49 * Used in `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` 50 */ 51 typedef enum { 52 LV_LED_DRAW_PART_RECTANGLE, /**< The main rectangle*/ 53 } lv_led_draw_part_type_t; 54 55 /********************** 56 * GLOBAL PROTOTYPES 57 **********************/ 58 59 /** 60 * Create a led object 61 * @param parent pointer to an object, it will be the parent of the new led 62 * @return pointer to the created led 63 */ 64 lv_obj_t * lv_led_create(lv_obj_t * parent); 65 66 /** 67 * Set the color of the LED 68 * @param led pointer to a LED object 69 * @param color the color of the LED 70 */ 71 void lv_led_set_color(lv_obj_t * led, lv_color_t color); 72 73 /** 74 * Set the brightness of a LED object 75 * @param led pointer to a LED object 76 * @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light) 77 */ 78 void lv_led_set_brightness(lv_obj_t * led, uint8_t bright); 79 80 /** 81 * Light on a LED 82 * @param led pointer to a LED object 83 */ 84 void lv_led_on(lv_obj_t * led); 85 86 /** 87 * Light off a LED 88 * @param led pointer to a LED object 89 */ 90 void lv_led_off(lv_obj_t * led); 91 92 /** 93 * Toggle the state of a LED 94 * @param led pointer to a LED object 95 */ 96 void lv_led_toggle(lv_obj_t * led); 97 98 /** 99 * Get the brightness of a LEd object 100 * @param led pointer to LED object 101 * @return bright 0 (max. dark) ... 255 (max. light) 102 */ 103 uint8_t lv_led_get_brightness(const lv_obj_t * obj); 104 105 /********************** 106 * MACROS 107 **********************/ 108 109 #endif /*LV_USE_LED*/ 110 111 #ifdef __cplusplus 112 } /*extern "C"*/ 113 #endif 114 115 116 #endif /*LV_LED_H*/