TELECOMMAND MANAGER V1

Dependencies:   mbed SLCD mbed-rtos

Revision:
0:b5b370873460
Child:
1:df31097c8442
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Apr 15 10:43:22 2015 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "MNG_TC.h"
+
+DigitalOut led(LED_RED);
+//Serial PC(USBTX, USBRX);
+DigitalOut led2(LED_GREEN);
+
+int main()
+{
+    led = 1;
+    led2 = 0;
+    unsigned char str[13];
+    for(int i = 0 ; i < 13 ; ++i){
+        str[i] = PC.getc();
+    }
+    
+    TC_list *tc_node = new TC_list;
+    tc_node->TC_string = str[1];
+    
+    CRC crc_class;
+    unsigned int crc_check = crc_class.crcGenerate(str[1], 9);
+    char c1 = (crc_check >> 8) & 0xffff;
+    char c2 = (crc_check) & 0xffff;
+    if(c1 == str[10] && c2 == str[11]){
+        tc_node->crc_pass = true;
+        printf("received tc successfully crc pass\r\n");
+    }
+    else{
+        printf("crc fail\r\n");
+    }
+    
+    tc_node->short_or_long = true;
+    tc_node->next_TC = NULL;
+    
+    led = 0;
+    led2 = 1;
+    
+    wait(10);
+    
+    MNG_TC mng_tc(tc_node);
+    mng_tc.TC_list_cleanup();
+    mng_tc.decode_TC();
+    mng_tc.check_for_missing_tc();
+    mng_tc.execute_TC();
+    
+    led2 = 0;
+    while (true) {
+        led = !led; // toggle led
+        wait(0.2f);
+    }
+}
\ No newline at end of file