mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
parent
2d38f1884c
commit
3f18b234f6
@ -14,14 +14,6 @@
|
||||
*********************/
|
||||
#define MY_CLASS &lv_led_class
|
||||
|
||||
#ifndef LV_LED_BRIGHT_MIN
|
||||
# define LV_LED_BRIGHT_MIN 80
|
||||
#endif
|
||||
|
||||
#ifndef LV_LED_BRIGHT_MAX
|
||||
# define LV_LED_BRIGHT_MAX 255
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@ -91,10 +83,7 @@ void lv_led_set_brightness(lv_obj_t * obj, uint8_t bright)
|
||||
lv_led_t * led = (lv_led_t *)obj;
|
||||
if(led->bright == bright) return;
|
||||
|
||||
if(bright <= LV_LED_BRIGHT_MIN) bright = LV_LED_BRIGHT_MIN;
|
||||
if(bright >= LV_LED_BRIGHT_MAX) bright = LV_LED_BRIGHT_MAX;
|
||||
|
||||
led->bright = bright;
|
||||
led->bright = LV_CLAMP(LV_LED_BRIGHT_MIN, bright, LV_LED_BRIGHT_MAX);
|
||||
|
||||
/*Invalidate the object there fore it will be redrawn*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
@ -21,6 +21,15 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/** Brightness when the LED if OFF */
|
||||
#ifndef LV_LED_BRIGHT_MIN
|
||||
# define LV_LED_BRIGHT_MIN 80
|
||||
#endif
|
||||
|
||||
/** Brightness when the LED if ON */
|
||||
#ifndef LV_LED_BRIGHT_MAX
|
||||
# define LV_LED_BRIGHT_MAX 255
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
Loading…
x
Reference in New Issue
Block a user