cdms_i2c_hardware_test
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of standaloneworkingi2c_cdms by
Diff: main.cpp
- Revision:
- 0:f016e9e8d48b
- Child:
- 1:a0055b3280c8
diff -r 000000000000 -r f016e9e8d48b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 01 10:56:10 2015 +0000 @@ -0,0 +1,65 @@ +#include "mbed.h" +#include "rtos.h" + +#include "Structures.h" +#include "DefinitionsAndGlobals.h" +#include "crc.h" +#include "COM_RCV_TC.h" +#include "COM_MNG_TMTC.h" +#include "ThreadsAndFunctions.h" + +DigitalOut led(LED_RED); + +int main() +{ + // ******************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_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values; + RX1M.attach(&rx_read, Serial::RxIrq); + + // DEBUG + gPC.baud(9600); + gPC.puts("welcome to mng_tm_tc\r\n"); + + // COMMON SPI + spi.format(8,0); + spi.frequency(1000000); + + // SD CARD + // cs_SDCard=1; + // initialise_card(); + // int result= initialise_card(); + // disk_initialize(); + + // COM_TX + // *********************THE TEST + // cs_adf=1; + // *********************THE TEST + + // COM_MNG_TMTC THREAD + gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN); + gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal); + // *******************INITIALISATIONS END******************** + + int theAcount = 0; + while(true){ + if(theAcount >= 100000){ + theAcount = 0; + gLEDR = !gLEDR; + } + else{ + theAcount++; + } + if(gFLAGS & END_SESSION){ + gFLAGS = gFLAGS & (~END_SESSION); + gFLAGS = gFLAGS | (0xFF & START_SESSION); + // pass got over reset all + reset_all; + //PENDING: also consider frame_no + } + } +} \ No newline at end of file