Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1881 → Rev 1882

/Digital_RGB_LED_Stripes/tags/KopterLightEXT_1_00/lib/LPD8806_kopterlight_EXT.h
0,0 → 1,46
// Arduino related classes
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif
 
// Digital programmable RGB LED lightstrip class
class LPD8806 {
 
public:
uint16_t
rigger, // Count of rigger
riggerSize, // Number of LEDs per rigger
stripSize; // Calculated number of max. LEDs per strip
 
LPD8806(uint16_t n, uint8_t rig); // Use SPI hardware; specific pins only
LPD8806(void); // Empty constructor; init pins/strip length later
void
begin(void), // Activate hard/soft SPI as appropriate
show(void), // Push data into strip
setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t r1, uint8_t r2, uint8_t r3, uint8_t r4, uint8_t r5, uint8_t r6, uint8_t r7, uint8_t r8), // Set pixel on selected Rigger ( for separate R G B color )
setPixelColor(uint16_t n, uint32_t c, uint8_t r1, uint8_t r2, uint8_t r3, uint8_t r4, uint8_t r5, uint8_t r6, uint8_t r7, uint8_t r8), // Set pixel on single strip ( combined 32-bit GRB color )
updatePins(void), // Change pins, hardware SPI
updateLength(uint16_t n, uint8_t rig); // Change strip length and rigger
uint32_t
Color(byte, byte, byte); //Convert separate R,G,B into combined 32-bit GRB color:
 
 
private:
uint16_t
numLEDs; // Number of RGB LEDs in strip
uint8_t
*pixels, // Holds LED color values (3 bytes each)
clkpin , datapin, // Clock & data pin numbers
clkpinmask, datapinmask, // Clock & data PORT bitmasks
r1;
volatile uint8_t
*clkport , *dataport; // Clock & data PORT registers
void
startSPI(void); // Enable SPI hardware and set up protocol details
boolean
hardwareSPI, // If 'true', using hardware SPI
begun; // If 'true', begin() method was previously invoked
};