Driver for the GE Color Effects LED lights. Currently it is blocking, but it could be made to be nonblocking.

Dependents:   GEColorEffects_Example GEColorEffects_Example

This library's code is based on Clark Jarvis's program here: http://developer.mbed.org/users/clarkjarvis/code/FRDM_GE_ColorEffects/

Revision:
1:e56bc0a8c273
Parent:
0:3f51641c4e69
--- a/GEColorEffects.cpp	Mon Feb 16 20:27:53 2015 +0000
+++ b/GEColorEffects.cpp	Wed Jul 15 20:04:49 2015 +0000
@@ -7,6 +7,8 @@
 
 void GEColorEffects::write(int buf[], bool eightBit) {
     int l, r, g, b;
+    
+    __disable_irq();
     for (int i = 0; i < size; i++) {
         l = (buf[i] >> 24) & 0xFF;
         r = (buf[i] >> 16) & 0xFF;
@@ -19,6 +21,7 @@
             sendFrame(i, l, r, g, b);
         }
     }
+    __enable_irq();
 }
 
 // GPIO output to send a logical 0
@@ -50,7 +53,13 @@
         }
     }
 }
- 
+
+void GEColorEffects::setBrightness(unsigned char brightness) {
+    __disable_irq();
+    sendFrame(63, brightness, 0, 0, 0);
+    __enable_irq();
+}
+
 // Send frame of data to control a single pixel
 void GEColorEffects::sendFrame(unsigned char address, unsigned char lumm, unsigned char R, unsigned char G, unsigned char B) {
 // Send "1" value to start Frame