EasyGUI  Version v1.0

Simple LED. More...

Data Structures

struct  GUI_LED_t
 LED object structure. More...
 

Macros

#define GUI_LED_FLAG_ON   0x01
 

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, GUI_iDim_t x, GUI_iDim_t y, GUI_Dim_t width, GUI_Dim_t height, GUI_HANDLE_p parent, GUI_WIDGET_CALLBACK_t cb, 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:

handle = gui_led_create(0, 10, 80, 30, 30, 0, 0, 0);
gui_led_set(handle, 1);
handle = gui_led_create(0, 50, 80, 30, 30, 0, 0, 0);
handle = gui_led_create(0, 90, 80, 30, 30, 0, 0, 0);
gui_led_set(handle, 1);
handle = gui_led_create(0, 130, 80, 30, 30, 0, 0, 0);

Macro Definition Documentation

◆ GUI_LED_FLAG_ON

#define GUI_LED_FLAG_ON   0x01

Indicates LED is on

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,
GUI_iDim_t  x,
GUI_iDim_t  y,
GUI_Dim_t  width,
GUI_Dim_t  height,
GUI_HANDLE_p  parent,
GUI_WIDGET_CALLBACK_t  cb,
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 uints of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]cbPointer to GUI_WIDGET_CALLBACK_t callback function. Set to NULL to use default widget callback
[in]flagsFlags for widget creation
Return values
>0: GUI_HANDLE_p object of created widget
0Widget creation failed

◆ gui_led_ison()

uint8_t gui_led_ison ( GUI_HANDLE_p  h)

Check if led is ON.

Parameters
[in,out]hWidget handle
Return values
1Led is ON
0Led is OFF

◆ 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,out]hWidget handle
[in]stateLED state, either 1 or 0 according to selected state
Return values
1Led state was set ok
0Led state was not set

◆ 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,out]hWidget handle
[in]indexColor index. This parameter can be a value of GUI_LED_COLOR_t enumeration
[in]colorColor value
Return values
1Color was set ok
0Color was not set

◆ gui_led_settype()

uint8_t gui_led_settype ( GUI_HANDLE_p  h,
GUI_LED_TYPE_t  type 
)

Set led type.

Parameters
[in,out]hWidget handle
[in]typeNew type for LED. This parameter can be a value of GUI_LED_TYPE_t enumeration
Return values
1Type was set ok
0Type was not set

◆ gui_led_toggle()

uint8_t gui_led_toggle ( GUI_HANDLE_p  h)

Toggle LED state.

Parameters
[in,out]hWidget handle
Return values
1Led was toggled ok
0Led was not toggled