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:
- 3:743570d993aa
- Parent:
- 2:61abc599f31f
diff -r 61abc599f31f -r 743570d993aa LEDStripFunctions.cpp --- a/LEDStripFunctions.cpp Mon Mar 24 10:00:54 2014 +0000 +++ b/LEDStripFunctions.cpp Tue Apr 08 20:56:03 2014 +0000 @@ -51,4 +51,27 @@ { if ((i >= start) && ((i - start) % mod == 0)) buffer[i] = color; } +} + + +void scaleBrightness(uint32_t *buffer, int divider, int n) +{ + int i, r, g, b; + for (i = 0; i < n; i++) + { + r = (buffer[i] >> 16) & 0xff; + g = (buffer[i] >> 8 ) & 0xff; + b = (buffer[i] ) & 0xff; + r /= divider; + g /= divider; + b /= divider; + buffer[i] = (r << 16) | (g << 8) | (b); + } +} + +void setPixelRGB(int pixel, int r, int g, int b) +{ + + int pix = (r << 16) | (g << 8) | (b); + tapeSet(pixel, pix); } \ No newline at end of file