Check Uplink

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
umezawa
Date:
Tue Dec 29 07:06:55 2020 +0000
Commit message:
test

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 16b8e1c4d8ac main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 29 07:06:55 2020 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+Serial com(D1,D0);
+DigitalOut NRST(A5);
+char msg[256];
+char data[256];
+
+char rcmd = 0;
+int cmdflag = 0;
+
+void commandget()
+{
+    wait(0.5);
+    rcmd=com.getc();
+    cmdflag = 1;
+}
+
+void initialize()
+{
+    rcmd = NULL;
+    cmdflag = 0;
+}
+
+int main()
+{
+    com.baud(115200);
+    pc.baud(115200);
+    //初期化
+    NRST = 1;
+    NRST = 0;
+    wait(2);
+    NRST = 1;
+    com.scanf("%s",msg);
+    pc.printf("%s\r\n",msg);
+    if (strstr(msg,"Select")!=NULL) {
+        com.printf("2\r\n");
+        wait(0.5);
+        com.printf("q 2\r\n");
+        wait(0.5);
+        com.printf("start\r\n");
+        com.scanf("%s",msg);
+        for(int i = 0; i<4; i++) {
+            com.getc();
+        }
+    }
+    pc.printf("Setting OK\r\n");
+    com.attach(commandget,Serial::RxIrq);
+    while(1) {
+        pc.printf("HEPTA\r\n");
+        wait(1.0);
+        if (cmdflag == 1) {
+            if (rcmd == 'a') {
+                com.printf("UPLINK\r\n");   
+            }
+            initialize();
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 16b8e1c4d8ac mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 29 07:06:55 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file