From 6f4b45f35bbac1e99cde60e90443e003c68a93b1 Mon Sep 17 00:00:00 2001 From: asterix Date: Sun, 28 Nov 2010 19:35:54 +0000 Subject: [PATCH] Update preset and comply to new parser module. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4588 38d2e660-2303-0410-9eaa-f027e97ec537 --- .../triface/examples/triface/cfg/cfg_parser.h | 20 +++++++++++++++++++ boards/triface/examples/triface/protocol.c | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) 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 +#include + #include #include #include @@ -56,9 +60,6 @@ #include #include -#include -#include - #include #include @@ -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)) -- 2.25.1