doppler shift / Mbed 2 deprecated calsat32_5

Dependencies:   mbed

main.cpp

Committer:
KINU
Date:
2020-12-16
Revision:
2:43801dc371d0
Parent:
1:fec69401b978
Child:
3:61e7dda0c14d

File content as of revision 2:43801dc371d0:

#include "mbed.h"
/*ドップラーシフト対策  calsatが計算した周波数のデータを受け取る*/
Serial pc(SERIAL_TX, SERIAL_RX);
Serial device(PA_9,PA_10);

void doppler(){ //データを取得し、出力する関数
    while(1){
        char c = device.getc();
        if(c == 0x00) 
        ;
        if(c == 0xfd){ //FD(終了コマンドがきたら終了
            break;
            }
        else{
            printf("%02hhx ",c);
            }
        }
    }
    
int main()
{
    device.baud(9600);
    pc.baud(921600);
    while(1) {
        char c = device.getc();

        if(c == 0xfe) { //FEコマンドがきたらdataが始まる
            
            while(1) {
                c = device.getc();
                if(c  == 0x00){ //サブコマンドがきたらデータ部分を読み取り始める
                    
                    doppler(); 
                    printf("\r\n");
                    break;
                    }
            
            }
        }
    }
}