DMA-enabled high data rate driver for Heroic Robotics LED strips.
Diff: LPD8806_fast.h
- Revision:
- 10:5b3be78ce6bd
- Parent:
- 9:9038105d14bc
diff -r 9038105d14bc -r 5b3be78ce6bd LPD8806_fast.h --- a/LPD8806_fast.h Sun Mar 09 22:34:04 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -// Mbed library to control LPD8806-based RGB LED Strips -// (c) 2011 Jelmer Tiete -// This library is ported from the Arduino implementation of Adafruit Industries -// found at: http://github.com/adafruit/LPD8806 -// and their strips: http://www.adafruit.com/products/306 -// Released under the MIT License: http://mbed.org/license/mit -// -// Parameterized and modified to use soft SPI. -// Jas Strong <jasmine@electronpusher.org> -// Then remonstered to use hardware SPI for blast mode. -/*****************************************************************************/ - -// Heavily modified by Jas Strong, 2012-10-04 -// Changed to use a virtual base class and to use software SPI. - -#include "mbed.h" -#include "LedStrip.h" -#include "MODDMA.h" - -#ifndef MBED_LPD8806_fast_H -#define MBED_LPD8806_fast_H - -class LPD8806_fast : public LedStrip { - - public: - - LPD8806_fast(PinName dataPin, PinName clockPin, int n); - virtual void begin(void); - virtual void show(void); - virtual void blank(void); - virtual void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b); - virtual void setPackedPixels(uint8_t * buffer, uint32_t n); - virtual void setPixelB(uint16_t n, uint8_t b); - virtual void setPixelG(uint16_t n, uint8_t g); - virtual void setPixelR(uint16_t n, uint8_t r); - virtual void setPixelColor(uint16_t n, uint32_t c); - virtual uint16_t numPixels(void); - virtual uint32_t Color(uint8_t, uint8_t, uint8_t); - virtual uint32_t total_luminance(void); - - private: - SPI _spi; - void write(uint8_t byte); - uint8_t *pixels; // Holds LED color values - uint16_t numLEDs; // Number of RGB LEDs in strand - MODDMA_Config * dma_config; - int strip_num; - - - uint32_t clock_mask; - uint32_t data_mask; - -}; -#endif \ No newline at end of file