Nikolay Sergeev
/
Nucleo_printf
sertwer
Diff: main.cpp
- Revision:
- 0:a2f2d5b2bb5e
--- /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