PololuLedStrip from mickaeljkoster with support for K64F

Fork of PololuLedStrip by Michael Koster

Revision:
23:9d1b45daf607
Parent:
22:bda8af613d4d
--- a/PololuLedStrip.cpp	Tue Aug 19 00:20:41 2014 +0000
+++ b/PololuLedStrip.cpp	Tue Nov 25 20:03:53 2014 +0000
@@ -39,6 +39,18 @@
 PololuLedStrip::PololuLedStrip(PinName pinName)
 {
     gpio_init_out(&gpio, pinName);
+    
+    #if defined(_K64F)
+    uint32_t port = pinName >> GPIO_PORT_SHIFT;
+    mask = 1 << (pinName & 0xFF);
+    uint32_t gpio_addrs[] = GPIO_BASE_ADDRS;
+    reg_set = (uint32_t*)(HW_GPIO_PSOR_ADDR(gpio_addrs[port]));    
+    reg_clr = (uint32_t*)(HW_GPIO_PCOR_ADDR(gpio_addrs[port]));
+    #else
+    reg_set = gpio.reg_set;
+    reg_clr = gpio.reg_clr;
+    mask = gpio.mask;
+    #endif
 }
 
 void PololuLedStrip::write(rgb_color * colors, unsigned int count)
@@ -49,7 +61,11 @@
 
     while(count--)
     {
-        led_strip_write_color(colors, gpio.reg_set, gpio.reg_clr, gpio.mask);
+        #ifdef _K64F
+        led_strip_write_color_K64F(colors, reg_set, reg_clr, mask);
+        #else
+        led_strip_write_color(colors, reg_set, reg_clr, mask);
+        #endif
         colors++;
          
         if (interruptFriendly)