Library and demo using the WS2812-based Neopixel strip connected to an LPC114
Fork of LEDTape_WS2812 by
Details here: http://mbed.org/users/rhodes42/notebook/tiny-neopixel-controller-with-lpc1114/
Diff: LEDStripFunctions.cpp
- Revision:
- 2:61abc599f31f
- Child:
- 3:743570d993aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LEDStripFunctions.cpp Mon Mar 24 10:00:54 2014 +0000 @@ -0,0 +1,54 @@ +#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; + } +} \ No newline at end of file