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: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: main.cpp
- Revision:
- 239:a3a012a0fecc
- Parent:
- 238:4abbc6a3a641
- Child:
- 240:946a9342a95f
diff -r 4abbc6a3a641 -r a3a012a0fecc main.cpp
--- a/main.cpp Thu Jul 07 17:13:00 2016 +0000
+++ b/main.cpp Thu Jul 07 17:25:37 2016 +0000
@@ -85,21 +85,29 @@
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);
- gPC.baud(115200);//changed for bypassing COM
+ // DEBUG
+ //gPC.puts("welcome to mng_tm_tc\r\n");
+ gPC.baud(9600);//changed for bypassing COM
// COMMON SPI
spi.format(8,0);
@@ -111,41 +119,33 @@
gCS_ADF = 1;
FCTN_CDMS_INIT_RTC();/* rtc initialization*/
- FCTN_CDMS_SD_INIT();/* sd card 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
+
+
+ // 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
-
- // COM_MNG_TMTC THREAD
- gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
- gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh);
-
- 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
-
+ #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,8 +161,39 @@
}
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
