Forked PololuLedStrip and modified it to work with the KL25Z. Renamed it to Adafruit_NeoPixel.

Dependents:   idd_hw3 idd_fa15_hw3_lauren_bill_tomas idd_fa15_hw3_lauren_bill_tomas Raiden ... more

Fork of PololuLedStrip by David Grayson

Revision:
1:102307d9b701
Child:
4:d3b60bd43811
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PololuLedStrip.cpp	Wed Feb 27 01:43:44 2013 +0000
@@ -0,0 +1,30 @@
+#include "PololuLedStrip.h"
+
+bool PololuLedStrip::interruptFriendly = false;
+
+PololuLedStrip::PololuLedStrip(PinName pinName)
+{
+    gpio_init(&gpio, pinName, PIN_OUTPUT);
+}
+
+void PololuLedStrip::write(rgb_color * colors, unsigned int count)
+{
+    __disable_irq();   // Disable interrupts temporarily because we don't want our pulse timing to be messed up.
+    
+    while(count--)
+    {
+        led_strip_write_color(colors++, gpio.reg_set, gpio.reg_clr, gpio.mask);
+     
+        if (interruptFriendly)
+        {
+            __enable_irq();
+            __nop();
+            __nop();
+            __nop();
+            __disable_irq();
+        }
+    }
+        
+    __enable_irq();   // Re-enable interrupts now that we are done.
+    wait_us(24);      // Hold the line low for 24 microseconds to send the reset signal.
+}
\ No newline at end of file