Ned Konz / Mbed 2 deprecated Multi_WS2811_test

Dependencies:   Multi_WS2811 mbed MMA8451Q

Fork of WS2811 by Heroic Robotics

WS2812.h

Committer:
bikeNomad
Date:
2013-12-05
Revision:
15:331e139672b5

File content as of revision 15:331e139672b5:

// Mbed library to control WS2801-based RGB LED Strips
// some portions (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
//
/*****************************************************************************/

// 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"
#ifndef MBED_WS2811_H
#define MBED_WS2811_H

#ifdef TARGET_KL25Z
#define MOSI_DEFAULT PTD2
#define SCLK_DEFAULT PTC5
#else
#endif

class WS2812 : public LedStrip
{
public:
    WS2812(int n, PinName mosi = MOSI_DEFAULT, PinName sclk = SCLK_DEFAULT);
    virtual void begin(void);
    virtual void show(void);
    virtual void blank(void);

private:
    SPI spi;            // to do actual communication

    Timer guardtime;
    uint32_t bogocal;

    void write(uint8_t byte);
    void writebit(bool bit);
    void celldelay(void);
};
#endif