Remove all references to board_adc_setup()
This commit is contained in:
parent
55dd1c87b3
commit
ee2852f5ff
@ -1,8 +1,7 @@
|
||||
/****************************************************************************************************
|
||||
* configs/cloudctrl/src/cloudctrl.h
|
||||
* arch/arm/src/board/cloudctrl.n
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Darcy Gong <darcy.gong@gmail.com>
|
||||
*
|
||||
@ -255,6 +254,18 @@ void weak_function stm32_usbinitialize(void);
|
||||
int stm32_usbhost_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_sdinitialize
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/cloudctrl/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Darcy Gong <darcy.gong@gmail.com>
|
||||
*
|
||||
@ -105,24 +105,19 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] = {10}; //{10, 8, 9};
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_ADC12_IN10, GPIO_ADC12_IN8, GPIO_ADC12_IN9};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -127,9 +127,7 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#if defined(HAVE_USBHOST) || defined(HAVE_W25)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Initialize and register the W25 FLASH file system. */
|
||||
|
||||
@ -156,5 +154,17 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -67,6 +67,17 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
/************************************************************************************
|
||||
* Name: lpc43_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC43_ADC0
|
||||
int lpc43_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif
|
||||
|
@ -63,15 +63,14 @@
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: lpc43_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC43 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int lpc43_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -135,8 +135,22 @@ static void lpc43_i2ctool(void)
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Register I2C drivers on behalf of the I2C tool */
|
||||
|
||||
lpc43_i2ctool();
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = lpc43_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/lpc4370-link2/src/lpc4370-link2.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -99,8 +99,28 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_spifi_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SPIFI.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void board_spifi_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc43_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int lpc43_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_LPC4370_LINK2_SRC_LPC3257_LINK2_H */
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Based on configs/stm3220g-eval/src/lpc43_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -63,15 +63,14 @@
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: lpc43_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC43 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int lpc43_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -135,8 +135,22 @@ static void lpc43_i2ctool(void)
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Register I2C drivers on behalf of the I2C tool */
|
||||
|
||||
lpc43_i2ctool();
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = lpc43_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -36,12 +36,16 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_dac.c
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += lpc17_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADC),y)
|
||||
CSRCS += lpc17_adc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += lpc17_appinit.c
|
||||
endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Based on configs/stm3220g-eval/src/lpc17_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -59,32 +59,19 @@
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: lpcxpresso_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int lpcxpresso_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -181,6 +181,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = lpcxpresso_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpcxpresso_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcxpresso-lpc1768/src/lpcxpresso-lpc1768.h
|
||||
* configs/lpcxpresso-lpcxpresso68/src/lpcxpresso-lpcxpresso68.h
|
||||
*
|
||||
* Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -140,8 +140,8 @@
|
||||
* SD Signal Pin Pin
|
||||
* --- ----------- ----- --------
|
||||
* CS PIO1_11* 55 P2.2 (See LPCXPRESSO_SD_CS)
|
||||
* DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in chip/lpc17_ssp.h)
|
||||
* DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in chip/lpc17_ssp.h)
|
||||
* DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in chip/lpcxpresso_ssp.h)
|
||||
* DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in chip/lpcxpresso_ssp.h)
|
||||
* CLK PIO2_11-SCK 7 P0.9 SCK1 (See GPIO_SSP1_SCK in board.h)
|
||||
* CD PIO2_10 52 P2.11 (See LPCXPRESSO_SD_CD)
|
||||
*/
|
||||
@ -242,6 +242,18 @@ void weak_function lpcxpresso_sspdev_initialize(void);
|
||||
int lpcexpresso_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpcxpresso_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int lpcxpresso_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_LPCXPRESSO_LPC1768_SRC_LPCXPRESSO_H */
|
||||
|
||||
|
@ -36,11 +36,12 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_adc.c lpc17_dac.c
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_dac.c
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += lpc17_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += lpc17_usbmsc.c
|
||||
endif
|
||||
@ -49,6 +50,10 @@ ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += lpc17_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADC),y)
|
||||
CSRCS += lpc17_adc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_HIDKBD),y)
|
||||
CSRCS += lpc17_hidkbd.c
|
||||
endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* Based on configs/lpc1720g-eval/src/lpc17_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -61,32 +61,19 @@
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: mbed_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int mbed_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -111,6 +111,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = mbed_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: mbed_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -100,6 +100,18 @@ void weak_function mbed_sspdev_initialize(void);
|
||||
int mbed_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: mbed_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int mbed_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_MBED_SRC_MBED_H */
|
||||
|
||||
|
@ -56,6 +56,7 @@ endif
|
||||
ifeq ($(CONFIG_SPI),y)
|
||||
CSRCS += stm32_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADC),y)
|
||||
CSRCS += stm32_adc.c
|
||||
endif
|
||||
|
@ -244,18 +244,6 @@ void stm32_dma_alloc_init(void);
|
||||
int stm32_dma_alloc_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int board_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_sdio_initialize
|
||||
*
|
||||
@ -281,6 +269,18 @@ int stm32_sdio_initialize(void);
|
||||
void stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_bbsram_int
|
||||
************************************************************************************/
|
||||
|
@ -112,28 +112,14 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN3};
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
return board_adc_initialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32F7_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -102,6 +102,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32F7_BBSRAM
|
||||
/* Initialize battery-backed RAM */
|
||||
|
||||
|
@ -179,4 +179,16 @@ int stm32_dac_setup(void);
|
||||
int stm32_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __CONFIGS_NUCLEO_F303RE_SRC_NUCLEO_F303RE_H */
|
||||
|
@ -320,86 +320,75 @@ static const uint32_t g_pinlist2[1] =
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_adc_setup
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work
|
||||
* with examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
FAR struct adc_dev_s *adc;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Check if we have already initialized */
|
||||
/* DEV1 */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
|
||||
if (!initialized) {
|
||||
for (i = 0; i < DEV1_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_pinlist1[i]);
|
||||
}
|
||||
|
||||
/* DEV1 */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
for (i = 0; i < DEV1_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_pinlist1[i]);
|
||||
}
|
||||
adc = stm32_adcinitialize(DEV1_PORT, g_chanlist1, DEV1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface 1\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
adc = stm32_adcinitialize(DEV1_PORT, g_chanlist1, DEV1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface 1\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register /dev/adc0 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register /dev/adc0 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef DEV2_PORT
|
||||
|
||||
/* DEV2 */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
/* DEV2 */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
|
||||
for (i = 0; i < DEV2_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_pinlist2[i]);
|
||||
}
|
||||
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
adc = stm32_adcinitialize(DEV2_PORT, g_chanlist2, DEV2_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface 2\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc1" */
|
||||
|
||||
ret = adc_register("/dev/adc1", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register /dev/adc1 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
for (i = 0; i < DEV2_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_pinlist2[i]);
|
||||
}
|
||||
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
adc = stm32_adcinitialize(DEV2_PORT, g_chanlist2, DEV2_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface 2\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc1" */
|
||||
|
||||
ret = adc_register("/dev/adc1", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register /dev/adc1 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -95,9 +95,7 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#if defined(HAVE_LEDS) || defined(HAVE_DAC)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LEDS
|
||||
/* Register the LED driver */
|
||||
@ -133,5 +131,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -309,15 +309,15 @@ void stm32_spidev_initialize(void);
|
||||
void stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver(s)
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int board_adc_initialize(void);
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/nucleo-f4x1re/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -71,7 +71,6 @@
|
||||
************************************************************************************/
|
||||
/* Identifying number of each ADC channel. */
|
||||
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
#ifdef CONFIG_AJOYSTICK
|
||||
#ifdef CONFIG_ADC_DMA
|
||||
/* The Itead analog joystick gets inputs on ADC_IN0 and ADC_IN1 */
|
||||
@ -95,87 +94,51 @@ static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN0};
|
||||
|
||||
#endif /* CONFIG_ADC_DMA */
|
||||
#endif /* CONFIG_AJOYSTICK */
|
||||
#endif /* CONFIG_STM32_ADC1*/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Check if we have already initialized */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
|
||||
if (!initialized)
|
||||
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
stm32_configgpio(g_adc1_pinlist[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_adc1_pinlist[i]);
|
||||
}
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
adc = stm32_adcinitialize(1, g_adc1_chanlist, ADC1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
adc = stm32_adcinitialize(1, g_adc1_chanlist, ADC1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_ADC
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
return board_adc_initialize();
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_EXAMPLES_ADC */
|
||||
|
||||
#endif /* CONFIG_STM32_ADC1 */
|
||||
|
@ -456,15 +456,7 @@ int board_ajoy_initialize(void)
|
||||
|
||||
iinfo("Initialize ADC driver: /dev/adc0\n");
|
||||
|
||||
/* Initialize ADC. We will need this to read the ADC inputs */
|
||||
|
||||
ret = board_adc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: board_adc_initialize() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* NOTE: The ADC driver was initialized earlier in the bring-up sequence. */
|
||||
/* Open the ADC driver for reading. */
|
||||
|
||||
fd = open("/dev/adc0", O_RDONLY);
|
||||
|
@ -139,6 +139,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
syslog(LOG_INFO, "[boot] Initialized SDIO\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_QENCODER
|
||||
/* Initialize and register the qencoder driver */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/nucleo-l476rg/src/nucleo-l476rg.h
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Authors: Frank Bennett
|
||||
* Gregory Nutt <gnutt@nuttx.org>
|
||||
* Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
@ -340,15 +340,15 @@ int stm32_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver(s)
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int board_adc_initialize(void);
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/nucleo-l476rg/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -71,7 +71,6 @@
|
||||
************************************************************************************/
|
||||
/* Identifying number of each ADC channel. */
|
||||
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
#ifdef CONFIG_AJOYSTICK
|
||||
#ifdef CONFIG_ADC_DMA
|
||||
/* The Itead analog joystick gets inputs on ADC_IN0 and ADC_IN1 */
|
||||
@ -95,7 +94,6 @@ static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN0};
|
||||
|
||||
#endif /* CONFIG_ADC_DMA */
|
||||
#endif /* CONFIG_AJOYSTICK */
|
||||
#endif /* CONFIG_STM32_ADC1*/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
@ -106,76 +104,45 @@ static const uint32_t g_adc1_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN0};
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Check if we have already initialized */
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
|
||||
if (!initialized)
|
||||
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
/* Configure the pins as analog inputs for the selected channels */
|
||||
stm32_configgpio(g_adc1_pinlist[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < ADC1_NCHANNELS; i++)
|
||||
{
|
||||
stm32_configgpio(g_adc1_pinlist[i]);
|
||||
}
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
/* Call stm32_adcinitialize() to get an instance of the ADC interface */
|
||||
adc = stm32_adcinitialize(1, g_adc1_chanlist, ADC1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
adc = stm32_adcinitialize(1, g_adc1_chanlist, ADC1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_ADC
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
return board_adc_initialize();
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_EXAMPLES_ADC */
|
||||
|
||||
#endif /* CONFIG_STM32_ADC1 */
|
||||
|
@ -455,15 +455,7 @@ int board_ajoy_initialize(void)
|
||||
|
||||
iinfo("Initialize ADC driver: /dev/adc0\n");
|
||||
|
||||
/* Initialize ADC. We will need this to read the ADC inputs */
|
||||
|
||||
ret = board_adc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: board_adc_initialize() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* NOTE: The ADC driver was initialized earlier in the bring-up sequence. */
|
||||
/* Open the ADC driver for reading. */
|
||||
|
||||
fd = open("/dev/adc0", O_RDONLY);
|
||||
|
@ -120,9 +120,9 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
@ -206,6 +206,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AJOYSTICK
|
||||
/* Initialize and register the joystick driver */
|
||||
|
||||
@ -311,6 +321,8 @@ int board_app_initialize(uintptr_t arg)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,18 @@
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_sdio_initialize
|
||||
*
|
||||
@ -233,18 +245,6 @@ void weak_function stm32_usbinitialize(void);
|
||||
int stm32_sdio_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_can_initialize
|
||||
*
|
||||
|
@ -114,28 +114,14 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
return stm32_adc_initialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -188,7 +188,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
stm32_i2ctool();
|
||||
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
/* Configure on-board CAN if CAN support has been selected. */
|
||||
|
||||
@ -200,12 +199,12 @@ int board_app_initialize(uintptr_t arg)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Configure on-board ADCs if ADC support has been selected. */
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_initialize();
|
||||
if (ret != OK)
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -89,15 +89,15 @@ void weak_function stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_initialize(void);
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/olimex-stm32-h405/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -105,37 +105,19 @@ static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};/*, GPIO_ADC
|
||||
GPIO_ADC1_IN13, GPIO_ADC1_IN15};*/
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
return stm32_adc_initialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -103,8 +103,16 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#if defined(CONFIG_CAN) || defined(CONFIG_ADC)
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
@ -117,15 +125,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Configure on-board ADCs if ADC support has been selected. */
|
||||
|
||||
ret = stm32_adc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -254,16 +254,16 @@ int stm32_sdio_initialize(void);
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_initialize(void);
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -105,37 +105,19 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] = {1};
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN1};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
return stm32_adc_initialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -94,10 +94,7 @@ int stm32_bringup(void)
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
FAR struct rtc_lowerhalf_s *lower;
|
||||
#endif
|
||||
#if defined(CONFIG_CAN) || defined(CONFIG_ADC) || defined(HAVE_SDIO) || \
|
||||
defined(HAVE_RTC_DRIVER)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CAN
|
||||
/* Configure on-board CAN if CAN support has been selected. */
|
||||
@ -112,14 +109,12 @@ int stm32_bringup(void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Configure on-board ADCs if ADC support has been selected. */
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_initialize();
|
||||
if (ret != OK)
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initialize ADC: %d\n",
|
||||
ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -186,5 +181,6 @@ int stm32_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -125,15 +125,15 @@ int stm32_usbhost_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_initialize(void);
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/olimex-stm32-p207/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -97,37 +97,19 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] = {10};
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN10};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
return stm32_adc_initialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the ADC functionality.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_adc_initialize(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -132,9 +132,7 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#if defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) || defined(CONFIG_ADC)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
|
||||
/* Configure on-board CAN if CAN support has been selected. */
|
||||
@ -147,12 +145,12 @@ int board_app_initialize(uintptr_t arg)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Configure on-board ADCs if ADC support has been selected. */
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_initialize();
|
||||
if (ret != OK)
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize ADC: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -179,5 +177,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -48,32 +48,21 @@
|
||||
#include "sam_adc.h"
|
||||
#include "sama5d3-xplained.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
int board_adc_initialize(void)
|
||||
int sam_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
@ -108,24 +97,5 @@ int board_adc_initialize(void)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ADC */
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All SAMA5 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_ADC
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
return board_adc_initialize();
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_EXAMPLES_ADC */
|
||||
|
@ -406,15 +406,7 @@ int sam_ajoy_initialization(void)
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
/* Initialize ADC. We will need this to read the ADC inputs */
|
||||
|
||||
ret = board_adc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: board_adc_initialize() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* NOTE: The ADC driver was initialized earlier in the bring-up sequence. */
|
||||
/* Open the ADC driver for reading. */
|
||||
|
||||
fd = open("/dev/adc0", O_RDONLY);
|
||||
|
@ -158,6 +158,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = sam_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: sam_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AJOYSTICK
|
||||
/* Initialize and register the joystick driver */
|
||||
|
||||
|
@ -751,6 +751,18 @@ int sam_usbhost_initialize(void);
|
||||
int sam_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int sam_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_netinitialize
|
||||
*
|
||||
@ -763,18 +775,6 @@ int sam_pwm_setup(void);
|
||||
void weak_function sam_netinitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
int board_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/sama5d3x-ek/src/sam_adc.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -50,33 +50,19 @@
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration ********************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int sam_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
static bool initialized = false;
|
||||
|
@ -194,6 +194,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = sam_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: sam_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
|
@ -844,6 +844,18 @@ void weak_function sam_netinitialize(void);
|
||||
int sam_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int sam_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_wm8904_initialize
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/sama5d4-ek/src/sam_adc.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -50,32 +50,19 @@
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int sam_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_SAMA5_ADC
|
||||
static bool initialized = false;
|
||||
|
@ -298,6 +298,16 @@ int sam_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = sam_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: sam_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WM8904
|
||||
/* Configure WM8904 audio */
|
||||
|
||||
|
@ -1085,6 +1085,18 @@ int sam_usbhost_initialize(void);
|
||||
int sam_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int sam_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sam_netinitialize
|
||||
*
|
||||
|
@ -448,6 +448,18 @@ void weak_function stm32_usbinitialize(void);
|
||||
int stm32_usbhost_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_sdinitialize
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/shenzhou/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -104,24 +104,19 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] = {10}; //{10, 8, 9};
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC12_IN10}; //{GPIO_ADC12_IN10, GPIO_ADC12_IN8, GPIO_ADC12_IN9};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -165,9 +165,7 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) || defined(HAVE_W25)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Initialize and register the W25 FLASH file system. */
|
||||
|
||||
@ -206,5 +204,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -192,6 +192,18 @@ void weak_function stm32_spidev_initialize(void);
|
||||
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extcontextsave
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/stm3210e-eval/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -95,24 +95,19 @@ static const uint8_t g_chanlist[ADC1_NCHANNELS] = {14};
|
||||
static const uint32_t g_pinlist[ADC1_NCHANNELS] = {GPIO_ADC1_IN14};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC1
|
||||
static bool initialized = false;
|
||||
|
@ -206,9 +206,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
#endif
|
||||
#if defined(NSH_HAVEMMCSD) || defined(CONFIG_DJOYSTICK)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Register I2C drivers on behalf of the I2C tool */
|
||||
|
||||
@ -286,6 +284,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
sdio_mediachange(sdio, true);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DJOYSTICK
|
||||
/* Initialize and register the joystick driver */
|
||||
|
||||
@ -299,5 +307,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
syslog(LOG_INFO, "Successfully registered the joystick driver\n");
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -261,6 +261,18 @@ int stm32_usbhost_initialize(void);
|
||||
int stm32_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************
|
||||
* Name: stm32_extmemgpios
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/stm3220g-eval/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -99,24 +99,19 @@ static const uint8_t g_chanlist[ADC3_NCHANNELS] = {7};
|
||||
static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC3
|
||||
static bool initialized = false;
|
||||
|
@ -219,9 +219,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
#ifdef HAVE_MMCSD
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
#endif
|
||||
#if defined(HAVE_MMCSD) || defined (HAVE_USBHOST)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Register I2C drivers on behalf of the I2C tool */
|
||||
|
||||
@ -304,5 +302,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -274,6 +274,18 @@ void stm32_led_initialize(void);
|
||||
int stm32_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************
|
||||
* Name: stm32_extmemgpios
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/stm3240g-eval/src/stm32_adc.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -99,24 +99,19 @@ static const uint8_t g_chanlist[ADC3_NCHANNELS] = {7};
|
||||
static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN7};
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_ADC3
|
||||
static bool initialized = false;
|
||||
|
@ -240,9 +240,7 @@ int board_app_initialize(uintptr_t arg)
|
||||
#ifdef HAVE_MMCSD
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
#endif
|
||||
#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) || defined(HAVE_RTC_DRIVER)
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Register I2C drivers on behalf of the I2C tool */
|
||||
|
||||
@ -355,5 +353,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -46,14 +46,15 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: board_adc_setup
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Function initializes channel 1 of adc1 and registers device as /dev/adc0
|
||||
****************************************************************************/
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int stm32_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
uint8_t channel[1] = {10};
|
||||
|
@ -72,23 +72,36 @@ void stm32_boardinitialize(void)
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int rv = 0;
|
||||
int ret = 0;
|
||||
|
||||
#ifdef CONFIG_MMCSD
|
||||
if ((rv = stm32_mmcsd_initialize(CONFIG_NSH_MMCSDMINOR)) < 0)
|
||||
ret = stm32_mmcsd_initialize(CONFIG_NSH_MMCSDMINOR);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n");
|
||||
return rv;
|
||||
syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
if ((rv = stm32_usbhost_initialize()) < 0)
|
||||
ret = stm32_usbhost_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", rv);
|
||||
return rv;
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = stm32_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -127,5 +127,19 @@ int stm32_usbhost_initialize(void);
|
||||
static inline int stm32_usbhost_initialize(void) { return 0; }
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_ADC
|
||||
int stm32_adc_setup(void);
|
||||
#else
|
||||
static inline int stm32_adc_setup(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#endif /* __CONFIGS_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H */
|
||||
|
||||
|
@ -272,16 +272,4 @@ void stm32_spiinitialize(void);
|
||||
|
||||
void stm32l4_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver(s)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int board_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __CONFIGS_STM32L476VG_DISCO_SRC_STM32L476VG_DISCO_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/tm4c123g-launchpad/src/tm4c123g-launchpad.h
|
||||
*
|
||||
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -213,6 +213,18 @@ void tm4c_led_initialize(void);
|
||||
|
||||
int tm4c_bringup(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: tm4c_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
int tm4c_adc_setup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tm4c_at24_automount
|
||||
*
|
||||
@ -237,17 +249,5 @@ int tm4c_at24_automount(int minor);
|
||||
int tiva_timer_configure(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
int board_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_TM4C123G_LAUNCHPAD_TM4C123G_LAUNCHPAD_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/tm4c123g-launchpad/tm4c_adc.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -50,34 +50,23 @@
|
||||
#include "tm4c123g-launchpad.h"
|
||||
#include "chip/tiva_pinmap.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_initialize
|
||||
* Name: tm4c_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the ADC driver.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
int board_adc_initialize(void)
|
||||
int tm4c_adc_setup(void)
|
||||
{
|
||||
# if defined (CONFIG_TIVA_ADC) && defined (CONFIG_ADC)
|
||||
#ifdef CONFIG_ADC
|
||||
static bool initialized = false;
|
||||
int ret;
|
||||
uint8_t srate = 0;
|
||||
@ -90,11 +79,11 @@ int board_adc_initialize(void)
|
||||
};
|
||||
|
||||
sse_cfg0.priority = 0;
|
||||
# ifdef CONFIG_EXAMPLES_ADC_SWTRIG
|
||||
#ifdef CONFIG_EXAMPLES_ADC_SWTRIG
|
||||
sse_cfg0.trigger = TIVA_ADC_TRIG_SW;
|
||||
# else
|
||||
#else
|
||||
sse_cfg0.trigger = TIVA_ADC_TRIG_ALWAYS;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
adc_cfg.adc = 0;
|
||||
adc_cfg.sse[0] = true;
|
||||
@ -105,11 +94,11 @@ int board_adc_initialize(void)
|
||||
adc_cfg.steps = 1;
|
||||
adc_cfg.stepcfg = step_cfg;
|
||||
|
||||
# ifdef CONFIG_EXAMPLES_ADC_SWTRIG
|
||||
#ifdef CONFIG_EXAMPLES_ADC_SWTRIG
|
||||
srate = TIVA_ADC_SAMPLE_RATE_FASTEST;
|
||||
# else
|
||||
#else
|
||||
srate = TIVA_ADC_SAMPLE_RATE_SLOWEST;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Check if we have already initialized */
|
||||
|
||||
@ -132,35 +121,11 @@ int board_adc_initialize(void)
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_ADC */
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All Tiva architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_ADC
|
||||
int board_adc_setup(void)
|
||||
{
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
return board_adc_initialize();
|
||||
#else
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_EXAMPLES_ADC */
|
||||
|
||||
#if defined (CONFIG_TIVA_ADC) && defined (CONFIG_TIVA_TIMER)
|
||||
|
||||
/* Tiva timer interface does not currently support user configuration */
|
||||
|
||||
#if 0
|
||||
/************************************************************************************
|
||||
* Name: adc_timer_init
|
||||
*
|
||||
@ -169,6 +134,9 @@ int board_adc_setup(void)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* Tiva timer interface does not currently support user configuration */
|
||||
|
||||
#if 0 /* defined(CONFIG_TIVA_TIMER) */
|
||||
TIMER_HANDLE adc_timer_init(void)
|
||||
{
|
||||
struct tiva_gptm32config_s adctimer =
|
||||
@ -189,6 +157,6 @@ TIMER_HANDLE adc_timer_init(void)
|
||||
|
||||
return tiva_gptm_configure((const struct tiva_gptmconfig_s *)&adctimer);
|
||||
}
|
||||
#endif /* CONFIG_TIVA_TIMER */
|
||||
|
||||
#endif
|
||||
#endif /* defined (CONFIG_TIVA_ADC) && defined (CONFIG_TIVA_TIMER) */
|
||||
#endif /* CONFIG_TIVA_ADC */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* config/tm4c123g-launchpad/src/tm4c_bringup.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -63,6 +63,16 @@ int tm4c_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_TIVA_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = tm4c_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: tm4c_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AT24
|
||||
/* Initialize the AT24 driver */
|
||||
|
||||
@ -85,5 +95,6 @@ int tm4c_bringup(void)
|
||||
}
|
||||
#endif /* CONFIG_TIVA_TIMER */
|
||||
|
||||
UNUSED(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c
|
||||
CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_dac.c
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += lpc17_appinit.c
|
||||
@ -46,6 +46,10 @@ ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += lpc17_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ADC),y)
|
||||
CSRCS += lpc17_adc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MODEM_U_BLOX),y)
|
||||
CSRCS += lpc17_ubxmdm.c
|
||||
endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* which, in turn, was based on configs/stm3220g-eval/src/lpc17_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -66,15 +66,14 @@
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: lpc17_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int lpc17_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -207,6 +207,16 @@ int board_app_initialize(uintptr_t arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = lpc17_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpc17_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -114,5 +114,17 @@ void lpc17_ubxmdm_init(bool usb_used);
|
||||
int lpc17_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int lpc17_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_U_BLOX_C027_SRC_U_BLOX_C027_H */
|
||||
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
# Based on configs/lpcxpresso-lpc1768/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 201, 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Based on configs/stm3220g-eval/src/lpc17_adc.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -76,15 +76,14 @@
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: board_adc_setup
|
||||
* Name: zkit_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int board_adc_setup(void)
|
||||
int zkit_adc_setup(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Based on config/lpcxpresso-lpc1768/src/lpc17_appinit.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -160,9 +160,10 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_NSH_HAVEMMCSD
|
||||
FAR struct spi_dev_s *spi;
|
||||
int ret;
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
@ -190,5 +191,17 @@ int board_app_initialize(uintptr_t arg)
|
||||
message("Successfuly bound SPI port %d to MMC/SD slot %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = zkit_adc_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: zkit_adc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/lpcxpresso.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -249,5 +249,17 @@ void weak_function zkit_sspdev_initialize(void);
|
||||
|
||||
void weak_function zkit_spidev_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: zkit_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
int zkit_adc_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_ZKITARM_LPC1768_SRC_ZKITARM_H */
|
||||
|
Loading…
Reference in New Issue
Block a user