mirror of
https://github.com/apache/nuttx.git
synced 2026-09-20 12:58:29 +08:00
Remove all references to board_adc_setup()
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user