
Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Revision 70:c4a9b78d1c89, committed 2016-01-14
- Comitter:
- krishanprajapat
- Date:
- Thu Jan 14 14:47:06 2016 +0000
- Parent:
- 23:c89376564196
- Commit message:
- 14 jan just a copy
Changed in this revision
COM_SND_TM.h | Show annotated file Show diff for this revision Revisions of this file |
adf.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/COM_SND_TM.h Wed Jan 06 13:24:24 2016 +0000 +++ b/COM_SND_TM.h Thu Jan 14 14:47:06 2016 +0000 @@ -11,7 +11,7 @@ const unsigned char EoS[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x91,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x91,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; const unsigned char FCCH80[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; const unsigned char SCH40[] = {0x0a,0x3f,0x46,0xb4,0x00}; - + class SND_TM{ Base_tm * head_ptr;
--- a/adf.h Wed Jan 06 13:24:24 2016 +0000 +++ b/adf.h Thu Jan 14 14:47:06 2016 +0000 @@ -420,13 +420,25 @@ }\ } - void check(){ if(IRQ){ gCOM_MNG_TMTC_THREAD->signal_set(signal); } } - + +void configure_adf(){ + finish_write_data = false; + buffer_state = true; + last_buffer = false; + loop_on = true; + ADF_off = false; + /*initial adf check*/ + initial_adf_check; + gPC.puts("initial adf check\r\n"); + initiate; +// gPC.puts("initiate done\r\n"); + gPC.puts("adf configured\r\n"); +} #define send_data {\ if(sent_tmfrom_SDcard){\ @@ -470,35 +482,35 @@ #define adf_SND_SDCard {\ - buffer_state = true;\ - last_buffer = false;\ - loop_on = true;\ - ADF_off = false;\ sent_tmfrom_SDcard = true;\ + configure_adf();\ signal = COM_MNG_TMTC_SIGNAL_ADF_SD;\ - start_block_num = starting_add;\ - end_block_num = ending_add;\ - initial_adf_check;\ - initiate;\ send_data;\ - while(loop_on){\ - /*led2=!led2;*/\ - gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\ - if(ADF_off){\ - SPI_mutex.lock();\ - ticker.detach();\ - gCS_ADF=0;\ - spi.write(0xB1);\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ - gPC.puts("transmission done\r\n");\ - loop_on = false;\ - }else{\ - write_data;\ - if(!last_buffer)\ - send_tm_from_SD_card();\ - }\ - }\ + + while(loop_on){ + gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD); +// if( ADF_non_responsive_flag == false ){ + if(finish_write_data){ + if(ADF_off){ + SPI_mutex.lock(); + ticker.detach(); + // wait_ms(35); + gCS_ADF=0; + spi.write(0xB1); + gCS_ADF=1; + SPI_mutex.unlock(); + loop_on = false; + gPC.puts("Transmission done\r\n"); + } + else{ + ADF_off = true; + } + } + else{ + write_data; + snd_tm.transmit_data(buffer_112,&last_buffer); + } + } } void read_TC(Base_tc* TC_ptr){ @@ -523,19 +535,7 @@ // gCOM_MNG_TMTC_THREAD->signal_set(signal); //} -void configure_adf(){ - finish_write_data = false; - buffer_state = true; - last_buffer = false; - loop_on = true; - ADF_off = false; - /*initial adf check*/ - initial_adf_check; - gPC.puts("initial adf check\r\n"); - initiate; -// gPC.puts("initiate done\r\n"); - gPC.puts("adf configured\r\n"); -} + void adf_not_SDcard(){ sent_tmfrom_SDcard = false; @@ -547,7 +547,7 @@ // ADF_non_responsive_timeout.attach(&ADF_non_responsive_fun, 10); while(loop_on){ - gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_NSD); + gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD); // if( ADF_non_responsive_flag == false ){ if(finish_write_data){ if(ADF_off){ @@ -574,4 +574,36 @@ // break; // } } -} \ No newline at end of file +} +// +//#define adf_SND_SDCard {\ +// buffer_state = true;\ +// last_buffer = false;\ +// loop_on = true;\ +// ADF_off = false;\ +// sent_tmfrom_SDcard = true;\ +// signal = COM_MNG_TMTC_SIGNAL_ADF_SD;\ +// start_block_num = starting_add;\ +// end_block_num = ending_add;\ +// initial_adf_check;\ +// initiate;\ +// send_data;\ +// while(loop_on){\ +// /*led2=!led2;*/\ +// gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\ +// if(ADF_off){\ +// SPI_mutex.lock();\ +// ticker.detach();\ +// gCS_ADF=0;\ +// spi.write(0xB1);\ +// gCS_ADF=1;\ +// SPI_mutex.unlock();\ +// gPC.puts("transmission done\r\n");\ +// loop_on = false;\ +// }else{\ +// write_data;\ +// if(!last_buffer)\ +// send_tm_from_SD_card();\ +// }\ +// }\ +//} \ No newline at end of file