read from arduino with 320*240 data flow 2Mbit

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
xkzy
Date:
Sat Dec 15 04:18:06 2018 +0000
Commit message:
done with exp1

Changed in this revision

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 e191453b86ba main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 15 04:18:06 2018 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+RawSerial pc(SERIAL_TX, SERIAL_RX); //has to use rawserial ,serial too slow and has byte loss.
+RawSerial cam(PA_11, PA_12);
+DigitalOut read_state(LED1);
+InterruptIn frame_start(PC_5);
+uint8_t image[76800];
+uint32_t pix_count;
+bool reading;
+void count_reset(){
+    pix_count = 0;
+    reading=!reading;
+}
+int main() {
+    
+    pc.baud(2000000);
+    cam.baud(2000000);
+    frame_start.fall(&count_reset); 
+    while(1) {
+        pix_count=0;
+        while(pix_count<76800){
+            if(cam.readable()) {
+                image[pix_count++]=cam.getc();
+            }
+        }
+        for(int u=0;u<76800;u++){
+            pc.putc(image[u]);
+        }
+    }
+}
diff -r 000000000000 -r e191453b86ba mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 15 04:18:06 2018 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b
\ No newline at end of file