diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 29d782c7ba..9d2a5fb122 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -59,17 +59,11 @@ #endif -#ifdef USE_SPI -#include "mcu_periph/spi.h" -#endif #ifdef TRAFFIC_INFO #include "subsystems/navigation/traffic_info.h" #endif -#ifdef USE_USB_SERIAL -#include "usb_serial.h" -#endif #if ! defined CATASTROPHIC_BAT_LEVEL && defined LOW_BATTERY #warning "LOW_BATTERY deprecated. Renamed into CATASTROPHIC_BAT_LEVEL (in airframe file)" @@ -492,9 +486,6 @@ void init_ap( void ) { /************* Links initialization ***************/ -#if defined USE_SPI - spi_init(); -#endif #if defined MCU_SPI_LINK link_mcu_init(); #endif diff --git a/sw/airborne/firmwares/fixedwing/main_fbw.c b/sw/airborne/firmwares/fixedwing/main_fbw.c index fa0c7c319b..9cee8f830d 100644 --- a/sw/airborne/firmwares/fixedwing/main_fbw.c +++ b/sw/airborne/firmwares/fixedwing/main_fbw.c @@ -35,12 +35,6 @@ #include "firmwares/fixedwing/main_fbw.h" #include "mcu.h" - -#include "led.h" -#include "mcu_periph/spi.h" -#include "mcu_periph/adc.h" - - #include "sys_time.h" #include "commands.h" #include "firmwares/fixedwing/actuators.h" @@ -82,7 +76,6 @@ void init_fbw( void ) { inter_mcu_init(); #endif #ifdef MCU_SPI_LINK - spi_init(); link_mcu_restart(); #endif diff --git a/sw/airborne/mcu.c b/sw/airborne/mcu.c index 07a599d45a..f907ad3a1b 100644 --- a/sw/airborne/mcu.c +++ b/sw/airborne/mcu.c @@ -45,6 +45,9 @@ #ifdef USE_USB_SERIAL #include "mcu_periph/usb_serial.h" #endif +#ifdef USE_SPI +#include "mcu_periph/spi.h" +#endif #endif /* PERIPHERALS_AUTO_INIT */ void mcu_init(void) { @@ -86,11 +89,14 @@ void mcu_init(void) { #ifdef USE_I2C2 i2c2_init(); #endif +#ifdef USE_ADC + adc_init(); +#endif #ifdef USE_USB_SERIAL VCOM_init(); #endif -#ifdef USE_ADC - adc_init(); +#ifdef USE_SPI + spi_init(); #endif #endif /* PERIPHERALS_AUTO_INIT */