aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-10-23 22:47:55 -0700
committerpx4dev <px4@purgatory.org>2012-10-23 23:51:13 -0700
commit34f99c7dca1995f8ddd9e8d61c4cbd7289f40e99 (patch)
tree1bc2321b5366cb94e504f67890cd83af76e8bf8b
parentdb044b64cddea9510dd5b43be304ef723acda636 (diff)
downloadpx4-firmware-34f99c7dca1995f8ddd9e8d61c4cbd7289f40e99.tar.gz
px4-firmware-34f99c7dca1995f8ddd9e8d61c4cbd7289f40e99.tar.bz2
px4-firmware-34f99c7dca1995f8ddd9e8d61c4cbd7289f40e99.zip
Hoist the ADC and CAN board-specific pieces.
-rw-r--r--apps/drivers/boards/px4fmu/px4fmu_adc.c (renamed from nuttx/configs/px4fmu/src/up_adc.c)53
-rw-r--r--apps/drivers/boards/px4fmu/px4fmu_can.c (renamed from nuttx/configs/px4fmu/src/up_can.c)24
-rw-r--r--apps/drivers/boards/px4fmu/px4fmu_init.c3
-rw-r--r--apps/sensors/sensors.cpp2
-rw-r--r--nuttx/configs/px4fmu/include/up_adc.h60
-rw-r--r--nuttx/configs/px4fmu/src/Makefile8
6 files changed, 25 insertions, 125 deletions
diff --git a/nuttx/configs/px4fmu/src/up_adc.c b/apps/drivers/boards/px4fmu/px4fmu_adc.c
index 2d74e6f00..2ea855955 100644
--- a/nuttx/configs/px4fmu/src/up_adc.c
+++ b/apps/drivers/boards/px4fmu/px4fmu_adc.c
@@ -1,9 +1,6 @@
-/************************************************************************************
- * configs/stm3240g-eval/src/up_adc.c
- * arch/arm/src/board/up_adc.c
+/****************************************************************************
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Copyright (C) 2012 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -15,7 +12,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
+ * 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,7 +29,13 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************************************/
+ ****************************************************************************/
+
+/**
+ * @file px4fmu_adc.c
+ *
+ * Board-specific ADC functions.
+ */
/************************************************************************************
* Included Files
@@ -50,35 +53,8 @@
#include "chip.h"
#include "up_arch.h"
-//#include "stm32_pwm.h"
#include "stm32_adc.h"
-#include "px4fmu-internal.h"
-
-#ifdef CONFIG_ADC
-
-/************************************************************************************
- * Definitions
- ************************************************************************************/
-
-/* Configuration ************************************************************/
-/* Up to 3 ADC interfaces are supported */
-
-#if STM32_NADC < 3
-# undef CONFIG_STM32_ADC3
-#endif
-
-#if STM32_NADC < 2
-# undef CONFIG_STM32_ADC2
-#endif
-
-#if STM32_NADC < 1
-# undef CONFIG_STM32_ADC3
-#endif
-
-#if defined(CONFIG_STM32_ADC1) || defined(CONFIG_STM32_ADC2) || defined(CONFIG_STM32_ADC3)
-#ifndef CONFIG_STM32_ADC3
-# warning "Channel information only available for ADC3"
-#endif
+#include "px4fmu_internal.h"
#define ADC3_NCHANNELS 4
@@ -116,7 +92,6 @@ static const uint32_t g_pinlist[ADC3_NCHANNELS] = {GPIO_ADC3_IN10, GPIO_ADC3_IN
int adc_devinit(void)
{
-#ifdef CONFIG_STM32_ADC3
static bool initialized = false;
struct adc_dev_s *adc[ADC3_NCHANNELS];
int ret;
@@ -164,10 +139,4 @@ int adc_devinit(void)
}
return OK;
-#else
- return -ENOSYS;
-#endif
}
-
-#endif /* CONFIG_STM32_ADC || CONFIG_STM32_ADC2 || CONFIG_STM32_ADC3 */
-#endif /* CONFIG_ADC */
diff --git a/nuttx/configs/px4fmu/src/up_can.c b/apps/drivers/boards/px4fmu/px4fmu_can.c
index daf6484f2..92d96e558 100644
--- a/nuttx/configs/px4fmu/src/up_can.c
+++ b/apps/drivers/boards/px4fmu/px4fmu_can.c
@@ -1,9 +1,6 @@
-/************************************************************************************
- * configs/px4fmu/src/up_can.c
- * arch/arm/src/board/up_can.c
+/****************************************************************************
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
+ * Copyright (C) 2012 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -15,7 +12,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
+ * 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,7 +29,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************************************/
+ ****************************************************************************/
+
+/**
+ * @file px4fmu_can.c
+ *
+ * Board-specific CAN functions.
+ */
+
/************************************************************************************
* Included Files
@@ -51,9 +55,7 @@
#include "stm32.h"
#include "stm32_can.h"
-#include "px4fmu-internal.h"
-
-#if defined(CONFIG_CAN) && (defined(CONFIG_STM32_CAN1) || defined(CONFIG_STM32_CAN2))
+#include "px4fmu_internal.h"
/************************************************************************************
* Pre-processor Definitions
@@ -138,5 +140,3 @@ int can_devinit(void)
return OK;
}
-
-#endif /* CONFIG_STM32_CAN || CONFIG_STM32_CAN2 || CONFIG_STM32_CAN3 */
diff --git a/apps/drivers/boards/px4fmu/px4fmu_init.c b/apps/drivers/boards/px4fmu/px4fmu_init.c
index 249de6034..ba6cdd764 100644
--- a/apps/drivers/boards/px4fmu/px4fmu_init.c
+++ b/apps/drivers/boards/px4fmu/px4fmu_init.c
@@ -63,7 +63,6 @@
#include "px4fmu_internal.h"
#include "stm32_uart.h"
-#include <arch/board/up_adc.h>
#include <arch/board/board.h>
#include <arch/board/drv_led.h>
#include <arch/board/drv_eeprom.h>
@@ -98,6 +97,8 @@
* Protected Functions
****************************************************************************/
+extern int adc_devinit(void);
+
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/apps/sensors/sensors.cpp b/apps/sensors/sensors.cpp
index 6b7ca658c..54d2f6a0b 100644
--- a/apps/sensors/sensors.cpp
+++ b/apps/sensors/sensors.cpp
@@ -59,8 +59,6 @@
#include <drivers/drv_mag.h>
#include <drivers/drv_baro.h>
-#include <arch/board/up_adc.h>
-
#include <systemlib/systemlib.h>
#include <systemlib/param/param.h>
#include <systemlib/err.h>
diff --git a/nuttx/configs/px4fmu/include/up_adc.h b/nuttx/configs/px4fmu/include/up_adc.h
deleted file mode 100644
index 699c6a59a..000000000
--- a/nuttx/configs/px4fmu/include/up_adc.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/************************************************************************************
- * configs/stm3240g-eval/src/up_adc.c
- * arch/arm/src/board/up_adc.c
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <gnutt@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include <nuttx/config.h>
-
-#ifdef CONFIG_ADC
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Name: adc_devinit
- *
- * Description:
- * All STM32 architectures must provide the following interface to work with
- * examples/adc.
- *
- ************************************************************************************/
-
-int adc_devinit(void);
-
-#endif /* CONFIG_ADC */
diff --git a/nuttx/configs/px4fmu/src/Makefile b/nuttx/configs/px4fmu/src/Makefile
index 281d9c247..d88040013 100644
--- a/nuttx/configs/px4fmu/src/Makefile
+++ b/nuttx/configs/px4fmu/src/Makefile
@@ -44,14 +44,6 @@ CSRCS = up_leds.c \
drv_gpio.c \
drv_led.c drv_eeprom.c
-ifeq ($(CONFIG_ADC),y)
-CSRCS += up_adc.c
-endif
-
-ifeq ($(CONFIG_CAN),y)
-CSRCS += up_can.c
-endif
-
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)