Dummy program to demonstrate problems: working code
Dependencies: SLCD mbed-rtos mbed
Fork of MNG_TC by
Diff: main.cpp
- Revision:
- 1:df31097c8442
- Parent:
- 0:b5b370873460
- Child:
- 2:994e741028c7
--- a/main.cpp Wed Apr 15 10:43:22 2015 +0000 +++ b/main.cpp Sat Jun 06 04:27:40 2015 +0000 @@ -1,12 +1,19 @@ #include "mbed.h" #include "MNG_TC.h" +#include <bitset> +#include <iostream> +using namespace std; DigitalOut led(LED_RED); -//Serial PC(USBTX, USBRX); +Serial PC(USBTX, USBRX); DigitalOut led2(LED_GREEN); +//Serial UART_RX(PTE0, PTE1); int main() { + UART_TX.baud(38400); +// UART_RX.baud(1200); + led = 1; led2 = 0; unsigned char str[13]; @@ -14,19 +21,21 @@ str[i] = PC.getc(); } - TC_list *tc_node = new TC_list; - tc_node->TC_string = str[1]; +// UART_RX.baud(38400); - CRC crc_class; - unsigned int crc_check = crc_class.crcGenerate(str[1], 9); + TC_list *tc_node = new TC_list; + tc_node->TC_string = &(str[1]); + +// CRC crc_class; + uint16_t crc_check = CRC::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"); +// printf("received tc successfully crc pass\r\n"); } else{ - printf("crc fail\r\n"); +// printf("crc fail\r\n"); } tc_node->short_or_long = true; @@ -37,11 +46,13 @@ wait(10); +// for(int i = 0 ; i < 13; ++i){ +// std::bitset<8> b = str[i]; +// cout << b << "\r" << endl; +// } + 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) {