diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-30 15:07:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-30 15:07:21 +0000 |
commit | 6da7839685a296ef4324847306de9be7b0e6722b (patch) | |
tree | 9f94cee3c1c7c9f9af0bde818facefddbe3df440 /apps/system/i2c/i2c_common.c | |
parent | 226c8f246cfc548246c021393aab56b0a8be7968 (diff) | |
download | nuttx-6da7839685a296ef4324847306de9be7b0e6722b.tar.gz nuttx-6da7839685a296ef4324847306de9be7b0e6722b.tar.bz2 nuttx-6da7839685a296ef4324847306de9be7b0e6722b.zip |
First cut at I2C tool
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3927 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/system/i2c/i2c_common.c')
-rw-r--r-- | apps/system/i2c/i2c_common.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/system/i2c/i2c_common.c b/apps/system/i2c/i2c_common.c index 2d7a9f171..1a97e40b6 100644 --- a/apps/system/i2c/i2c_common.c +++ b/apps/system/i2c/i2c_common.c @@ -108,6 +108,16 @@ int common_args(FAR struct i2ctool_s *i2ctool, FAR char **arg) i2ctool->bus = (uint8_t) value; return ret; + case 'f': + ret = arg_decimal(arg, &value); + if (value == 0) + { + goto out_of_range; + } + + i2ctool->freq = value; + return ret; + case 'n': i2ctool->start = false; return 1; @@ -141,11 +151,11 @@ int common_args(FAR struct i2ctool_s *i2ctool, FAR char **arg) } invalid_argument: - i2ctool_printf(i2ctool, g_fmtarginvalid, arg); + i2ctool_printf(i2ctool, g_i2carginvalid, arg); return ERROR; out_of_range: - i2ctool_printf(i2ctool, g_fmtargrange, arg); + i2ctool_printf(i2ctool, g_i2cargrange, arg); return ERROR; } |