upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for controlling P9813/Chainable RGB LEDs. More...

Detailed Description

P9813 LED controller provides individually controllable LEDs through a two pin protocol For each LED, an RGB (0-255) value can be set.

p9813.jpg
// Instantiate a chain of 2 LEDs using pin 2 for clock and pin 3 for data
upm::P9813 ledChain(2, 2, 3);
// Set all LEDs to Red
ledChain.setAllLeds(255, 0, 0);
// Set a single LED to green
ledChain.setLed(1, 0, 255, 0);

Public Member Functions

 P9813 (uint16_t ledCount, uint16_t clkPin, uint16_t dataPin, bool batchMode=false)
 
virtual ~P9813 ()
 
void setLed (uint16_t ledIdx, uint8_t r, uint8_t g, uint8_t b)
 
void setAllLeds (uint8_t r, uint8_t g, uint8_t b)
 
void setLeds (uint16_t startIdx, uint16_t endIdx, uint8_t r, uint8_t g, uint8_t b)
 
void setLeds (uint16_t startIdx, uint16_t endIdx, std::vector< RgbColor > colors)
 
void pushState ()
 

Constructor & Destructor Documentation

P9813 ( uint16_t  ledCount,
uint16_t  clkPin,
uint16_t  dataPin,
bool  batchMode = false 
)

Instantiates a new P9813 LED chain

Parameters
ledCountNumber of P9813 leds in the chain
clkPinClock Pin
dataPinData Pin
batchMode(optional) Immediately write to the LED controllers (false, default) or wait for a pushState call (true)
virtual ~P9813 ( )
inlinevirtual

P9813 destructor

Here is the call graph for this function:

Member Function Documentation

void setLed ( uint16_t  ledIdx,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set the color for a single LED

Parameters
ledIdxIndex of the LED in the chain (0 based)
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)

Here is the call graph for this function:

Here is the caller graph for this function:

void setAllLeds ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set the color for all LEDs

Parameters
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)

Here is the call graph for this function:

Here is the caller graph for this function:

void setLeds ( uint16_t  startIdx,
uint16_t  endIdx,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set the color for a range of LEDs

Parameters
startIdxStart index of the range of LEDs in the chain (0 based)
endIdxEnd index of the range of LEDs in the chain (0 based)
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)

Here is the call graph for this function:

Here is the caller graph for this function:

void setLeds ( uint16_t  startIdx,
uint16_t  endIdx,
std::vector< RgbColor colors 
)

(Advanced) Manually control the colors and brightness of a range of LEDS Best used to maximize performance

Parameters
startIdxStart index of the range of LEDs to update (0 based)
endIdxEnd index of the range of LEDs to update (0 based)
colorsVector containing RgbColor structures for each LED No check done on the boundaries

Here is the call graph for this function:

void pushState ( void  )

Outputs the current LED data to the LED controllers Note: Only required if batch mode is set to TRUE

Here is the caller graph for this function:


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