From f8523254d0c4584e1a56d835ab0af9e8a8625c4b Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 6 Sep 2011 21:00:48 +0000 Subject: Fix a error the the STM32 I2C timeout logic git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3940 42af7a65-404d-4744-a932-0658087f49c3 --- apps/system/i2c/i2c_common.c | 2 +- apps/system/i2c/i2c_main.c | 4 ++-- apps/system/i2c/i2ctool.h | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/system/i2c/i2c_common.c b/apps/system/i2c/i2c_common.c index a04f7769a..6d5396346 100644 --- a/apps/system/i2c/i2c_common.c +++ b/apps/system/i2c/i2c_common.c @@ -187,7 +187,7 @@ int arg_decimal(FAR char **arg, FAR long *value) { FAR char *string; int ret; - + ret = arg_string(arg, &string); *value = strtol(string, NULL, 10); return ret; diff --git a/apps/system/i2c/i2c_main.c b/apps/system/i2c/i2c_main.c index 85ad90365..7e4a0c91b 100644 --- a/apps/system/i2c/i2c_main.c +++ b/apps/system/i2c/i2c_main.c @@ -253,7 +253,7 @@ FAR char *i2c_argument(FAR struct i2ctool_s *i2ctool, int argc, char *argv[], in int i2c_parse(FAR struct i2ctool_s *i2ctool, int argc, char *argv[]) { - FAR char *newargs[MAX_ARGUMENTS+1]; + FAR char *newargs[MAX_ARGUMENTS+2]; FAR char *cmd; int nargs; int index; @@ -278,7 +278,7 @@ int i2c_parse(FAR struct i2ctool_s *i2ctool, int argc, char *argv[]) /* Parse all of the arguments following the command name. */ newargs[0] = cmd; - for (nargs = 1; nargs < MAX_ARGUMENTS; nargs++) + for (nargs = 1; nargs <= MAX_ARGUMENTS; nargs++) { newargs[nargs] = i2c_argument(i2ctool, argc, argv, &index); if (!newargs[nargs]) diff --git a/apps/system/i2c/i2ctool.h b/apps/system/i2c/i2ctool.h index 5abd731aa..81b7c0682 100644 --- a/apps/system/i2c/i2ctool.h +++ b/apps/system/i2c/i2ctool.h @@ -91,10 +91,11 @@ #endif /* This is the maximum number of arguments that will be accepted for a - * command + * command. The only real limit is in the OS configuration that limits + * the number of parameters passed to a task. */ -#define MAX_ARGUMENTS 6 +#define MAX_ARGUMENTS (CONFIG_MAX_TASK_ARGS-1) /* Maximum size of one command line */ -- cgit v1.2.3