![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Repository for testing ADF code of COM_TMTC_SIMPLE
Fork of COM_MNG_TMTC_SIMPLE by
main.cpp@2:2caf2a9a13aa, 2015-12-22 (annotated)
- Committer:
- shreeshas95
- Date:
- Tue Dec 22 06:09:48 2015 +0000
- Revision:
- 2:2caf2a9a13aa
- Parent:
- 1:a0055b3280c8
- Child:
- 3:6c81fc8834e2
Before updating for science compression
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shreeshas95 | 0:f016e9e8d48b | 1 | #include "mbed.h" |
shreeshas95 | 0:f016e9e8d48b | 2 | #include "rtos.h" |
shreeshas95 | 1:a0055b3280c8 | 3 | #include "mbed_debug.h" |
shreeshas95 | 0:f016e9e8d48b | 4 | |
shreeshas95 | 0:f016e9e8d48b | 5 | #include "Structures.h" |
shreeshas95 | 0:f016e9e8d48b | 6 | #include "DefinitionsAndGlobals.h" |
shreeshas95 | 0:f016e9e8d48b | 7 | #include "crc.h" |
shreeshas95 | 1:a0055b3280c8 | 8 | #include "COM_SND_TM_functions.h" |
shreeshas95 | 1:a0055b3280c8 | 9 | #include "COM_SND_TM.h" |
shreeshas95 | 1:a0055b3280c8 | 10 | #include "SDCread.h" |
shreeshas95 | 1:a0055b3280c8 | 11 | #include "adf.h" |
shreeshas95 | 1:a0055b3280c8 | 12 | #include "Compression.h" |
shreeshas95 | 1:a0055b3280c8 | 13 | #include "SDC_init.h" |
shreeshas95 | 0:f016e9e8d48b | 14 | #include "COM_RCV_TC.h" |
shreeshas95 | 0:f016e9e8d48b | 15 | #include "COM_MNG_TMTC.h" |
shreeshas95 | 0:f016e9e8d48b | 16 | #include "ThreadsAndFunctions.h" |
shreeshas95 | 0:f016e9e8d48b | 17 | |
shreeshas95 | 0:f016e9e8d48b | 18 | |
shreeshas95 | 0:f016e9e8d48b | 19 | int main() |
shreeshas95 | 0:f016e9e8d48b | 20 | { |
shreeshas95 | 0:f016e9e8d48b | 21 | // ******************INITIALISATIONS START****************** |
shreeshas95 | 0:f016e9e8d48b | 22 | // COM RX |
shreeshas95 | 0:f016e9e8d48b | 23 | RX1M.baud(1200); |
shreeshas95 | 0:f016e9e8d48b | 24 | gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE; |
shreeshas95 | 0:f016e9e8d48b | 25 | gRX_HEAD_DATA_NODE->next_node = NULL; |
shreeshas95 | 0:f016e9e8d48b | 26 | gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE; |
shreeshas95 | 2:2caf2a9a13aa | 27 | gRX_COUNT = 0; |
shreeshas95 | 2:2caf2a9a13aa | 28 | // gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values; |
shreeshas95 | 0:f016e9e8d48b | 29 | RX1M.attach(&rx_read, Serial::RxIrq); |
shreeshas95 | 0:f016e9e8d48b | 30 | |
shreeshas95 | 0:f016e9e8d48b | 31 | // DEBUG |
shreeshas95 | 2:2caf2a9a13aa | 32 | gPC.baud(1200); |
shreeshas95 | 0:f016e9e8d48b | 33 | gPC.puts("welcome to mng_tm_tc\r\n"); |
shreeshas95 | 0:f016e9e8d48b | 34 | |
shreeshas95 | 0:f016e9e8d48b | 35 | // COMMON SPI |
shreeshas95 | 0:f016e9e8d48b | 36 | spi.format(8,0); |
shreeshas95 | 0:f016e9e8d48b | 37 | spi.frequency(1000000); |
shreeshas95 | 0:f016e9e8d48b | 38 | |
shreeshas95 | 0:f016e9e8d48b | 39 | // SD CARD |
shreeshas95 | 2:2caf2a9a13aa | 40 | gCS_SDC = 1; |
shreeshas95 | 2:2caf2a9a13aa | 41 | gCS_RTC = 1; |
shreeshas95 | 0:f016e9e8d48b | 42 | // initialise_card(); |
shreeshas95 | 0:f016e9e8d48b | 43 | // int result= initialise_card(); |
shreeshas95 | 0:f016e9e8d48b | 44 | // disk_initialize(); |
shreeshas95 | 0:f016e9e8d48b | 45 | |
shreeshas95 | 0:f016e9e8d48b | 46 | // COM_TX |
shreeshas95 | 0:f016e9e8d48b | 47 | // *********************THE TEST |
shreeshas95 | 0:f016e9e8d48b | 48 | // cs_adf=1; |
shreeshas95 | 0:f016e9e8d48b | 49 | // *********************THE TEST |
shreeshas95 | 0:f016e9e8d48b | 50 | |
shreeshas95 | 0:f016e9e8d48b | 51 | // COM_MNG_TMTC THREAD |
shreeshas95 | 0:f016e9e8d48b | 52 | gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN); |
shreeshas95 | 0:f016e9e8d48b | 53 | gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal); |
shreeshas95 | 0:f016e9e8d48b | 54 | // *******************INITIALISATIONS END******************** |
shreeshas95 | 0:f016e9e8d48b | 55 | |
shreeshas95 | 2:2caf2a9a13aa | 56 | //adf test |
shreeshas95 | 2:2caf2a9a13aa | 57 | gPC.puts("Testing ADF\r\n"); |
shreeshas95 | 2:2caf2a9a13aa | 58 | Base_tm *testTM = new Short_tm; |
shreeshas95 | 2:2caf2a9a13aa | 59 | uint8_t temp8; |
shreeshas95 | 2:2caf2a9a13aa | 60 | temp8 = 0xA; |
shreeshas95 | 2:2caf2a9a13aa | 61 | PUTtmid(testTM->fields, temp8); |
shreeshas95 | 2:2caf2a9a13aa | 62 | temp8 = 0x00; |
shreeshas95 | 2:2caf2a9a13aa | 63 | PUTshort_or_long_tm(testTM->fields, temp8); |
shreeshas95 | 2:2caf2a9a13aa | 64 | testTM->TM_string[0] = TMID_ACK_L1 << 4; |
shreeshas95 | 2:2caf2a9a13aa | 65 | testTM->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF; |
shreeshas95 | 2:2caf2a9a13aa | 66 | testTM->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF; |
shreeshas95 | 2:2caf2a9a13aa | 67 | testTM->TM_string[3] = (gMASTER_STATE << 4) & 0xF0; |
shreeshas95 | 2:2caf2a9a13aa | 68 | testTM->next_TM = NULL; |
shreeshas95 | 2:2caf2a9a13aa | 69 | gPC.puts("sending now\r\n"); |
shreeshas95 | 2:2caf2a9a13aa | 70 | snd_tm.head_pointer(testTM); |
shreeshas95 | 2:2caf2a9a13aa | 71 | adf_not_SDcard(); |
shreeshas95 | 2:2caf2a9a13aa | 72 | gPC.puts("Completed testing ADF\r\n"); |
shreeshas95 | 2:2caf2a9a13aa | 73 | |
shreeshas95 | 0:f016e9e8d48b | 74 | int theAcount = 0; |
shreeshas95 | 0:f016e9e8d48b | 75 | while(true){ |
shreeshas95 | 2:2caf2a9a13aa | 76 | if(theAcount >= 700000){ |
shreeshas95 | 0:f016e9e8d48b | 77 | theAcount = 0; |
shreeshas95 | 2:2caf2a9a13aa | 78 | //gLEDR = !gLEDR; |
shreeshas95 | 0:f016e9e8d48b | 79 | } |
shreeshas95 | 0:f016e9e8d48b | 80 | else{ |
shreeshas95 | 0:f016e9e8d48b | 81 | theAcount++; |
shreeshas95 | 0:f016e9e8d48b | 82 | } |
shreeshas95 | 0:f016e9e8d48b | 83 | } |
shreeshas95 | 0:f016e9e8d48b | 84 | } |