ThinkingSkins - MossSolar Facade  Version 1.0
 All Classes Files Functions Variables Pages
Adafruit_NeoPixel.h
1 /*--------------------------------------------------------------------
2  This file is part of the Adafruit NeoPixel library.
3 
4  NeoPixel is free software: you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation, either version 3 of
7  the License, or (at your option) any later version.
8 
9  NeoPixel is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with NeoPixel. If not, see
16  <http://www.gnu.org/licenses/>.
17  --------------------------------------------------------------------*/
18 
19 #ifndef ADAFRUIT_NEOPIXEL_H
20 #define ADAFRUIT_NEOPIXEL_H
21 
22 #if (ARDUINO >= 100)
23  #include <Arduino.h>
24 #else
25  #include <WProgram.h>
26  #include <pins_arduino.h>
27 #endif
28 
29 // 'type' flags for LED pixels (third parameter to constructor):
30 #define NEO_RGB 0x00 // Wired for RGB data order
31 #define NEO_GRB 0x01 // Wired for GRB data order
32 #define NEO_BRG 0x04
33 
34 #define NEO_COLMASK 0x01
35 #define NEO_KHZ800 0x02 // 800 KHz datastream
36 #define NEO_SPDMASK 0x02
37 // Trinket flash space is tight, v1 NeoPixels aren't handled by default.
38 // Remove the ifndef/endif to add support -- but code will be bigger.
39 // Conversely, can comment out the #defines to save space on other MCUs.
40 #ifndef __AVR_ATtiny85__
41 #define NEO_KHZ400 0x00 // 400 KHz datastream
42 #endif
43 
45 
46  public:
47 
48  // Constructor: number of LEDs, pin number, LED type
49  Adafruit_NeoPixel(uint16_t n, uint8_t p=6, uint8_t t=NEO_GRB + NEO_KHZ800);
51 
52  void
53  begin(void),
54  show(void),
55  setPin(uint8_t p),
56  setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b),
57  setPixelColor(uint16_t n, uint32_t c),
58  setBrightness(uint8_t);
59  uint8_t
60  *getPixels(void) const;
61  uint16_t
62  numPixels(void) const;
63  static uint32_t
64  Color(uint8_t r, uint8_t g, uint8_t b);
65  uint32_t
66  getPixelColor(uint16_t n) const;
67 
68  private:
69 
70  const uint16_t
71  numLEDs, // Number of RGB LEDs in strip
72  numBytes; // Size of 'pixels' buffer below
73  uint8_t
74  pin, // Output pin number
75  brightness,
76  *pixels, // Holds LED color values (3 bytes each)
77  rOffset, // Index of red byte within each 3-byte pixel
78  gOffset, // Index of green byte
79  bOffset; // Index of blue byte
80  const uint8_t
81  type; // Pixel flags (400 vs 800 KHz, RGB vs GRB color)
82  uint32_t
83  endTime; // Latch timing reference
84 #ifdef __AVR__
85  const volatile uint8_t
86  *port; // Output PORT register
87  uint8_t
88  pinMask; // Output PORT bitmask
89 #endif
90 
91 };
92 
93 #endif // ADAFRUIT_NEOPIXEL_H
Definition: Adafruit_NeoPixel.h:44