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:
parent
5e94183319
commit
39c47ee3f7
@ -6,7 +6,7 @@
|
||||
config EXAMPLES_ADC
|
||||
bool "ADC example"
|
||||
default n
|
||||
depends on ADC
|
||||
depends on ADC && LIB_BOARDCTL
|
||||
---help---
|
||||
Enable the ADC example
|
||||
|
||||
|
@ -91,15 +91,4 @@ struct adc_state_s
|
||||
* 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 */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* 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>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/boardctl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -250,10 +251,10 @@ int adc_main(int argc, char *argv[])
|
||||
*/
|
||||
|
||||
printf("adc_main: Initializing external ADC device\n");
|
||||
ret = adc_devinit();
|
||||
ret = boardctl(BOARDIOC_ADCTEST_SETUP, 0);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("adc_main: adc_devinit failed: %d\n", ret);
|
||||
printf("adc_main: boardctl failed: %d\n", ret);
|
||||
errval = 1;
|
||||
goto errout;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user