Generates a fixed pattern with constant output. Needed for debugging the SimpleDecimationFilter.

Dependencies:   FastIO mbed

Files at this revision

API Documentation at this revision

Comitter:
pscholtens
Date:
Wed May 27 09:33:12 2015 +0000
Commit message:
First version with constant output rate.

Changed in this revision

FastIO.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
diff -r 000000000000 -r f9195b124694 FastIO.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FastIO.lib	Wed May 27 09:33:12 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/FastIO/#f0a48027b2b3
diff -r 000000000000 -r f9195b124694 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 27 09:33:12 2015 +0000
@@ -0,0 +1,82 @@
+#include "mbed.h"
+#include "FastIO.h"
+
+//DigitalOut bitstream(p8);
+FastOut<p8> bitstream;
+DigitalOut myled(LED1);
+
+Serial     pc(USBTX, USBRX); // tx, rx
+Timer      timer;
+
+#define  LOOP 1000000
+
+int main() {
+    int data[42];
+    data[ 0] = 0;
+    data[ 1] = 1;
+    data[ 2] = 0;
+    data[ 3] = 0;
+    data[ 4] = 1;
+    data[ 5] = 1;
+    data[ 6] = 0;
+    data[ 7] = 0;
+    data[ 8] = 0;
+    data[ 9] = 1;
+    data[10] = 1;
+    data[11] = 1;
+    data[12] = 0;
+    data[13] = 0;
+    data[14] = 0;
+    data[15] = 0;
+    data[16] = 1;
+    data[17] = 1;
+    data[18] = 1;
+    data[19] = 1;
+    data[20] = 0;
+    data[21] = 0;
+    data[22] = 0;
+    data[23] = 0;
+    data[24] = 0;
+    data[25] = 1;
+    data[26] = 1;
+    data[27] = 1;
+    data[28] = 1;
+    data[29] = 1;
+    data[30] = 0;
+    data[31] = 0;
+    data[32] = 0;
+    data[33] = 0;
+    data[34] = 0;
+    data[35] = 0;
+    data[36] = 1;
+    data[37] = 1;
+    data[38] = 1;
+    data[39] = 1;
+    data[40] = 1;
+    data[41] = 1;
+    int index = 0;
+    int   dummy;
+    int   iter_incr = 1;
+    float duration;
+    pc.baud(115200);
+    pc.printf("Start\n");
+    timer.reset();
+    timer.start();
+loop:
+    for (int i = 0; i < LOOP; i+=iter_incr) {
+        bitstream = data[index];
+        index = (index+1)%42;
+        /* Begin of useless calculation to force 1 MHz runtime */
+        dummy = 3;
+        for (int j = 0; j <51; j++) {
+            dummy+=dummy;
+        }
+        /* End of useless calculation to force 1 MHz runtime */
+    }
+    timer.stop();
+    duration = timer.read();
+    pc.printf("Loop took %f seconds, %g per iteration\n",duration,duration/LOOP);
+    /* After testing the speed of the loop during 1 second, now continu to run it forever. */
+    iter_incr = 0;
+    goto loop;
+}
diff -r 000000000000 -r f9195b124694 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 27 09:33:12 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file