for frequency correction testing
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: main.cpp
- Revision:
- 249:565458eefd94
- Parent:
- 248:da9d1bd999da
- Child:
- 251:c766afa330a3
diff -r da9d1bd999da -r 565458eefd94 main.cpp --- a/main.cpp Sun Jul 10 13:47:26 2016 +0000 +++ b/main.cpp Sun Jul 10 21:32:28 2016 +0000 @@ -85,28 +85,20 @@ transmit_adf;\ gPC.puts("exit_adf\r\n");\ } -//void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);} + int main() { CDMS_I2C_GPIO = 0; PL_I2C_GPIO = 0; - //gLEDR = 1; - - // ******************INITIALISATIONS START****************** - // COM RX - RX1M.baud(1200); gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE; gRX_HEAD_DATA_NODE->next_node = NULL; gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE; gRX_COUNT = 0; -// gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values; RX1M.attach(&rx_read, Serial::RxIrq); - // DEBUG - //gPC.puts("welcome to mng_tm_tc\r\n"); gPC.baud(115200);//changed for bypassing COM // COMMON SPI @@ -118,34 +110,42 @@ gCS_RTC = 1; gCS_ADF = 1; - FCTN_CDMS_INIT_RTC();/* rtc initialization*/ - FCTN_CDMS_SD_INIT();/* sd card initialization*/ + //FCTN_CDMS_INIT_RTC();/* rtc initialization*/ + //FCTN_CDMS_SD_INIT();/* sd card initialization*/ - uint8_t test[512] = {0}; - disk_write(test,7000); //to be used only just before launch + //uint8_t test[512] = {0}; + //disk_write(test,7000); //to be used only just before launch #if DEBUG gPC.puts("welcome to mng_tmtc\r\n"); #endif - + #if DEBUG + gPC.puts("allocating threads\r\n"); + #endif // COM_MNG_TMTC THREAD gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN); gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh); - #if DEBUG - gPC.puts("allocating threads\r\n"); - #endif + + gHK_THREAD = new Thread(FCTN_CDMS_HK_MAIN); + gHK_THREAD->set_priority(osPriorityAboveNormal); + gSCIENCE_THREAD = new Thread(SCIENCE_FUN); - // gPC.puts("step one complete\r\n"); gSCIENCE_THREAD->set_priority(osPriorityAboveNormal); + #if DEBUG gPC.puts("competed allocating threads\r\n"); #endif + master.frequency(400000); + + /*HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL); + HK_counter->start(10000);*/ + //PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL); //PL_wo_dma->start(6000);// //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL); @@ -161,39 +161,8 @@ } gPC.printf("PL_TC sent");*/ - // *******************INITIALISATIONS END******************** - - //FCTN_CDMS_HK_MAIN((void *)NULL); - //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic); - //gCDMS_HK_TIMER.start(5000); - - /*test_pl_main(); - - RtosTimer gCDMS_PL_TIMER(FCTN_CDMS_PL_MAIN, osTimerPeriodic); - gCDMS_PL_TIMER.start(10000); - */ - /*starting the thread with signal*/ - //set_sig(); - //payload_isr_fun(); - - /*Calculating Stack used*/ - - int state; - /*while (true) { - Thread::wait(500); - state = gSCIENCE_THREAD->get_state(); - //gPC.printf("Thread state %d\r\n", state); - if(state == Thread::Inactive) - {delete gSCIENCE_THREAD; - break;} - }*/ - - - while(true){ Thread::wait(osWaitForever); - //state = gCOM_MNG_TMTC_THREAD->get_state() + '0'; gLEDG = !gLEDG; - //gPC.putc(state); } } \ No newline at end of file