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 }
 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
Examples
blink/app.c.

◆ 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
...
}
Examples
ble_scanner/app.c, blink/app.c, positioning_app/app.c, and scheduler/app.c.

◆ 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
Examples
blink/app.c, and positioning_app/app.c.

◆ 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
ble_scanner/app.c, and 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

Definition at line 17 of file led.h.

18 {
20  LED_RES_OK = 0,
23 } 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:17
LED_RES_OK
@ LED_RES_OK
Definition: led.h:20
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:22
Led_init
void Led_init(void)
Initialize Led module.