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
This commit is contained in:
patacongo 2011-09-06 21:00:48 +00:00
parent 15b765c68c
commit ab04444d75
3 changed files with 6 additions and 5 deletions

View File

@ -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[]) 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; FAR char *cmd;
int nargs; int nargs;
int index; 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. */ /* Parse all of the arguments following the command name. */
newargs[0] = cmd; 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); newargs[nargs] = i2c_argument(i2ctool, argc, argv, &index);
if (!newargs[nargs]) if (!newargs[nargs])

View File

@ -91,10 +91,11 @@
#endif #endif
/* This is the maximum number of arguments that will be accepted for a /* 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 */ /* Maximum size of one command line */