listen serial input and react by callback registered.

Dependents:   Interference_Simple StrCommandHandler_Demo SerialInputReactionHandler_DEMO

Revision:
1:fd211f137803
Parent:
0:ec916055f0dd
Child:
2:4718a4eaf340
--- a/SerialInputReactionHandler.h	Tue Nov 12 01:10:29 2019 +0000
+++ b/SerialInputReactionHandler.h	Tue Nov 12 02:41:58 2019 +0000
@@ -39,7 +39,7 @@
      *  or a byte written thru communication with like PCs.
      */
     void sig_bind();
-
+    
     Callback<int (char const * const)> callback_onCommand;
     static int echoCommand (char const * const);
 
@@ -48,6 +48,8 @@
     InputMode m_input_mode;
     uint8_t m_buffer_c;
     string  m_buffer_s;
+    
+    bool isArrowSymbol();
 };
 
 inline int SerialInputReactionHandler::echoCommand (char const * const arg_str)
@@ -55,5 +57,10 @@
     printf("%s", arg_str);
     return 0;
 }
+inline void SerialInputReactionHandler::discardBuffer()
+{
+    m_buffer_c = '\0';
+    m_buffer_s = "";
+}
 
 #endif