doppler shift / Mbed 2 deprecated Register_set_8

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ryouheitakamoto
Date:
Tue Feb 16 03:24:52 2021 +0000
Parent:
1:5e06e6104734
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Feb 15 13:09:07 2021 +0000
+++ b/main.cpp	Tue Feb 16 03:24:52 2021 +0000
@@ -48,17 +48,24 @@
 
     void packet(char data, int i)
     {
-        printf("%d\r\n",i);
-        command[i] = data;
+        //printf("%d\r\n",i);
+        //command[i] = data;
+        //printf("%02hhx ",data);
+        if(data == 0xfd) {
+            printf("\r\n");
+            for(int j = 0; j < i; j++)
+                printf("%02hhx",command[j]);
+                printf("\r\n%02hhx",command[4]);
+            printf("\r\n");
+            //printf("%02hhx\r\n",command[4]);
+            if(command[4] == 0x00 ) {
 
-        if(data == 0xfd && ( command[4] == 0x00 ||command[11] == 0x00 )) {
+                file_read(command);
 
-            file_read(command);
+            }
 
         }
-     
     }
-
     void Shift_bit(uint32_t& Register, int Register_data, int Size)
     {
         Register |= (Register_data << Size);
@@ -168,23 +175,19 @@
 int main()
 {
     Serial device( p9, p10, 9600);
-    int i = 0;
-    while(1) {
-        if(device.readable()) {
-
-            calsat32 tmp;
-            char c = device.getc();
-            calsat_callback(c);
-            tmp.packet(c,i);
-            printf("\r\n");
 
+    while(1) {
+        int i = 0;
+        calsat32 tmp;
+        while(device.readable()) {
+            char c = device.getc();
+            //calsat_callback(c);
+            tmp.packet(c,i);
             i++;
-           /* if(i == 256)
-            break;*/
-
+        }
+        if(i != 0 )
+            i = 0;
+        //printf("%d   ",i);
 
-        }//printf("one packet done");
-    
     }
-    return 0;
-}
+}
\ No newline at end of file