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
This commit is contained in:
parent
f42fdde5c5
commit
1a682b3c48
@ -779,6 +779,11 @@ examples/touchscreen
|
|||||||
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
|
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
|
||||||
device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
|
device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
|
||||||
Default: "/dev/input0"
|
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
|
The following additional configurations must be set in the NuttX
|
||||||
configuration file:
|
configuration file:
|
||||||
|
@ -55,6 +55,11 @@
|
|||||||
* CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
|
* CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen
|
||||||
* device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
|
* device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR.
|
||||||
* Default: "/dev/input0"
|
* 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
|
#ifndef CONFIG_INPUT
|
||||||
|
@ -95,7 +95,7 @@ int MAIN_NAME(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct touch_sample_s sample;
|
struct touch_sample_s sample;
|
||||||
ssize_t nbytes;
|
ssize_t nbytes;
|
||||||
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN
|
#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) || defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES)
|
||||||
long nsamples;
|
long nsamples;
|
||||||
#endif
|
#endif
|
||||||
int fd;
|
int fd;
|
||||||
@ -142,8 +142,10 @@ int MAIN_NAME(int argc, char *argv[])
|
|||||||
* touchscreen samples.
|
* touchscreen samples.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN
|
#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN)
|
||||||
for (; namples > 0; nsamples--)
|
for (; namples > 0; nsamples--)
|
||||||
|
#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES)
|
||||||
|
for (namples = 0; namples < CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES; nsamples++)
|
||||||
#else
|
#else
|
||||||
for (;;)
|
for (;;)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user