simple program to control Izebel's lights for Firefly

Dependencies:   mbed

ws2811BitBang.h

Committer:
bollocks
Date:
2016-06-19
Revision:
0:02f4f92c778a

File content as of revision 0:02f4f92c778a:

//this is a very silly, platform-specific way of getting the timing right for the WS2811 chips. Obviously there are more thoughtful ways to solve this problem, but this was expedient

#ifndef WS2811BITBANG
#define WS2811BITBANG 1
#include "mbed.h"
#define WAIT0H() asm volatile{nop;}
#define WAIT0L() asm volatile{nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
    }
    
#define WAIT1L() WAIT0L()
#define WAIT1H() asm volatile{\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
        nop;\
    }
    
void sendBuffer(uint8_t* rgbBuf,size_t len,DigitalOut& ws2812Data);

#endif