9
0
Fork 0

Add logic to limit the number of samples

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3996 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-09-29 16:38:09 +00:00
parent 63418d358b
commit 6ed15c2c6b
4 changed files with 20 additions and 2 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -551,10 +551,16 @@ CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0"
# 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.
#
CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
#
# Additional examples/touchscreen needed only for the simulated target