upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
apa102.h File Reference
Include dependency graph for apa102.h:

API Description

Go to the source code of this file.

Data Structures

struct  _apa102_context
 

Functions

apa102_context apa102_init (int ledcount, int bus, int cs)
 
void apa102_close (apa102_context dev)
 
upm_result_t apa102_set_led (apa102_context dev, uint16_t index, uint8_t brightness, uint8_t r, uint8_t g, uint8_t b)
 
upm_result_t apa102_set_led_brightness (apa102_context dev, uint16_t index, uint8_t brightness)
 
upm_result_t apa102_set_leds (apa102_context dev, uint16_t s_index, uint16_t e_index, uint8_t brightness, uint8_t r, uint8_t g, uint8_t b)
 
upm_result_t apa102_set_leds_brightness (apa102_context dev, uint16_t s_index, uint16_t e_index, uint8_t brightness)
 
upm_result_t apa102_refresh (apa102_context dev)
 

Typedefs

typedef struct _apa102_contextapa102_context
 

Function Documentation

apa102_context apa102_init ( int  ledcount,
int  bus,
int  cs 
)

Instantiates a new APA102 LED Strip

Parameters
ledcountNumber of LEDs on the strip
busSPI bus to use
csPin to use for chip select. -1 if not used.
Returns
an initialized apa102 context on success, NULL on error.

Here is the call graph for this function:

void apa102_close ( apa102_context  dev)

APA102 close function

Parameters
devThe apa102_context to close

Here is the caller graph for this function:

upm_result_t apa102_set_led ( apa102_context  dev,
uint16_t  index,
uint8_t  brightness,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Sets the color and brightness for one LED in the buffer

Parameters
devThe apa102_context to use
indexIndex of the LED (0 based)
brightnessBrightness value (0-31)
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
Returns
upm_result_t UPM success/error code

Here is the call graph for this function:

upm_result_t apa102_set_led_brightness ( apa102_context  dev,
uint16_t  index,
uint8_t  brightness 
)

Sets the brightness for one LED in the buffer

Parameters
devThe apa102_context to use
indexIndex of the LED (0 based)
brightnessBrightness value (0-31)
Returns
upm_result_t UPM success/error code

Here is the call graph for this function:

upm_result_t apa102_set_leds ( apa102_context  dev,
uint16_t  s_index,
uint16_t  e_index,
uint8_t  brightness,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Sets the color and brightness for multiple LEDs in the buffer

Parameters
devThe apa102_context to use
s_indexThe start Index of the LED range (0 based)
e_indexThe end Index of the LED range (0 based)
brightnessBrightness value (0-31)
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
Returns
upm_result_t UPM success/error code

Here is the caller graph for this function:

upm_result_t apa102_set_leds_brightness ( apa102_context  dev,
uint16_t  s_index,
uint16_t  e_index,
uint8_t  brightness 
)

Sets the brightness for multiple LEDs in the buffer

Parameters
devThe apa102_context to use
s_indexThe start Index of the LED range (0 based)
e_indexThe end Index of the LED range (0 based)
brightnessBrightness value (0-31)
Returns
upm_result_t UPM success/error code

Here is the caller graph for this function:

upm_result_t apa102_refresh ( apa102_context  dev)

Writes the buffer to the SPI bus thus updating the LED Strip

Parameters
devThe apa102_context to use
Returns
upm_result_t UPM success/error code

Typedef Documentation

typedef struct _apa102_context * apa102_context

Device context