Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1882 - 1
// Arduino related classes
2
#if (ARDUINO >= 100)
3
 #include <Arduino.h>
4
#else
5
 #include <WProgram.h>
6
 #include <pins_arduino.h>
7
#endif
8
 
9
// Digital programmable RGB LED lightstrip class
10
class LPD8806 {
11
 
12
 public:
13
 uint16_t
14
    rigger,      // Count of rigger
15
    riggerSize,  // Number of LEDs per rigger
16
    stripSize;   // Calculated number of max. LEDs per strip
17
 
18
  LPD8806(uint16_t n, uint8_t rig); // Use SPI hardware; specific pins only
19
  LPD8806(void); // Empty constructor; init pins/strip length later
20
  void
21
    begin(void), // Activate hard/soft SPI as appropriate
22
    show(void), // Push data into strip
23
    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 ) 
24
    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 ) 
25
    updatePins(void), // Change pins, hardware SPI
26
    updateLength(uint16_t n, uint8_t rig); // Change strip length and rigger
27
  uint32_t
28
    Color(byte, byte, byte);   //Convert separate R,G,B into combined 32-bit GRB color:
29
 
30
 
31
 private:
32
  uint16_t
33
    numLEDs; // Number of RGB LEDs in strip
34
  uint8_t
35
    *pixels, // Holds LED color values (3 bytes each)
36
    clkpin    , datapin,     // Clock & data pin numbers
37
    clkpinmask, datapinmask, // Clock & data PORT bitmasks
38
    r1;
39
  volatile uint8_t
40
    *clkport  , *dataport;   // Clock & data PORT registers
41
  void
42
    startSPI(void);     // Enable SPI hardware and set up protocol details
43
  boolean
44
    hardwareSPI, // If 'true', using hardware SPI
45
    begun;       // If 'true', begin() method was previously invoked
46
};