From: asterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Date: Sun, 28 Nov 2010 19:35:54 +0000 (+0000)
Subject: Update preset and comply to new parser module.
X-Git-Tag: 2.7.0~349
X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6f4b45f35bbac1e99cde60e90443e003c68a93b1;p=bertos.git

Update preset and comply to new parser module.

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4588 38d2e660-2303-0410-9eaa-f027e97ec537
---

diff --git a/boards/triface/examples/triface/cfg/cfg_parser.h b/boards/triface/examples/triface/cfg/cfg_parser.h
index 572b4a24..67e091a5 100644
--- a/boards/triface/examples/triface/cfg/cfg_parser.h
+++ b/boards/triface/examples/triface/cfg/cfg_parser.h
@@ -38,7 +38,27 @@
 #ifndef CFG_PARSER_H
 #define CFG_PARSER_H
 
+/**
+ * Max number of arguments and results for each command
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 0
+ */
+#define CONFIG_PARSER_MAX_ARGS       4
+
+/**
+ * Max number of commands
+ * $WIZ$ type = "int"
+ * $WIZ$ min = 8
+ */
+#define CONFIG_MAX_COMMANDS_NUMBER  16
 
+/**
+ * Enable compatibility behaviour.
+ *
+ * Skip the first word from incoming commands. Don't enable in new projects.
+ * $WIZ$ type = "boolean"
+ */
+#define CONFIG_ENABLE_COMPAT_BEHAVIOUR 1
 
 #endif /* CFG_PARSER_H */
 
diff --git a/boards/triface/examples/triface/protocol.c b/boards/triface/examples/triface/protocol.c
index 78d262e2..fe9f125e 100644
--- a/boards/triface/examples/triface/protocol.c
+++ b/boards/triface/examples/triface/protocol.c
@@ -46,6 +46,10 @@
 
 #include "hw/hw_input.h"
 
+#include "cfg/cfg_parser.h"
+#include <cfg/compiler.h>
+#include <cfg/debug.h>
+
 #include <drv/adc.h>
 #include <drv/timer.h>
 #include <drv/ser.h>
@@ -56,9 +60,6 @@
 #include <mware/readline.h>
 #include <mware/parser.h>
 
-#include <cfg/compiler.h>
-#include <cfg/debug.h>
-
 #include <io/kfile.h>
 
 #include <stdlib.h>
@@ -149,7 +150,7 @@ static void protocol_parse(KFile *fd, const char *buf)
 		return;
 	}
 
-	parms args[PARSER_MAX_ARGS];
+	parms args[CONFIG_PARSER_MAX_ARGS];
 
 	/* Args Check.  TODO: Handle different case. see doc/PROTOCOL .  */
 	if (!parser_get_cmd_arguments(buf, templ, args))