Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
78:f1c0affd99e7
Parent:
77:8c792719a1fc
Child:
79:82b01c1a62f6
--- a/src/d7a_com.cpp	Wed Dec 21 10:47:29 2016 +0000
+++ b/src/d7a_com.cpp	Wed Dec 21 14:11:09 2016 +0000
@@ -28,12 +28,11 @@
 static uint16_t                     g_com_skipped_bytes;
 static uint8_t                      g_com_tx_seq;
 static uint8_t                      g_com_rx_seq;
-static uint32_t                     g_com_timeout;
 static Semaphore                    g_com_data_parsing(0);
 static Semaphore                    g_com_cts_int(0);
 static RawSerial*                   g_com_serial;
-static Thread                       g_com_rx_thread(osPriorityRealtime, DEFAULT_STACK_SIZE, NULL);
-static Thread                       g_com_tx_thread(osPriorityHigh, DEFAULT_STACK_SIZE, NULL);
+static Thread                       g_com_rx_thread(osPriorityRealtime, 512, NULL);
+static Thread                       g_com_tx_thread(osPriorityHigh, 512, NULL);
 static Queue<d7a_com_tx_buf_t, 8>   g_com_tx_queue;
 static Timer                        g_com_tim;
 
@@ -66,27 +65,22 @@
 void rx_isr()
 {
 // Loop just in case more than one character is in UART's receive FIFO buffer
-// Stop if buffer full
     while (g_com_serial->readable())
     {
-        
         g_com_rx_buf.push(g_com_serial->getc());
         //PRINT("-");
-        
-        //if (g_com_rx_started)
-        {
-            // unlock data parsing thread
-            if (g_com_state == SEARCH_HEADER && g_com_rx_buf.available_data() >= KAL_COM_HEADER_LEN)
-            {
-                g_com_state = PARSE_HEADER;
-                g_com_data_parsing.release();
-            }
-            else if (g_com_state == SEARCH_BODY && g_com_rx_buf.available_data() >= g_com_msg.blen)
-            {
-                g_com_state = PARSE_BODY;
-                g_com_data_parsing.release();
-            }
-        }
+    }
+    
+    // unlock data parsing thread
+    if (g_com_state == SEARCH_HEADER && g_com_rx_buf.available_data() >= KAL_COM_HEADER_LEN)
+    {
+        g_com_state = PARSE_HEADER;
+        g_com_data_parsing.release();
+    }
+    else if (g_com_state == SEARCH_BODY && g_com_rx_buf.available_data() >= g_com_msg.blen)
+    {
+        g_com_state = PARSE_BODY;
+        g_com_data_parsing.release();
     }
 }
 
@@ -150,31 +144,6 @@
     return D7A_ERR_NONE;
 }
 
-void d7a_com_start_rx(void)
-{
-    FPRINT("\r\n");
-    g_com_rx_started = true;
-    g_com_rx_thread.signal_set(START_SIGNAL);
-}
-
-void d7a_com_stop_rx(void)
-{
-    FPRINT("\r\n");
-    g_com_rx_started = false;
-}
-
-void d7a_com_start_tx(void)
-{
-    FPRINT("\r\n");
-    g_com_tx_started = true;
-    g_com_tx_thread.signal_set(START_SIGNAL);
-}
-
-void d7a_com_stop_tx(void)
-{
-    FPRINT("\r\n");
-    g_com_tx_started = false;
-}
 
 void d7a_com_restart(void)
 {