diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-10-04 17:36:07 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-10-04 17:36:07 +0000 |
commit | d0c91546343d545c11c10f7d29d1c06175c1109a (patch) | |
tree | 64bb2a8bfc5fdae5e8a88464b3b89054f602259e /apps/examples/adc | |
parent | f096e07fceb776545fa7b06501dc734ad0e81783 (diff) | |
download | nuttx-d0c91546343d545c11c10f7d29d1c06175c1109a.tar.gz nuttx-d0c91546343d545c11c10f7d29d1c06175c1109a.tar.bz2 nuttx-d0c91546343d545c11c10f7d29d1c06175c1109a.zip |
Change all occurrences of CONFIG_EXAMPLE_ to CONFIG_EXAMPLES_ for consistency; fleshed out a few more Kconfig files
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5211 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/adc')
-rw-r--r-- | apps/examples/adc/Kconfig | 24 | ||||
-rw-r--r-- | apps/examples/adc/adc_main.c | 14 |
2 files changed, 35 insertions, 3 deletions
diff --git a/apps/examples/adc/Kconfig b/apps/examples/adc/Kconfig index b6dca047c..85c875deb 100644 --- a/apps/examples/adc/Kconfig +++ b/apps/examples/adc/Kconfig @@ -6,8 +6,32 @@ config EXAMPLES_ADC bool "ADC example" default n + depends on ADC ---help--- Enable the ADC example if EXAMPLES_ADC + +config EXAMPLES_ADC_DEVPATH + string "ADC device path" + default "/dev/adc0" + ---help--- + The default path to the ADC device. Default: /dev/adc0 + +config EXAMPLES_ADC_NSAMPLES + int "Number of Sample Groups" + default 0 + depends on !NSH_BUILTIN_APPS + ---help--- + If NSH_BUILTIN_APPS 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: 0 (samples + are collected indefinitely). + +config EXAMPLES_ADC_GROUPSIZE + int "Number of Samples per Group" + default 4 + ---help--- + The number of samples to read at once. Default: 4 + endif diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c index 4797265db..404fba8c1 100644 --- a/apps/examples/adc/adc_main.c +++ b/apps/examples/adc/adc_main.c @@ -57,6 +57,14 @@ * Pre-processor Definitions ****************************************************************************/ +/* Use CONFIG_EXAMPLES_ADC_NSAMPLES == 0 to mean to collect samples + * indefinitely. + */ + +#ifndef CONFIG_EXAMPLES_ADC_NSAMPLES +# define CONFIG_EXAMPLES_ADC_NSAMPLES 0 +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -249,7 +257,7 @@ int adc_main(int argc, char *argv[]) adc_devpath(&g_adcstate, CONFIG_EXAMPLES_ADC_DEVPATH); -#ifdef CONFIG_EXAMPLES_ADC_NSAMPLES +#if CONFIG_EXAMPLES_ADC_NSAMPLES > 0 g_adcstate.count = CONFIG_EXAMPLES_ADC_NSAMPLES; #else g_adcstate.count = 1; @@ -267,7 +275,7 @@ int adc_main(int argc, char *argv[]) * samples that we collect before returning. Otherwise, we never return */ -#if defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_EXAMPLES_ADC_NSAMPLES) +#if defined(CONFIG_NSH_BUILTIN_APPS) || CONFIG_EXAMPLES_ADC_NSAMPLES > 0 message("adc_main: g_adcstate.count: %d\n", g_adcstate.count); #endif @@ -290,7 +298,7 @@ int adc_main(int argc, char *argv[]) #if defined(CONFIG_NSH_BUILTIN_APPS) for (; g_adcstate.count > 0; g_adcstate.count--) -#elif defined(CONFIG_EXAMPLES_ADC_NSAMPLES) +#elif CONFIG_EXAMPLES_ADC_NSAMPLES > 0 for (g_adcstate.count = 0; g_adcstate.count < CONFIG_EXAMPLES_ADC_NSAMPLES; g_adcstate.count++) #else for (;;) |