diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-29 16:38:09 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-29 16:38:09 +0000 |
commit | cbdb5257cc9ea90aa14eb071d2bfa4f31a32293e (patch) | |
tree | 700b6afe656221410fa3fb2ab6d7401ee013183e /apps/examples | |
parent | 46befd16063c1f5ac68344cf5419a33a56d3a1ab (diff) | |
download | nuttx-cbdb5257cc9ea90aa14eb071d2bfa4f31a32293e.tar.gz nuttx-cbdb5257cc9ea90aa14eb071d2bfa4f31a32293e.tar.bz2 nuttx-cbdb5257cc9ea90aa14eb071d2bfa4f31a32293e.zip |
Add logic to limit the number of samples
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3996 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples')
-rw-r--r-- | apps/examples/README.txt | 5 | ||||
-rw-r--r-- | apps/examples/touchscreen/tc.h | 5 | ||||
-rw-r--r-- | apps/examples/touchscreen/tc_main.c | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/apps/examples/README.txt b/apps/examples/README.txt index fbd770309..d7da89152 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -779,6 +779,11 @@ examples/touchscreen CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. Default: "/dev/input0" + CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN + is defined, then the number of samples is provided on the command line + and this value is ignored. Otherwise, this number of samples is + collected and the program terminates. Default: Samples are collected + indefinitely. The following additional configurations must be set in the NuttX configuration file: diff --git a/apps/examples/touchscreen/tc.h b/apps/examples/touchscreen/tc.h index d431c9a5b..173ed491f 100644 --- a/apps/examples/touchscreen/tc.h +++ b/apps/examples/touchscreen/tc.h @@ -55,6 +55,11 @@ * CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen * device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. * Default: "/dev/input0" + * CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN + * is defined, then the number of samples is provided on the command line + * and this value is ignored. Otherwise, this number of samples is + * collected and the program terminates. Default: Samples are collected + * indefinitely. */ #ifndef CONFIG_INPUT diff --git a/apps/examples/touchscreen/tc_main.c b/apps/examples/touchscreen/tc_main.c index 7547ee489..920a504fb 100644 --- a/apps/examples/touchscreen/tc_main.c +++ b/apps/examples/touchscreen/tc_main.c @@ -95,7 +95,7 @@ int MAIN_NAME(int argc, char *argv[]) { struct touch_sample_s sample; ssize_t nbytes; -#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN +#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) || defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) long nsamples; #endif int fd; @@ -142,8 +142,10 @@ int MAIN_NAME(int argc, char *argv[]) * touchscreen samples. */ -#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN +#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) for (; namples > 0; nsamples--) +#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) + for (namples = 0; namples < CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES; nsamples++) #else for (;;) #endif |