Hi Shubham I am just using this to test PYLD code

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // TESTING PUSH PULL IN MAIN CPP
00002 
00003 #include "mbed.h"
00004 
00005 #define DEBUG 1
00006 
00007 #include "SimpleDMA.h"
00008 #include "dmaSPIslave.h"
00009 #include "rtos.h"
00010 #include "mbed_debug.h"
00011 
00012 #include "Structures.h"
00013 #include "pinconfig.h"
00014 #include "DefinitionsAndGlobals.h"
00015 #include "crc.h"
00016 #include "i2c.h"
00017 #include "COM_SND_TM_functions.h"
00018 #include "COM_SND_TM.h"
00019 #include "cdms_sd.h"
00020 #include "common_functions.h"
00021 //#include "CDMS_HK.h"
00022 #include "OBSRS.h"
00023 #include "adf.h"
00024 #include "COM_RCV_TC.h"
00025 #include "COM_MNG_TMTC.h"
00026 #include "COM_POWER_ON_TX.h"
00027 #include "COM_POWER_OFF_TX.h"
00028 #include "Compression.h"
00029 #include "ThreadsAndFunctions.h"
00030 
00031 //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
00032 int main()
00033 {
00034     //gLEDR = 1;
00035     
00036     // ******************INITIALISATIONS START******************
00037     // COM RX
00038     RX1M.baud(1200);
00039     gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;
00040     gRX_HEAD_DATA_NODE->next_node = NULL;
00041     gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;
00042     gRX_COUNT = 0;
00043 //    gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
00044     RX1M.attach(&rx_read, Serial::RxIrq);
00045     
00046     gPC.baud(1200);
00047     
00048     // COMMON SPI
00049     spi.format(8,0);
00050     spi.frequency(1000000);
00051 
00052     // SD CARD
00053     cs_sd = 1;
00054     gCS_RTC = 1;
00055     gCS_ADF = 1;
00056     
00057     FCTN_CDMS_INIT_RTC();/* rtc initialization*/
00058     FCTN_CDMS_SD_INIT();/* sd card initialization*/
00059     
00060     if (DEBUG)
00061         gPC.puts("welcome to mng_tmtc\r\n");
00062         
00063     // COM_MNG_TMTC THREAD
00064     gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
00065     gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
00066     if (DEBUG)
00067         gPC.puts("allocating threads\r\n");
00068     gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
00069    // gPC.puts("step one complete\r\n");
00070     gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
00071     if (DEBUG)
00072         gPC.puts("competed allocating threads\r\n");
00073         
00074     // *******************INITIALISATIONS END********************
00075     
00076     //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
00077     //gCDMS_HK_TIMER.start(5000);
00078     
00079     /*starting the thread with signal*/
00080 //    set_sig();
00081     
00082     /*Calculating Stack used*/
00083     
00084     int state;
00085     /*while (true) { 
00086     Thread::wait(500); 
00087     state = gSCIENCE_THREAD->get_state(); 
00088     //gPC.printf("Thread state %d\r\n", state); 
00089     if(state == Thread::Inactive) 
00090     {delete gSCIENCE_THREAD;
00091     break;}
00092     }*/
00093     
00094     
00095     
00096     while(true){
00097         Thread::wait(osWaitForever);
00098         //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';
00099          gLEDG = !gLEDG;
00100         //gPC.putc(state); 
00101     }
00102 }