EasyGUI  Version v1.0

Simple LED. More...

Data Structures

struct  gui_led_t
 LED object structure. More...
 

Enumerations

enum  gui_led_color_t { GUI_LED_COLOR_ON = 0x00, GUI_LED_COLOR_OFF, GUI_LED_COLOR_ON_BORDER, GUI_LED_COLOR_OFF_BORDER }
 List of available colors for LED. More...
 
enum  gui_led_type_t { GUI_LED_TYPE_RECT = 0x00, GUI_LED_TYPE_CIRCLE = 0x01 }
 List of available LED types. More...
 

Functions

gui_handle_p gui_led_create (gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
 Create new led widget. More...
 
uint8_t gui_led_setcolor (gui_handle_p h, gui_led_color_t index, gui_color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_led_settype (gui_handle_p h, gui_led_type_t type)
 Set led type. More...
 
uint8_t gui_led_toggle (gui_handle_p h)
 Toggle LED state. More...
 
uint8_t gui_led_set (gui_handle_p h, uint8_t state)
 Set LED value either on (turn on) or off (turn off) More...
 
uint8_t gui_led_ison (gui_handle_p h)
 Check if led is ON. More...
 

Detailed Description

Simple LED.

Led widget is very simple widget used for indication purposes. It can only have ON or OFF status.

Widget is supported in different shapes, defined by gui_led_type_t enumeration.

image_widget_led.png
LED widgets from left: 1. circle ON, circle OFF, rectangle ON, rectangle OFF

Example code of image above:

Enumeration Type Documentation

◆ gui_led_color_t

List of available colors for LED.

Enumerator
GUI_LED_COLOR_ON 

Color index for LED on status

GUI_LED_COLOR_OFF 

Color index for LED off status

GUI_LED_COLOR_ON_BORDER 

Color index for LED border on status

GUI_LED_COLOR_OFF_BORDER 

Color index for LED border off status

◆ gui_led_type_t

List of available LED types.

Enumerator
GUI_LED_TYPE_RECT 

Led is rectangular

GUI_LED_TYPE_CIRCLE 

Led is circle

Function Documentation

◆ gui_led_create()

gui_handle_p gui_led_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
uint16_t  flags 
)

Create new led widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for widget creation
Returns
Widget handle on success, NULL otherwise

◆ gui_led_ison()

uint8_t gui_led_ison ( gui_handle_p  h)

Check if led is ON.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_led_set()

uint8_t gui_led_set ( gui_handle_p  h,
uint8_t  state 
)

Set LED value either on (turn on) or off (turn off)

Parameters
[in]hWidget handle
[in]stateLED state, either 1 or 0 according to selected state
Returns
1 on success, 0 otherwise

◆ gui_led_setcolor()

uint8_t gui_led_setcolor ( gui_handle_p  h,
gui_led_color_t  index,
gui_color_t  color 
)

Set color to specific part of widget.

Parameters
[in]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_led_settype()

uint8_t gui_led_settype ( gui_handle_p  h,
gui_led_type_t  type 
)

Set led type.

Parameters
[in]hWidget handle
[in]typeNew type for LED
Returns
1 on success, 0 otherwise

◆ gui_led_toggle()

uint8_t gui_led_toggle ( gui_handle_p  h)

Toggle LED state.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise