examples/adc/adc_main.c: Appease nxstyle
This commit is contained in:
parent
7fa6f69756
commit
5576c127fd
@ -106,12 +106,14 @@ static void adc_devpath(FAR struct adc_state_s *adc, FAR const char *devpath)
|
|||||||
static void adc_help(FAR struct adc_state_s *adc)
|
static void adc_help(FAR struct adc_state_s *adc)
|
||||||
{
|
{
|
||||||
printf("Usage: adc [OPTIONS]\n");
|
printf("Usage: adc [OPTIONS]\n");
|
||||||
printf("\nArguments are \"sticky\". For example, once the ADC device is\n");
|
printf("\nArguments are \"sticky\". "
|
||||||
|
"For example, once the ADC device is\n");
|
||||||
printf("specified, that device will be re-used until it is changed.\n");
|
printf("specified, that device will be re-used until it is changed.\n");
|
||||||
printf("\n\"sticky\" OPTIONS include:\n");
|
printf("\n\"sticky\" OPTIONS include:\n");
|
||||||
printf(" [-p devpath] selects the ADC device. "
|
printf(" [-p devpath] selects the ADC device. "
|
||||||
"Default: %s Current: %s\n",
|
"Default: %s Current: %s\n",
|
||||||
CONFIG_EXAMPLES_ADC_DEVPATH, g_adcstate.devpath ? g_adcstate.devpath : "NONE");
|
CONFIG_EXAMPLES_ADC_DEVPATH,
|
||||||
|
g_adcstate.devpath ? g_adcstate.devpath : "NONE");
|
||||||
printf(" [-n count] selects the samples to collect. "
|
printf(" [-n count] selects the samples to collect. "
|
||||||
"Default: 1 Current: %d\n", adc->count);
|
"Default: 1 Current: %d\n", adc->count);
|
||||||
printf(" [-h] shows this message and exits\n");
|
printf(" [-h] shows this message and exits\n");
|
||||||
@ -155,7 +157,8 @@ static int arg_decimal(FAR char **arg, FAR long *value)
|
|||||||
* Name: parse_args
|
* Name: parse_args
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void parse_args(FAR struct adc_state_s *adc, int argc, FAR char **argv)
|
static void parse_args(FAR struct adc_state_s *adc, int argc,
|
||||||
|
FAR char **argv)
|
||||||
{
|
{
|
||||||
FAR char *ptr;
|
FAR char *ptr;
|
||||||
FAR char *str;
|
FAR char *str;
|
||||||
@ -228,8 +231,8 @@ int main(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
if (!g_adcstate.initialized)
|
if (!g_adcstate.initialized)
|
||||||
{
|
{
|
||||||
/* Initialization of the ADC hardware must be performed by board-specific
|
/* Initialization of the ADC hardware must be performed by
|
||||||
* logic prior to running this test.
|
* board-specific logic prior to running this test.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Set the default values */
|
/* Set the default values */
|
||||||
@ -268,7 +271,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
* ADC samples.
|
* ADC samples.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
/* Flush any output before the loop entered or from the previous pass
|
/* Flush any output before the loop entered or from the previous pass
|
||||||
* through the loop.
|
* through the loop.
|
||||||
@ -319,7 +322,8 @@ int main(int argc, FAR char *argv[])
|
|||||||
int nsamples = nbytes / sizeof(struct adc_msg_s);
|
int nsamples = nbytes / sizeof(struct adc_msg_s);
|
||||||
if (nsamples * sizeof(struct adc_msg_s) != nbytes)
|
if (nsamples * sizeof(struct adc_msg_s) != nbytes)
|
||||||
{
|
{
|
||||||
printf("adc_main: read size=%ld is not a multiple of sample size=%d, Ignoring\n",
|
printf("adc_main: read size=%ld is not a multiple of "
|
||||||
|
"sample size=%d, Ignoring\n",
|
||||||
(long)nbytes, sizeof(struct adc_msg_s));
|
(long)nbytes, sizeof(struct adc_msg_s));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -328,7 +332,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
for (i = 0; i < nsamples; i++)
|
for (i = 0; i < nsamples; i++)
|
||||||
{
|
{
|
||||||
printf("%d: channel: %d value: %d\n",
|
printf("%d: channel: %d value: %d\n",
|
||||||
i+1, sample[i].am_channel, sample[i].am_data);
|
i + 1, sample[i].am_channel, sample[i].am_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user