TELECOMMAND MANAGER V1
Dependencies: mbed SLCD mbed-rtos
Diff: main.cpp
- Revision:
- 11:109f16cc35d7
- Parent:
- 10:024c2ef51cb1
--- a/main.cpp Thu Jul 16 14:14:41 2015 +0000 +++ b/main.cpp Fri Jul 17 07:31:49 2015 +0000 @@ -44,6 +44,7 @@ bool execute_obosc = false; Thread *mng_tmtc_thread = NULL; + Thread *COM_RCV_TC_thread = NULL; } Timeout rx_timeout; @@ -51,39 +52,24 @@ bool first_time = true; Timeout pass_time; -#include "crc.h" -#include "SND_TM.h" -#include "COM_RCV_TC.h" -#include "MNG_TC.h" -#include "ThreadFunctions.h" - void after_pass(){ pass_time.detach(); pass_over = true; } -void after_receive(void){ - rx_timeout.detach(); - VAR_SPACE::rx_new_node->val = 0x00; - - if(first_time){ - first_time = false; - pass_time.attach(&after_pass, PASS_TIME_LIMIT); - } - - VAR_SPACE::new_tc_received = true; - VAR_SPACE::mng_tmtc_thread->signal_set(0x01); -} - -unsigned char rx_char = 0; -bool byte_rx = false; +#include "crc.h" +#include "Convolution.h" +#include "SND_TM.h" +#include "COM_RCV_TC.h" +#include "MNG_TC.h" +#include "ThreadFunctions.h" void rx_read() { // store value // rx_char = UART1->D; - rx_char = rx1m.getc(); + VAR_SPACE::rx_new_node->val = rx1m.getc(); - byte_rx = true; + VAR_SPACE::COM_RCV_TC_thread->signal_set(0x01); } int main(){ @@ -100,6 +86,7 @@ VAR_SPACE::mng_tmtc_thread = new Thread(com_mng_fun); MNG_TC::init(); + VAR_SPACE::COM_RCV_TC_thread = new Thread(com_rcv_tc_fun); lcd.printf("0"); @@ -112,20 +99,6 @@ while(true){ // ledg = !ledg; - if(byte_rx){ - ledg = !ledg; - byte_rx = false; - - VAR_SPACE::rx_new_node->val = rx_char; - - //~ allocate new node - VAR_SPACE::rx_new_node->next = new data_list; - VAR_SPACE::rx_new_node = VAR_SPACE::rx_new_node->next; - VAR_SPACE::rx_new_node->next = NULL; - - rx_timeout.attach(&after_receive, RX_TIMEOUT_LIMIT); - } - if(pass_over){ pass_over = false; first_time = true;