1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/lv_objx/lv_led.h

117 lines
2.2 KiB
C
Raw Normal View History

2016-09-28 15:53:27 +02:00
/**
* @file lv_led.h
2018-06-19 09:49:58 +02:00
*
2016-09-28 15:53:27 +02:00
*/
#ifndef LV_LED_H
#define LV_LED_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2016-09-28 15:53:27 +02:00
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
2017-11-26 23:57:39 +01:00
#include "../../lv_conf.h"
#endif
2016-09-28 15:53:27 +02:00
#if USE_LV_LED != 0
2017-11-30 11:35:33 +01:00
#include "../lv_core/lv_obj.h"
2016-09-28 15:53:27 +02:00
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of led*/
typedef struct
{
2017-04-21 09:15:39 +02:00
/*No inherited ext.*/
/*New data for this type */
2017-04-11 10:50:57 +02:00
uint8_t bright; /*Current brightness of the LED (0..255)*/
2018-06-19 09:49:58 +02:00
} lv_led_ext_t;
2016-09-28 15:53:27 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a led objects
* @param par pointer to an object, it will be the parent of the new led
* @param copy pointer to a led object, if not NULL then the new object will be copied from it
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Set the brightness of a LED object
* @param led pointer to a LED object
* @param bright 0 (max. dark) ... 255 (max. light)
*/
2016-10-07 11:15:46 +02:00
void lv_led_set_bright(lv_obj_t * led, uint8_t bright);
2016-09-28 15:53:27 +02:00
/**
* Light on a LED
* @param led pointer to a LED object
*/
2016-10-07 11:15:46 +02:00
void lv_led_on(lv_obj_t * led);
/**
* Light off a LED
* @param led pointer to a LED object
*/
2016-10-07 11:15:46 +02:00
void lv_led_off(lv_obj_t * led);
/**
* Toggle the state of a LED
* @param led pointer to a LED object
*/
2017-12-19 22:00:32 +01:00
void lv_led_toggle(lv_obj_t * led);
/**
* Set the style of a led
* @param led pointer to a led object
* @param style pointer to a style
*/
static inline void lv_led_set_style(lv_obj_t *led, lv_style_t *style)
{
lv_obj_set_style(led, style);
}
2017-12-19 22:00:32 +01:00
/**
* Get the brightness of a LEd object
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(const lv_obj_t * led);
/**
* Get the style of an led object
* @param led pointer to an led object
* @return pointer to the led's style
*/
static inline lv_style_t* lv_led_get_style(const lv_obj_t *led)
{
return lv_obj_get_style(led);
}
2016-09-28 15:53:27 +02:00
/**********************
* MACROS
**********************/
2017-07-09 15:32:49 +02:00
#endif /*USE_LV_LED*/
2016-09-28 15:53:27 +02:00
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
} /* extern "C" */
2016-09-28 15:53:27 +02:00
#endif
2017-07-09 15:32:49 +02:00
#endif /*LV_LED_H*/