Moved header transmission to txhead, about to switch to 16-bit length field.
[goodfet] / firmware / lib / command.c
index c5e35b5..8d9eac1 100644 (file)
@@ -1,11 +1,14 @@
+/*! \file command.c
+  \author Travis Goodspeed
+  \brief These functions manage command interpretation.
+*/
+
 #include "command.h"
 #include "platform.h"
 #include <string.h>
 
-//! Different command handling functions.
-
 unsigned char cmddata[256];
-
+unsigned char silent=0;
 
 //! Transmit a string.
 void txstring(unsigned char app,
@@ -19,20 +22,33 @@ void txstring(unsigned char app,
     serial_tx(*(str++));
 }
 
-//! Transmits a debugging string out of line.
+/*! \brief Transmit a debug string.
+  
+  Transmits a debugging string that is to be printed
+  out of line by the client.  This is just for record-keeping;
+  it is not considered a proper reply to a query.
+ */
 void debugstr(const char *str){
   txstring(0xFF,0xFF,str);
 }
 
+//! Transmit a header.
+void txhead(unsigned char app,
+           unsigned char verb,
+           unsigned int len){
+  serial_tx(app);
+  serial_tx(verb);
+  serial_tx(len);
+}
 
 //! Transmit data.
 void txdata(unsigned char app,
            unsigned char verb,
-           unsigned char len){
+           unsigned int len){
   unsigned int i=0;
-  serial_tx(app);
-  serial_tx(verb);
-  serial_tx(len);
+  if(silent)
+    return;
+  txhead(app,verb,len);
   for(i=0;i<len;i++){
     serial_tx(cmddata[i]);
   }