sertwer

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Sergeev
Date:
Tue Dec 09 16:50:57 2014 +0000
Commit message:
hvbpui

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 a2f2d5b2bb5e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 09 16:50:57 2014 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"              
+ 
+Serial pc(USBTX, USBRX);
+ 
+DigitalOut pc_activity(LED1);
+DigitalOut uart_activity(LED2);
+ 
+int state = 0;
+    
+int main() {
+
+    
+    // set pc baud 115200
+    pc.baud(115200);
+    
+   
+    int packet_state = 0;  // STATE OF PACKET, ZERO = WAIT FOR 'snp'
+     
+    while(packet_state == 0) {
+         //  pc.putc(uart.getc()); // Serial pass thru
+     
+      
+      // READ 'snp' (START NEW PACKET) FROM UM6 AHRS
+      
+           if (pc.getc() == 0x73 ) {  
+            // pc.putc(0x73);
+             pc.putc('s');
+             state = 1; 
+          }
+           
+           if (pc.getc() == 0x6E ) {  
+             // pc.putc(0x6E);
+              pc.putc('n');
+             state ++; 
+             // uart_activity = !uart_activity;
+          }
+          
+          
+           if (pc.getc() == 0x70 ) {  
+            // pc.putc(0x70);
+             pc.putc('p');
+             state ++; 
+            //  uart_activity = !uart_activity;
+          }
+          
+          
+          // PT (packet type)
+          if (pc.getc() == 0xC8 ) {
+          state = 0;
+          pc.putc('P');
+          pc.putc('T');
+          state ++;
+          }
+         
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r a2f2d5b2bb5e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 09 16:50:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804
\ No newline at end of file