diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-29 23:06:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-29 23:06:54 +0000 |
commit | 61e71aad8571ec108e00df46983f5c3252c32e7c (patch) | |
tree | 01cb8f6553b741bd989f25130b3a04bba23d9bfa /apps/system/i2c/i2c_get.c | |
parent | a9327f5a8598ff8e9bce1a2a1db53e047ee8f01d (diff) | |
download | nuttx-61e71aad8571ec108e00df46983f5c3252c32e7c.tar.gz nuttx-61e71aad8571ec108e00df46983f5c3252c32e7c.tar.bz2 nuttx-61e71aad8571ec108e00df46983f5c3252c32e7c.zip |
More I2C tool logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3924 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/system/i2c/i2c_get.c')
-rw-r--r-- | apps/system/i2c/i2c_get.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/system/i2c/i2c_get.c b/apps/system/i2c/i2c_get.c index 9e98705cc..4f07ab630 100644 --- a/apps/system/i2c/i2c_get.c +++ b/apps/system/i2c/i2c_get.c @@ -39,6 +39,8 @@ #include <nuttx/config.h> +#include <nuttx/i2c.h> + #include "i2ctool.h" /**************************************************************************** @@ -73,7 +75,35 @@ * Name: cmd_get ****************************************************************************/ -int cmd_get(FAR void *handle, int argc, char **argv) +int cmd_get(FAR struct i2ctool_s *i2ctool, int argc, char **argv) { + FAR struct i2c_dev_s *dev; + int nargs; + int i; + + /* Parse any command line arguments */ + + for (i = 1; i < argc; ) + { + nargs = common_args(i2ctool, &argv[i]); + if (nargs < 0) + { + return ERROR; + } + i += nargs; + } + + /* Get a handle to the I2C bus */ + + dev = up_i2cinitialize(i2ctool->bus); + if (!dev) + { + i2ctool_printf(i2ctool, "Failed to get bus %d\n", i2ctool->bus); + return ERROR; + } + +#warning "missing logic" + + (void)up_i2cuninitialize(dev); return OK; } |