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
Revision 7:0129730f8ad9, committed 2021-03-26
- Comitter:
- KINU
- Date:
- Fri Mar 26 07:36:05 2021 +0000
- Parent:
- 6:85891eee5322
- Commit message:
- ghjk
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 25 14:56:16 2021 +0000 +++ b/main.cpp Fri Mar 26 07:36:05 2021 +0000 @@ -45,76 +45,26 @@ printf("%lf %lf\r\n",calsat_freq,human_freq); uint32_t freq_bit; uint32_t tmp = 0; - if(key == '0') { - - printf("\r\n"); - + if(key == '0' || key == '3') { tmp = reg0 >> 27; //この行と次の行でレジスタのデータの部分を全て0にしている tmp = tmp << 27; - /*for(int i = 32; i > 0; i--) {//デバッグ用 - if(tmp & (1 << (i - 1))) { - pc.printf("1"); - } else { - pc.printf("0"); - } - } - printf("\r\n"); //001110000000000…が出力*/ - + + if(key == '0') freq_bit = binary(calsat_freq)<<4; - /* printf("freq_bit=");//デバッグ用 - for(int i = 32; i > 0; i--) { - if(freq_bit & (1 << (i - 1))) { - pc.printf("1"); - } else { - pc.printf("0"); //00000[23bit]0000が出力 - } - } - printf("\r\n");*/ - /*printf("freq_bit0=");//デバッグ用 - for(int i = 32; i > 0; i--) { - if(freq_bit & (1 << (i - 1))) { - pc.printf("1"); - } else { - pc.printf("0"); - } - } - printf("\r\n");*/ - - - /*freq_bit = freq_bit<<4; - printf("freq_bit4 = ");//デバッグ用 - for(int i = 32; i > 0; i--) { - if(freq_bit & (1 << (i - 1))) { - pc.printf("1"); - } else { - pc.printf("0"); - } - } - printf("\r\n");*/ + if(key == '3') + freq_bit = binary(human_freq)<<4; + tmp |= freq_bit; register_data_array[2] = tmp; - + } else if(key == '1') { - freq_bit = binary(calsat_freq); tmp = freq_bit<<4; } else if(key =='2') { //calsatから受けとる freq_bit = binary(human_freq); tmp = freq_bit<<4; - } - /*else if(key == '3') { - uint32_t tmp = 0; - tmp = reg0 >> 27; //この行と次の行でレジスタのデータの部分を全て0にしている - tmp = tmp << 27; - freq_bit = binary(human_freq); - freq_bit = freq_bit<<4; - tmp |= freq_bit; - register_data_array[2] = tmp;//配列の中に格納する - show_all(); - */ - else {} - + } else {} for(int i = 32; i > 0; i--) { if(tmp & (1 << (i - 1))) { pc.printf("1"); @@ -273,9 +223,14 @@ void check(char key,double calsat_freq) { printf("key = %c\r\n",key); - if(_command[4] == 0x00) { - printf("---------------------------Start-----------------------------\r\n"); - file_read(key,calsat_freq); + if(key == '1' || key == '2') { + if(_command[4] == 0x00) { + printf("---------------------------Start-----------------------------\r\n"); + file_read(key,calsat_freq); + } + } + if(key == '0'||key == '3') { + _register = Reg0_gen(key, calsat_freq, human_freq); //reg0をcalsatの値で更新 } } }; @@ -284,22 +239,17 @@ Serial device( p9, p10, 9600); printf("Start\r\n"); calsat32 tmp; - tmp.file_read('0',435); + tmp.file_read('0',435); while(1) { - + while(device.readable()) { char c = device.getc(); double calsat_freq = tmp.packet(c); if(pc.readable()) { char key = pc.getc(); - if(key == '1' ||key == '2') { tmp.check(key,calsat_freq); - //file読み込み、calsator人の更新 - } else if(key == '3') //reg0を人にする - tmp.check(key,calsat_freq); - else if(key == '0') //reg0を人にする - tmp.check(key,calsat_freq); + } } }