Library and demo using the WS2812-based Neopixel strip connected to an LPC114

Dependencies:   mbed

Fork of LEDTape_WS2812 by Suga koubou

Details here: http://mbed.org/users/rhodes42/notebook/tiny-neopixel-controller-with-lpc1114/

LEDStripFunctions.cpp

Committer:
rhodes42
Date:
2014-03-24
Revision:
2:61abc599f31f
Child:
3:743570d993aa

File content as of revision 2:61abc599f31f:

#include "mbed.h"
#include "LEDStrip.h"
#include <stdint.h>


void setAll(uint32_t *buffer, int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        tapeSet(i, buffer[i]);   
    }
}

void setAllOneColor(uint32_t color, int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        tapeSet(i, color);   
    }   
}

void shiftAllFwd(uint32_t *buffer, int n)
{
    int i;
    uint32_t temp = buffer[n];
    for (i = n; i > 0; i--)
    {        
        buffer[i] = buffer[i-1];
    }
    buffer[0] = temp;
}

void shiftAllRev(uint32_t *buffer, int n)
{
    int i;
    uint32_t temp = buffer[0];
    for (i = 0; i <= n-1; i++)
    {        
        buffer[i] = buffer[i+1];
    }
    buffer[n] = temp;
}


void setEveryMod(uint32_t * buffer, uint32_t color, int mod, int start, int n)
{
    int i;
    for (i = 0; i < n; i ++)
    {
        if ((i >= start) && ((i - start) % mod == 0)) buffer[i] = color;   
    }   
}