Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@2:43801dc371d0, 2020-12-16 (annotated)
- Committer:
- KINU
- Date:
- Wed Dec 16 05:39:37 2020 +0000
- Revision:
- 2:43801dc371d0
- Parent:
- 1:fec69401b978
- Child:
- 3:61e7dda0c14d
kkk
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryouheitakamoto | 0:c5c02975ae0c | 1 | #include "mbed.h" |
KINU | 2:43801dc371d0 | 2 | /*ドップラーシフト対策 calsatが計算した周波数のデータを受け取る*/ |
ryouheitakamoto | 0:c5c02975ae0c | 3 | Serial pc(SERIAL_TX, SERIAL_RX); |
ryouheitakamoto | 0:c5c02975ae0c | 4 | Serial device(PA_9,PA_10); |
ryouheitakamoto | 0:c5c02975ae0c | 5 | |
KINU | 2:43801dc371d0 | 6 | void doppler(){ //データを取得し、出力する関数 |
ryouheitakamoto | 0:c5c02975ae0c | 7 | while(1){ |
ryouheitakamoto | 0:c5c02975ae0c | 8 | char c = device.getc(); |
KINU | 2:43801dc371d0 | 9 | if(c == 0x00) |
ryouheitakamoto | 1:fec69401b978 | 10 | ; |
KINU | 2:43801dc371d0 | 11 | if(c == 0xfd){ //FD(終了コマンドがきたら終了 |
ryouheitakamoto | 0:c5c02975ae0c | 12 | break; |
ryouheitakamoto | 0:c5c02975ae0c | 13 | } |
ryouheitakamoto | 0:c5c02975ae0c | 14 | else{ |
ryouheitakamoto | 0:c5c02975ae0c | 15 | printf("%02hhx ",c); |
ryouheitakamoto | 0:c5c02975ae0c | 16 | } |
ryouheitakamoto | 0:c5c02975ae0c | 17 | } |
ryouheitakamoto | 0:c5c02975ae0c | 18 | } |
ryouheitakamoto | 0:c5c02975ae0c | 19 | |
ryouheitakamoto | 0:c5c02975ae0c | 20 | int main() |
ryouheitakamoto | 0:c5c02975ae0c | 21 | { |
ryouheitakamoto | 0:c5c02975ae0c | 22 | device.baud(9600); |
ryouheitakamoto | 0:c5c02975ae0c | 23 | pc.baud(921600); |
ryouheitakamoto | 0:c5c02975ae0c | 24 | while(1) { |
ryouheitakamoto | 0:c5c02975ae0c | 25 | char c = device.getc(); |
ryouheitakamoto | 0:c5c02975ae0c | 26 | |
KINU | 2:43801dc371d0 | 27 | if(c == 0xfe) { //FEコマンドがきたらdataが始まる |
ryouheitakamoto | 1:fec69401b978 | 28 | |
ryouheitakamoto | 0:c5c02975ae0c | 29 | while(1) { |
ryouheitakamoto | 0:c5c02975ae0c | 30 | c = device.getc(); |
KINU | 2:43801dc371d0 | 31 | if(c == 0x00){ //サブコマンドがきたらデータ部分を読み取り始める |
ryouheitakamoto | 1:fec69401b978 | 32 | |
KINU | 2:43801dc371d0 | 33 | doppler(); |
ryouheitakamoto | 0:c5c02975ae0c | 34 | printf("\r\n"); |
ryouheitakamoto | 0:c5c02975ae0c | 35 | break; |
ryouheitakamoto | 0:c5c02975ae0c | 36 | } |
ryouheitakamoto | 1:fec69401b978 | 37 | |
ryouheitakamoto | 0:c5c02975ae0c | 38 | } |
ryouheitakamoto | 0:c5c02975ae0c | 39 | } |
ryouheitakamoto | 0:c5c02975ae0c | 40 | } |
ryouheitakamoto | 0:c5c02975ae0c | 41 | } |
ryouheitakamoto | 0:c5c02975ae0c | 42 | |
ryouheitakamoto | 0:c5c02975ae0c | 43 | |
ryouheitakamoto | 0:c5c02975ae0c | 44 |