diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 13071d9c84..5eceebec07 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -37,18 +37,8 @@ #include "firmwares/fixedwing/main_ap.h" #include "mcu.h" #include "mcu_periph/sys_time.h" - -#ifdef MCU_SPI_LINK -#include "link_mcu_spi.h" -#endif - -#ifdef MCU_UART_LINK -#include "link_mcu_usart.h" -#endif - -#ifdef MCU_CAN_LINK -#include "link_mcu_can.h" -#endif +#include "inter_mcu.h" +#include "link_mcu.h" // Sensors #if USE_GPS diff --git a/sw/airborne/firmwares/fixedwing/main_fbw.c b/sw/airborne/firmwares/fixedwing/main_fbw.c index e39bb3074e..37c94fd6ce 100644 --- a/sw/airborne/firmwares/fixedwing/main_fbw.c +++ b/sw/airborne/firmwares/fixedwing/main_fbw.c @@ -48,21 +48,10 @@ #include "subsystems/datalink/telemetry.h" #endif -#ifdef MCU_SPI_LINK -#include "link_mcu_spi.h" -#endif - -#ifdef MCU_UART_LINK -#include "link_mcu_usart.h" -#endif - -#ifdef MCU_CAN_LINK -#include "link_mcu_can.h" -#endif - uint8_t fbw_mode; #include "inter_mcu.h" +#include "link_mcu.h" #ifdef USE_NPS #include "nps_autopilot.h" diff --git a/sw/airborne/inter_mcu.c b/sw/airborne/inter_mcu.c index aeb4134b3f..0c62ae1e5d 100644 --- a/sw/airborne/inter_mcu.c +++ b/sw/airborne/inter_mcu.c @@ -14,9 +14,13 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * along with paparazzi; see the file COPYING. If not, see + * . + */ + +/** + * @file inter_mcu.c + * Communication between fbw and ap processes. * */ @@ -28,7 +32,7 @@ static struct ap_state _ap_state; struct fbw_state* fbw_state = &_fbw_state; struct ap_state* ap_state = &_ap_state; #else /* SINGLE_MCU */ -#include "link_mcu_spi.h" +#include "link_mcu.h" struct fbw_state* fbw_state = &link_mcu_from_fbw_msg.payload.from_fbw; struct ap_state* ap_state = &link_mcu_from_ap_msg.payload.from_ap; #endif /* ! SINGLE_MCU */ diff --git a/sw/airborne/inter_mcu.h b/sw/airborne/inter_mcu.h index b26f6b7cf3..ef7f1e3183 100644 --- a/sw/airborne/inter_mcu.h +++ b/sw/airborne/inter_mcu.h @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -15,19 +14,20 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * along with paparazzi; see the file COPYING. If not, see + * . */ -/** \brief Communication between fbw and ap processes +/** + * @file inter_mcu.h + * Communication between fbw and ap processes. + * * This unit contains the data structure used to communicate between the * "fly by wire" process and the "autopilot" process. It must be linked once in a - * monoprocessor architecture, twice in a twin-processors (the historical - * Atmel AVRs mega8-mega128 one) architecture. In the latter case, the - * inter-mcu communication process (e.g. SPI) must fill and read these data structures. -*/ + * monoprocessor architecture, twice in a twin-processors architecture. + * In the latter case, the inter-mcu communication process (e.g. SPI) must fill and + * read these data structures. + */ #ifndef INTER_MCU_H #define INTER_MCU_H diff --git a/sw/airborne/link_mcu.h b/sw/airborne/link_mcu.h new file mode 100644 index 0000000000..8ceb91197b --- /dev/null +++ b/sw/airborne/link_mcu.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2003-2014 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, see + * . + */ + +/** + * @file link_mcu.h + * Common transport functions for the communication between FBW and AP. + */ + +#ifndef LINK_MCU_H +#define LINK_MCU_H + +#ifdef MCU_SPI_LINK +#include "link_mcu_spi.h" +#elif defined MCU_UART_LINK +#include "link_mcu_usart.h" +#elif defined MCU_CAN_LINK +#include "link_mcu_can.h" +#endif + +#endif /* LINK_MCU_H */ diff --git a/sw/airborne/link_mcu_can.h b/sw/airborne/link_mcu_can.h index 910842693d..c05d7d418f 100644 --- a/sw/airborne/link_mcu_can.h +++ b/sw/airborne/link_mcu_can.h @@ -14,17 +14,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * along with paparazzi; see the file COPYING. If not, see + * . + */ + +/** + * @file link_mcu_can.h + * Transport for the communication between FBW and AP via CAN. * */ -/** \brief Transport for the communication between FBW and AP via CAN. - */ - -#ifndef LINK_MCU_H -#define LINK_MCU_H +#ifndef LINK_MCU_CAN_H +#define LINK_MCU_CAN_H #include #include "inter_mcu.h" @@ -47,4 +48,4 @@ extern void link_mcu_event_task( void ); extern void link_mcu_periodic_task( void ); -#endif +#endif /* LINK_MCU_CAN_H */ diff --git a/sw/airborne/link_mcu_spi.h b/sw/airborne/link_mcu_spi.h index 118efc8f20..4b61e493a0 100644 --- a/sw/airborne/link_mcu_spi.h +++ b/sw/airborne/link_mcu_spi.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin + * Copyright (C) 2003-2005 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. * @@ -14,18 +14,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * along with paparazzi; see the file COPYING. If not, see + * . + */ + +/** + * @file link_mcu_spi.h + * Transport for the communication between FBW and AP via SPI. * */ -/** \brief Transport for the communication between FBW and AP in a bi-process - architecture. Essentially adds a checksum to the inter_mcu structure. - */ - -#ifndef LINK_MCU_H -#define LINK_MCU_H +#ifndef LINK_MCU_SPI_H +#define LINK_MCU_SPI_H #include #include "inter_mcu.h" @@ -64,4 +64,4 @@ extern uint8_t link_mcu_fbw_nb_err; extern void link_mcu_send(void); #endif /* AP */ -#endif +#endif /* LINK_MCU_SPI_H */ diff --git a/sw/airborne/link_mcu_usart.h b/sw/airborne/link_mcu_usart.h index 775ef90008..0140c4146a 100644 --- a/sw/airborne/link_mcu_usart.h +++ b/sw/airborne/link_mcu_usart.h @@ -14,17 +14,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * along with paparazzi; see the file COPYING. If not, see + * . + */ + +/** + * @file link_mcu_usart.h + * Transport for the communication between FBW and AP via UART. * */ -/** \brief Transport for the communication between FBW and AP via UART. - */ - -#ifndef LINK_MCU_H -#define LINK_MCU_H +#ifndef LINK_MCU_USART_H +#define LINK_MCU_USART_H #include #include "inter_mcu.h" @@ -47,4 +48,4 @@ extern void link_mcu_event_task( void ); extern void link_mcu_periodic_task( void ); -#endif +#endif /* LINK_MCU_USART_H */