mraa  2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
Public Member Functions
Led Class Reference

Detailed Description

This file defines the LED interface for libmraa

/* initialize user1 led */
mraa::Led led(USER_LED);
/* read maximum brightness */
val = led.readMaxBrightness();
std::cout << "maximum brightness value for user1 led is: %d" << val << std::endl;
if (val >= 1) {
val = 0;
} else {
/* never reached mostly */
val = 1;
}
/* turn led on/off depending on max_brightness value */
status = led.setBrightness(val);
if (status != mraa::SUCCESS) {
printError(status);
return EXIT_FAILURE;
}
/* sleep for 5 seconds */
usleep(5000000);
/* set led trigger to heartbeat */
status = led.trigger(LED_TRIGGER);
if (status != mraa::SUCCESS) {
printError(status);
return EXIT_FAILURE;
}
std::cout << "led trigger set to: heartbeat" << std::endl;

Public Member Functions

 Led (int led)
 
 Led (std::string led_dev)
 
 Led (void *led_context)
 
 ~Led ()
 
Result setBrightness (int value)
 
int readBrightness ()
 
int readMaxBrightness ()
 
Result trigger (const char *trigger)
 
Result clearTrigger ()
 

Constructor & Destructor Documentation

Led ( int  led)
inline

Instantiates an LED object

Parameters
ledLED index to use

Here is the call graph for this function:

Led ( std::string  led_dev)
inline

Instantiates an LED object

Parameters
led_devLED function name to use

Here is the call graph for this function:

Led ( void *  led_context)
inline

LED Constructor, takes a pointer to a LED context and initialises the LED class

Parameters
led_contextvoid * to LED context
~Led ( )
inline

LED object destructor

Here is the call graph for this function:

Member Function Documentation

Result setBrightness ( int  value)
inline

Set LED brightness value

Parameters
valueValue to set LED brightness
Returns
Result of operation

Here is the call graph for this function:

int readBrightness ( )
inline

Read LED brightness value

Returns
LED brightness value

Here is the call graph for this function:

int readMaxBrightness ( )
inline

Read LED maximum brightness value

Returns
LED max brightness value

Here is the call graph for this function:

Result trigger ( const char *  trigger)
inline

Set LED trigger

Parameters
triggerType of trigger to set
Returns
Result of operation

Here is the call graph for this function:

Result clearTrigger ( )
inline

Clear active LED trigger

Returns
Result of operation

Here is the call graph for this function:


The documentation for this class was generated from the following file: