Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Committer:
aniruddhv
Date:
Sun Jul 03 05:37:25 2016 +0000
Revision:
212:3d13a06bcd3a
Parent:
144:4c20fcc105ce
ACK_L1, P_COM_HK, Changed BAE TCs to long, COM_POWER_ON_TX, after_cooling_timeout, Update TC status, Execute OBOSC, Removed OBSRS  execution from MNG_TMTC, RCV_TC in ThreadsandFunctions to include byte_limit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shreeshas95 7:fcd26c28411d 1 // TESTING PUSH PULL IN MAIN CPP
shreeshas95 7:fcd26c28411d 2
shreeshas95 0:f016e9e8d48b 3 #include "mbed.h"
ee12b079 98:fd99ddc0e0a1 4
ee12b079 99:efde3df6cd94 5 #define DEBUG 1
ee12b079 98:fd99ddc0e0a1 6
shreeshas95 101:bece931236a2 7 #include "SimpleDMA.h"
shreeshas95 101:bece931236a2 8 #include "dmaSPIslave.h"
shreeshas95 0:f016e9e8d48b 9 #include "rtos.h"
shreeshas95 1:a0055b3280c8 10 #include "mbed_debug.h"
shreeshas95 0:f016e9e8d48b 11
shreeshas95 0:f016e9e8d48b 12 #include "Structures.h"
shreeshas95 103:b55559925dc1 13 #include "pinconfig.h"
shreeshas95 0:f016e9e8d48b 14 #include "DefinitionsAndGlobals.h"
aniruddhv 144:4c20fcc105ce 15 void rx_read();
shreeshas95 0:f016e9e8d48b 16 #include "crc.h"
shreeshas95 103:b55559925dc1 17 #include "i2c.h"
shreeshas95 1:a0055b3280c8 18 #include "COM_SND_TM_functions.h"
shreeshas95 1:a0055b3280c8 19 #include "COM_SND_TM.h"
ee12b079 99:efde3df6cd94 20 #include "cdms_sd.h"
krishanprajapat 117:bfdc807f3d3c 21 #include "common_functions.h"
ee12b079 114:9fb55057b13f 22 //#include "CDMS_HK.h"
shreeshas95 1:a0055b3280c8 23 #include "adf.h"
shreeshas95 0:f016e9e8d48b 24 #include "COM_RCV_TC.h"
shreeshas95 0:f016e9e8d48b 25 #include "COM_MNG_TMTC.h"
aniruddhv 144:4c20fcc105ce 26 #include "COM_POWER_OFF_TX.h"
aniruddhv 212:3d13a06bcd3a 27 #include "OBSRS.h"
shreeshas95 4:104dd82c99b8 28 #include "COM_POWER_ON_TX.h"
ee12b079 96:4ca92f9775e0 29 #include "Compression.h"
shreeshas95 0:f016e9e8d48b 30 #include "ThreadsAndFunctions.h"
shreeshas95 0:f016e9e8d48b 31
shreeshas95 105:5ce0337e7c15 32 //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
shreeshas95 0:f016e9e8d48b 33 int main()
shreeshas95 0:f016e9e8d48b 34 {
ee12b079 97:717c7908c822 35 //gLEDR = 1;
ee12b079 96:4ca92f9775e0 36
shreeshas95 0:f016e9e8d48b 37 // ******************INITIALISATIONS START******************
shreeshas95 0:f016e9e8d48b 38 // COM RX
shreeshas95 0:f016e9e8d48b 39 RX1M.baud(1200);
shreeshas95 0:f016e9e8d48b 40 gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;
shreeshas95 0:f016e9e8d48b 41 gRX_HEAD_DATA_NODE->next_node = NULL;
shreeshas95 0:f016e9e8d48b 42 gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;
shreeshas95 2:2caf2a9a13aa 43 gRX_COUNT = 0;
shreeshas95 2:2caf2a9a13aa 44 // gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
shreeshas95 0:f016e9e8d48b 45 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 0:f016e9e8d48b 46
aniruddhv 52:0bd68655c651 47 gPC.baud(1200);
shreeshas95 0:f016e9e8d48b 48
shreeshas95 0:f016e9e8d48b 49 // COMMON SPI
shreeshas95 0:f016e9e8d48b 50 spi.format(8,0);
shreeshas95 0:f016e9e8d48b 51 spi.frequency(1000000);
shreeshas95 0:f016e9e8d48b 52
shreeshas95 0:f016e9e8d48b 53 // SD CARD
ee12b079 86:a26f5f22631d 54 cs_sd = 1;
shreeshas95 2:2caf2a9a13aa 55 gCS_RTC = 1;
ee12b079 90:df55a5f68331 56 gCS_ADF = 1;
ee12b079 93:4d76de54a699 57
ee12b079 115:2e1144a41d76 58 FCTN_CDMS_INIT_RTC();/* rtc initialization*/
ee12b079 113:b8991d9e3b6c 59 FCTN_CDMS_SD_INIT();/* sd card initialization*/
shreeshas95 0:f016e9e8d48b 60
ee12b079 134:4694fc291ce1 61 if (DEBUG)
ee12b079 134:4694fc291ce1 62 gPC.puts("welcome to mng_tmtc\r\n");
ee12b079 134:4694fc291ce1 63
shreeshas95 0:f016e9e8d48b 64 // COM_MNG_TMTC THREAD
shreeshas95 0:f016e9e8d48b 65 gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
shreeshas95 0:f016e9e8d48b 66 gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
ee12b079 134:4694fc291ce1 67 if (DEBUG)
ee12b079 134:4694fc291ce1 68 gPC.puts("allocating threads\r\n");
ee12b079 113:b8991d9e3b6c 69 gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
ee12b079 94:611c066467a1 70 // gPC.puts("step one complete\r\n");
ee12b079 113:b8991d9e3b6c 71 gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
ee12b079 134:4694fc291ce1 72 if (DEBUG)
ee12b079 134:4694fc291ce1 73 gPC.puts("competed allocating threads\r\n");
ee12b079 134:4694fc291ce1 74
shreeshas95 0:f016e9e8d48b 75 // *******************INITIALISATIONS END********************
shreeshas95 0:f016e9e8d48b 76
ee12b079 113:b8991d9e3b6c 77 //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
ee12b079 113:b8991d9e3b6c 78 //gCDMS_HK_TIMER.start(5000);
shreeshas95 104:a50ae79ca36e 79
ee12b079 97:717c7908c822 80 /*starting the thread with signal*/
shreeshas95 105:5ce0337e7c15 81 // set_sig();
ee12b079 97:717c7908c822 82
ee12b079 94:611c066467a1 83 /*Calculating Stack used*/
ee12b079 94:611c066467a1 84
ee12b079 96:4ca92f9775e0 85 int state;
ee12b079 96:4ca92f9775e0 86 /*while (true) {
ee12b079 96:4ca92f9775e0 87 Thread::wait(500);
ee12b079 96:4ca92f9775e0 88 state = gSCIENCE_THREAD->get_state();
ee12b079 96:4ca92f9775e0 89 //gPC.printf("Thread state %d\r\n", state);
ee12b079 96:4ca92f9775e0 90 if(state == Thread::Inactive)
ee12b079 96:4ca92f9775e0 91 {delete gSCIENCE_THREAD;
ee12b079 96:4ca92f9775e0 92 break;}
ee12b079 96:4ca92f9775e0 93 }*/
ee12b079 96:4ca92f9775e0 94
ee12b079 96:4ca92f9775e0 95
ee12b079 96:4ca92f9775e0 96
shreeshas95 0:f016e9e8d48b 97 while(true){
ee12b079 97:717c7908c822 98 Thread::wait(osWaitForever);
ee12b079 96:4ca92f9775e0 99 //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';
ee12b079 96:4ca92f9775e0 100 gLEDG = !gLEDG;
ee12b079 96:4ca92f9775e0 101 //gPC.putc(state);
shreeshas95 0:f016e9e8d48b 102 }
shreeshas95 0:f016e9e8d48b 103 }