Forked
Fork of Multi_WS2811 by
Embed:
(wiki syntax)
Show/hide line numbers
LedStrip.h
00001 // Parent class for all addressable LED strips. 00002 // Partially based on work by and (c) 2011 Jelmer Tiete 00003 // whose library is ported from the Arduino implementation of Adafruit Industries 00004 // found at: http://github.com/adafruit/LPD8806 00005 // and their strips: http://www.adafruit.com/products/306 00006 // Released under the MIT License: http://mbed.org/license/mit 00007 00008 // This is a pure virtual parent class for all LED strips, so that different types 00009 // of strip may be used in a single array or container. 00010 00011 #include "mbed.h" 00012 00013 #ifndef LEDSTRIP_H 00014 #define LEDSTRIP_H 00015 00016 class LedStrip 00017 { 00018 public: 00019 LedStrip(int n); 00020 ~LedStrip(); 00021 00022 virtual void begin(void)=0; 00023 virtual void show(void)=0; 00024 virtual void blank(void)=0; 00025 00026 static uint32_t Color(uint8_t r, uint8_t g, uint8_t b); 00027 00028 uint16_t numPixels(void) { return numLEDs; } 00029 uint16_t numPixelBytes(void) { return numLEDs * 3; } 00030 uint32_t total_luminance(void); 00031 00032 void setPixelB(uint16_t n, uint8_t b); 00033 void setPixelG(uint16_t n, uint8_t g); 00034 void setPixelR(uint16_t n, uint8_t r); 00035 00036 void setPixelColor(uint16_t n, uint32_t c); 00037 void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b); 00038 void setPackedPixels(uint8_t * buffer, uint32_t n); 00039 00040 protected: 00041 uint8_t *pixels; // Holds LED color values 00042 uint16_t numLEDs; // Number of RGB LEDs in strand 00043 }; 00044 #endif
Generated on Sun Jul 17 2022 01:46:11 by 1.7.2