[intermcu] common link_mcu.h header

This commit is contained in:
Felix Ruess
2014-10-06 19:29:59 +02:00
parent 2b6b156a71
commit 1b951fd888
8 changed files with 90 additions and 68 deletions
+2 -12
View File
@@ -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
+1 -12
View File
@@ -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"
+8 -4
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/**
* @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 */
+11 -11
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/** \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
+37
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/**
* @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 */
+10 -9
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/**
* @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 <inttypes.h>
#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 */
+11 -11
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/**
* @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 <inttypes.h>
#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 */
+10 -9
View File
@@ -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
* <http://www.gnu.org/licenses/>.
*/
/**
* @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 <inttypes.h>
#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 */