From de8328a59e268d68a669221a34652ebdc24c0716 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 20 Sep 2006 13:54:04 +0000 Subject: [PATCH] Usage examples of MAKE_CMD. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@701 38d2e660-2303-0410-9eaa-f027e97ec537 --- app/triface/protocol.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/triface/protocol.c b/app/triface/protocol.c index e659888b..981152e3 100755 --- a/app/triface/protocol.c +++ b/app/triface/protocol.c @@ -16,6 +16,9 @@ /*#* *#* $Log$ + *#* Revision 1.6 2006/09/20 13:54:04 marco + *#* Usage examples of MAKE_CMD. + *#* *#* Revision 1.5 2006/06/14 01:03:01 marco *#* Add response code. Add command ping. *#* @@ -46,7 +49,7 @@ #include #include -#include +//#include #include "cmd_ctor.h" // MAKE_CMD, REGISTER_CMD @@ -218,14 +221,15 @@ void protocol_run(Serial *ser) * */ -/* Version. */ -MAKE_CMD(ver, "", "s", -({ - args[1].s = VERS_TAG; - 0; -})) +/* Version. Example of declaring function and passing it to MAKE_CMD. */ +static int ver_fn(const char **str) +{ + *str = VERS_TAG; + return 0; +} +MAKE_CMD(ver, "", "s", ver_fn(&args[1].s)) -/* Sleep. */ +/* Sleep. Example of declaring function body directly in macro call. */ MAKE_CMD(sleep, "d", "", ({ timer_delay((mtime_t)args[1].l); -- 2.25.1