Example program for Heroic Robotics FastPixel LED strip driver.

Dependencies:   FastPixelLPD8806 MODDMA mbed

Files at this revision

API Documentation at this revision

Comitter:
heroic
Date:
Sat May 31 18:44:15 2014 +0000
Commit message:
Example program for Heroic Robotics FastPixel driver library.

Changed in this revision

FastPixelLPD8806.lib Show annotated file Show diff for this revision Revisions of this file
MODDMA.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FastPixelLPD8806.lib	Sat May 31 18:44:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/heroic/code/FastPixelLPD8806/#5b3be78ce6bd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MODDMA.lib	Sat May 31 18:44:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/AjK/code/MODDMA/#97a16bf2ff43
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat May 31 18:44:15 2014 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "MODDMA.h"
+
+#include "FastPixelLPD8806.h"
+
+
+MODDMA dma;
+int current_strip_fill;
+
+LedStrip *strips[2];
+
+DigitalOut myled(LED1);
+
+int main() {
+    
+    // First, create the strip objects.
+    // The global current_strip_fill variable is an unfortunate workaround for the
+    // fact that we virtualize these strips but the DMA engine needs to know which
+    // one just got filled.
+    
+    current_strip_fill = 0;
+    strips[0] = new FastPixelLPD8806(p5, p7, 240);
+    current_strip_fill = 1;
+    strips[1] = new FastPixelLPD8806(p11, p13, 240);
+    
+    int j=0;
+    
+    while (1) {
+        // then write something into the strips:
+        for (int i=0; i<240; i++) {
+            strips[0]->setPixelColor(i, (j++) % 256, (j++) % 256, (j++) % 256);
+            strips[1]->setPixelColor(i, (j++) % 256, (j++) % 256, (j++) % 256);
+        }
+        // then show the strips:
+        current_strip_fill = 0;
+        strips[0]->show();
+        
+        current_strip_fill = 1;
+        strips[1]->show();
+    }  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat May 31 18:44:15 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file