Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NNN40_CLI by
Diff: CLI_Source/command-interpreter.cpp
- Revision:
- 3:38ec8ad317f4
- Parent:
- 0:5c195ab2f696
- Child:
- 5:ee474e3133eb
--- a/CLI_Source/command-interpreter.cpp	Fri Sep 11 07:52:06 2015 +0000
+++ b/CLI_Source/command-interpreter.cpp	Fri Oct 02 10:36:29 2015 +0000
@@ -168,6 +168,28 @@
 	return result;
 }
 
+//gill 20150918
+uint32_t cyntecHexToUint32(uint8_t *str, uint8_t len)
+{
+	if (len > 8)
+		return 0;
+	uint32_t result = 0;
+	uint16_t i = 0;
+	
+	while( *str != '\0' && i < len)
+	{
+		result *= 16;
+		result = result + ( *str - '0' );
+		str++;
+		i++;
+	}
+	
+	return result;
+}
+
+
+
+
 uint8_t cyntecStrCmp(uint8_t *src, uint8_t *dst, uint8_t len)
 {
 	uint8_t i = 0;
@@ -234,7 +256,7 @@
 	} else {
 		getNestedCommand(entry, &commandFinger);
 		
-		console.printf("%s - %s\r\n",entry->name,entry->description);
+		console.printf("%s-%s\r\n",entry->name,entry->description);
 	}
 	
   if ( commandFinger != NULL ) {
@@ -347,50 +369,12 @@
 	}
 }
 
+
 /*
  * Process the given char as a command.
  */
-//void cyntecProcessCommandInput(uint8_t input) {
-//	bool isEol = false;
-//  bool isSpace = false;
-//
-//	if (previousCharacter == '\r' && input == '\n') {
-//		previousCharacter = input;
-//    return;
-//  }
-//	
-//  previousCharacter = input;	
-//  isEol = ((input == '\r') || (input == '\n'));
-//  isSpace = (input == ' ');
-//	
-//	switch (commandState.state) {
-//    case CMD_AWAITING_ARGUMENT:
-//      if (isEol) {
-//        callCommandAction();
-//      } else if (! isSpace) {
-//        commandState.state = CMD_READING_ARGUMENT;
-//        cyntecWriteToBuffer(input);
-//      }
-//      break;
-//		case CMD_READING_ARGUMENT:
-//      if (isEol || isSpace) {
-//        cyntecEndArgument(input);
-//      } else {
-//        cyntecWriteToBuffer(input);
-//      }			
-//			break;
-//    case CMD_READING_TO_EOL:
-//      if (isEol) {
-//        if (commandState.error != CYNTEC_CMD_SUCCESS) {
-//          cyntecCommandErrorHandler(commandState.error);
-//        }
-//        cyntecCommandReaderInit();
-//      }
-//      break;			
-//	}
-//}
-
 void cyntecProcessCommandInput(uint8_t input) {
+	
 	bool isEol = false;
   bool isSpace = false;
 
@@ -406,7 +390,7 @@
 	switch (commandState.state) {
     case CMD_AWAITING_ARGUMENT:
       if (!isEol)
-        cyntecWriteToTotalBuffer(input);
+        cyntecWriteToTotalBuffer(input); // total buffer including space
       if (isEol) {
         callCommandAction();
       } else if (! isSpace) {
@@ -468,10 +452,7 @@
 uint8_t *cyntecGetCommandTotalBuffer(void)
 uint8_t cyntecGetTotalIndex(void)
 */
-//uint8_t *cyntecGetCommandBuffer()
-//{
-//	return commandState.buffer;
-//}
+
 	
 void cyntecWriteToTotalBuffer(uint8_t input)
 {
@@ -492,4 +473,5 @@
 uint8_t cyntecGetTotalIndex(void)
 {
 	return commandState.totalIndex;
-}
\ No newline at end of file
+}
+
    