Wirepas SDK
led.h File Reference

Board-independent LED functions. More...

Detailed Description

Board-independent LED functions.

Definition in file led.h.

Go to the source code of this file.

Functions

void Led_init (void)
 Initialize Led module. More...
 
led_res_e Led_set (uint8_t led_id, bool state)
 Turn the given LED on or off. More...
 
bool Led_get (uint8_t led_id)
 Get the given LED current state. More...
 
led_res_e Led_toggle (uint8_t led_id)
 Toggle the given LED. More...
 
uint8_t Led_getNumber (void)
 Get number of leds available. More...
 

Enumerations

enum  led_res_e { LED_RES_OK = 0, LED_RES_INVALID_ID = 1, LED_RES_UNINITIALIZED = 2 }
 List of return code. More...
 

Function Documentation

◆ Led_get()

bool Led_get ( uint8_t  led_id)

Get the given LED current state.

Parameters
led_idId of the led
Returns
True if ON , false if OFF

◆ Led_getNumber()

uint8_t Led_getNumber ( void  )

Get number of leds available.

Returns
The number of leds available

◆ Led_init()

void Led_init ( void  )

Initialize Led module.

Example on use:

void App_init(const app_global_functions_t * functions)
{
...
// Set up LED GPIO
...
}

◆ Led_set()

led_res_e Led_set ( uint8_t  led_id,
bool  state 
)

Turn the given LED on or off.

Example on use:

#define LED_NUMBER 0
void App_init(const app_global_functions_t * functions)
{
...
// Set up LED GPIO
Led_set(LED_NUMBER, true);
...
}
Parameters
led_idId of the led
stateTrue to switch ON, False to switch OFF
Returns
True if successful, false otherwise

◆ Led_toggle()

led_res_e Led_toggle ( uint8_t  led_id)

Toggle the given LED.

Parameters
led_idId of the led
Returns
True if successful, false otherwise
Examples
scheduler/app.c.

Enumeration Type Documentation

◆ led_res_e

enum led_res_e

List of return code.

Enumerator
LED_RES_OK 

Operation is successful

LED_RES_INVALID_ID 

Led id is invalid

LED_RES_UNINITIALIZED 

LED iniatialization has not been performed

Definition at line 21 of file led.h.

22 {
24  LED_RES_OK = 0,
29 } led_res_e;
Led_set
led_res_e Led_set(uint8_t led_id, bool state)
Turn the given LED on or off.
led_res_e
led_res_e
List of return code.
Definition: led.h:21
LED_RES_OK
@ LED_RES_OK
Definition: led.h:24
app_global_functions_t
List of global functions, passed to App_entrypoint()
Definition: wms_app.h:157
LED_RES_INVALID_ID
@ LED_RES_INVALID_ID
Definition: led.h:26
Led_init
void Led_init(void)
Initialize Led module.
LED_RES_UNINITIALIZED
@ LED_RES_UNINITIALIZED
Definition: led.h:28