Rename adc_devinit() to board_adc_setup(). Add support to the boardctl() interface so that it can call board_adc_setup() on behalf of an application. Change apps/examples/adc to that is now calls boardctl() instead of adc_devinit() in order to initalize the ADC device.

This commit is contained in:
Gregory Nutt 2015-03-31 15:00:23 -06:00
parent 5e94183319
commit 39c47ee3f7
3 changed files with 5 additions and 15 deletions

View File

@ -6,7 +6,7 @@
config EXAMPLES_ADC config EXAMPLES_ADC
bool "ADC example" bool "ADC example"
default n default n
depends on ADC depends on ADC && LIB_BOARDCTL
---help--- ---help---
Enable the ADC example Enable the ADC example

View File

@ -91,15 +91,4 @@ struct adc_state_s
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: adc_devinit()
*
* Description:
* Perform architecuture-specific initialization of the ADC hardware. This
* interface must be provided by all configurations using apps/examples/adc
*
****************************************************************************/
int adc_devinit(void);
#endif /* __APPS_EXAMPLES_ADC_ADC_H */ #endif /* __APPS_EXAMPLES_ADC_ADC_H */

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/adc/adc_main.c * examples/adc/adc_main.c
* *
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -41,6 +41,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/boardctl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -250,10 +251,10 @@ int adc_main(int argc, char *argv[])
*/ */
printf("adc_main: Initializing external ADC device\n"); printf("adc_main: Initializing external ADC device\n");
ret = adc_devinit(); ret = boardctl(BOARDIOC_ADCTEST_SETUP, 0);
if (ret != OK) if (ret != OK)
{ {
printf("adc_main: adc_devinit failed: %d\n", ret); printf("adc_main: boardctl failed: %d\n", ret);
errval = 1; errval = 1;
goto errout; goto errout;
} }