test_code / Mbed 2 deprecated nucleo_test_soft_serial

Dependencies:   mbed

Fork of nucleo_test_soft_serial by Eric Nativel

main.cpp

Committer:
eric11fr
Date:
2021-03-05
Revision:
1:2bd6dc642bb9
Parent:
0:a563059f0473

File content as of revision 1:2bd6dc642bb9:

#include "mbed.h"
#include "soft_uart.h"
Serial pc(USBTX, USBRX);
char tmp;
int main() {
 
    pc.baud(9600);
    pc.printf("test");
    init_uart();
    pc.printf("cpuclock:%d",SystemCoreClock);
    //printStr("d\n\r");
    wait(1);
    //printStr("Voila!\n\r");
    //printStr("Voila!\n\r");
    printStr("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
    printStr("$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
   // printStr("$PMTK314,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n");
     wait(1);
    while(1){
       // printStr("V");
     // printStr("$PMTK314,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
        //pc.putc(  _getchar()  );
        do
    {
        tmp= _getchar();
        pc.printf("%c",tmp);
       
    }while(tmp!='\r');
        //wait(0.1);
    }
}