diff --git a/conf/autopilot/conf_motor_bench.h b/conf/autopilot/obsolete/conf_motor_bench.h similarity index 100% rename from conf/autopilot/conf_motor_bench.h rename to conf/autopilot/obsolete/conf_motor_bench.h diff --git a/conf/autopilot/data_logger_1_0.h b/conf/autopilot/obsolete/data_logger_1_0.h similarity index 100% rename from conf/autopilot/data_logger_1_0.h rename to conf/autopilot/obsolete/data_logger_1_0.h diff --git a/conf/autopilot/subsystems/fixedwing/autopilot.makefile b/conf/autopilot/subsystems/fixedwing/autopilot.makefile index 860c9cab70..6b3e601453 100644 --- a/conf/autopilot/subsystems/fixedwing/autopilot.makefile +++ b/conf/autopilot/subsystems/fixedwing/autopilot.makefile @@ -136,7 +136,7 @@ ns_srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c # ANALOG # - ns_CFLAGS += -DADC + ns_CFLAGS += -DUSE_ADC #ifeq ($(ARCH), lpc21) ns_srcs += $(SRC_ARCH)/mcu_periph/adc_arch.c ifeq ($(ARCH), stm32) diff --git a/conf/autopilot/subsystems/fixedwing/testing.makefile b/conf/autopilot/subsystems/fixedwing/testing.makefile index 527e9de60f..f1b539ccfc 100644 --- a/conf/autopilot/subsystems/fixedwing/testing.makefile +++ b/conf/autopilot/subsystems/fixedwing/testing.makefile @@ -17,7 +17,7 @@ tunnel.srcs += $(SRC_ARCH)/uart_tunnel.c # A test program to monitor the ADC values test_adcs.ARCHDIR = $(ARCH) -test_adcs.CFLAGS += -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1 -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 -DUSE_ADC_4 -DUSE_ADC_5 -DUSE_ADC_6 -DUSE_ADC_7 +test_adcs.CFLAGS += -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1 -DUSE_ADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 -DUSE_ADC_4 -DUSE_ADC_5 -DUSE_ADC_6 -DUSE_ADC_7 test_adcs.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B9600 test_adcs.srcs += downlink.c $(SRC_ARCH)/uart_hw.c xbee.c diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index feb24b6dcb..29d782c7ba 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -36,7 +36,6 @@ #include "firmwares/fixedwing/main_ap.h" #include "mcu.h" -#include "mcu_periph/adc.h" #include "firmwares/fixedwing/stabilization/stabilization_attitude.h" #include "firmwares/fixedwing/guidance/guidance_v.h" #include "gps.h" @@ -474,11 +473,6 @@ void init_ap( void ) { #ifndef SINGLE_MCU /** init done in main_fbw in single MCU */ mcu_init(); sys_time_init(); - - -#ifdef ADC - adc_init(); -#endif #endif /* SINGLE_MCU */ /************* Sensors initialization ***************/ diff --git a/sw/airborne/firmwares/fixedwing/main_fbw.c b/sw/airborne/firmwares/fixedwing/main_fbw.c index ccf561714e..fa0c7c319b 100644 --- a/sw/airborne/firmwares/fixedwing/main_fbw.c +++ b/sw/airborne/firmwares/fixedwing/main_fbw.c @@ -40,9 +40,6 @@ #include "mcu_periph/spi.h" #include "mcu_periph/adc.h" -#ifdef USE_USB_SERIAL -#include "usb_serial.h" -#endif #include "sys_time.h" #include "commands.h" @@ -68,13 +65,10 @@ uint8_t fbw_mode; /********** INIT *************************************************************/ void init_fbw( void ) { + mcu_init(); sys_time_init(); - -#ifdef ADC - adc_init(); electrical_init(); -#endif /* ADC */ #ifdef ACTUATORS actuators_init(); diff --git a/sw/airborne/firmwares/motor_bench/main_motor_bench.c b/sw/airborne/firmwares/motor_bench/main_motor_bench.c index 8c45c24e10..93c902282f 100644 --- a/sw/airborne/firmwares/motor_bench/main_motor_bench.c +++ b/sw/airborne/firmwares/motor_bench/main_motor_bench.c @@ -18,7 +18,6 @@ #include "generated/settings.h" -#include "adc.h" #include "mb_modes.h" //#include "mb_static.h" @@ -54,7 +53,6 @@ static inline void main_init( void ) { mb_servo_init(); mb_servo_set_range( 1090000, 1910000 ); - adc_init(); mb_current_init(); mb_scale_init(); diff --git a/sw/airborne/lisa/lisa_stm_passthrough_main.c b/sw/airborne/lisa/lisa_stm_passthrough_main.c index 2a79c50762..60a3725cd6 100644 --- a/sw/airborne/lisa/lisa_stm_passthrough_main.c +++ b/sw/airborne/lisa/lisa_stm_passthrough_main.c @@ -111,7 +111,6 @@ static inline void main_init(void) { actuators_init(); overo_link_init(); cscp_init(); - adc_init(); #ifdef PASSTHROUGH_CYGNUS autopilot_init(); diff --git a/sw/airborne/mcu.c b/sw/airborne/mcu.c index 6929d50d9e..07a599d45a 100644 --- a/sw/airborne/mcu.c +++ b/sw/airborne/mcu.c @@ -39,6 +39,12 @@ #if defined USE_I2C1 || defined USE_I2C2 #include "mcu_periph/i2c.h" #endif +#if defined USE_ADC +#include "mcu_periph/adc.h" +#endif +#ifdef USE_USB_SERIAL +#include "mcu_periph/usb_serial.h" +#endif #endif /* PERIPHERALS_AUTO_INIT */ void mcu_init(void) { @@ -83,6 +89,9 @@ void mcu_init(void) { #ifdef USE_USB_SERIAL VCOM_init(); #endif +#ifdef USE_ADC + adc_init(); +#endif #endif /* PERIPHERALS_AUTO_INIT */ } diff --git a/sw/airborne/usb_serial.h b/sw/airborne/mcu_periph/usb_serial.h similarity index 100% rename from sw/airborne/usb_serial.h rename to sw/airborne/mcu_periph/usb_serial.h