1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

chore(led) expose LV_LED_BRIGHT_MIN/MAX in led.h

fixes #2485
This commit is contained in:
Gabor Kiss-Vamosi 2021-08-24 09:28:59 +02:00
parent 2d38f1884c
commit 3f18b234f6
2 changed files with 10 additions and 12 deletions

View File

@ -14,14 +14,6 @@
*********************/ *********************/
#define MY_CLASS &lv_led_class #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 * 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; lv_led_t * led = (lv_led_t *)obj;
if(led->bright == bright) return; if(led->bright == bright) return;
if(bright <= LV_LED_BRIGHT_MIN) bright = LV_LED_BRIGHT_MIN; led->bright = LV_CLAMP(LV_LED_BRIGHT_MIN, bright, LV_LED_BRIGHT_MAX);
if(bright >= LV_LED_BRIGHT_MAX) bright = LV_LED_BRIGHT_MAX;
led->bright = bright;
/*Invalidate the object there fore it will be redrawn*/ /*Invalidate the object there fore it will be redrawn*/
lv_obj_invalidate(obj); lv_obj_invalidate(obj);

View File

@ -21,6 +21,15 @@ extern "C" {
/********************* /*********************
* DEFINES * 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 * TYPEDEFS