Spark v1
Dependencies: BLE_API mbed nRF51822
DotStar.h
00001 #ifndef _DOT_STAR_H_ 00002 #define _DOT_STAR_H_ 00003 00004 #include "mbed.h" 00005 00006 class DotStar 00007 { 00008 public: 00009 00010 DotStar(uint16_t n, uint8_t d, uint8_t c); 00011 00012 void begin(); // Prime pins/SPI for output 00013 void clear(); // Set all pixel data to zero 00014 void setBrightness(uint8_t); // Set global brightness 0-255 00015 void setPixelColor(uint16_t n, uint32_t c); 00016 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b); 00017 void show(void); // Issue color data to strip 00018 void updatePins(void); // Change pin assignments (HW) 00019 void updatePins(uint8_t d, uint8_t c); // Change pin assignments (SW) 00020 void updateLength(uint16_t n); // Change length 00021 uint32_t 00022 Color(uint8_t r, uint8_t g, uint8_t b), // R,G,B to 32-bit color 00023 getPixelColor(uint16_t n) const; // Return 32-bit pixel color 00024 uint16_t 00025 numPixels(void); // Return number of pixels 00026 uint8_t 00027 getBrightness(void) const, // Return global brightness 00028 *getPixels(void) const, // Return pixel data pointer 00029 sine8(uint8_t) const, 00030 gamma8(uint8_t) const; 00031 00032 00033 private: 00034 uint16_t 00035 numLEDs; // Number of pixels 00036 uint8_t 00037 dataPin, // If soft SPI, data pin # 00038 clockPin, // If soft SPI, clock pin # 00039 brightness, // Global brightness setting 00040 *pixels, // LED RGB values (3 bytes ea.) 00041 rOffset, // Index of red in 3-byte pixel 00042 gOffset, // Index of green byte 00043 bOffset; // Index of blue byte 00044 }; 00045 00046 #endif
Generated on Thu Jul 14 2022 19:09:02 by
1.7.2