Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
intermcu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
27 #ifndef INTERMCU_ROTORCRAFT_H
28 #define INTERMCU_ROTORCRAFT_H
29 
30 #include "std.h"
31 #include "subsystems/commands.h"
32 #include "pprzlink/pprz_transport.h"
33 
34 #define INTERMCU_AP 0
35 #define INTERMCU_FBW 1
36 
37 #ifndef INTERMCU_LOST_CNT
38 #define INTERMCU_LOST_CNT 25 /* 50ms with a 512Hz timer TODO fixed value */
39 #endif
40 
41 #include BOARD_CONFIG
42 
43 /* Different states the InterMCU can be in */
47 };
48 
49 /* InterMCU baudrate protection for PX4 */
54 };
55 
56 /* InterMCU command status bits */
60 };
61 
62 /* Easy accessible defines for cmd_status bits */
63 #define INTERMCU_SET_CMD_STATUS(_bit) { intermcu.cmd_status |= (1 << _bit); }
64 #define INTERMCU_CLR_CMD_STATUS(_bit) { intermcu.cmd_status &= ~(1 << _bit); }
65 #define INTERMCU_GET_CMD_STATUS(_bit) (intermcu.cmd_status & (1 << _bit))
66 
67 /* Main InterMCU structure */
68 struct intermcu_t {
69  struct link_device *device;
70  struct pprz_transport transport;
73  bool enabled;
76 
77 #ifdef BOARD_PX4IO
78  enum intermcu_PX4_baud_status stable_px4_baud;
79 #endif
80 };
81 extern struct intermcu_t intermcu;
82 
83 /* Functions defined in XML */
84 void intermcu_init(void);
85 void intermcu_periodic(void);
86 
87 #endif
struct link_device * device
Device used for communication.
Definition: intermcu.h:69
uint8_t cmd_status
Command status information that is transfered (intermcu_cmd_status)
Definition: intermcu.h:75
void intermcu_init(void)
Definition: intermcu_ap.c:64
enum intermcu_status status
Status of the INTERMCU.
Definition: intermcu.h:71
InterMCU communication is OK.
Definition: intermcu.h:45
bool msg_available
If we have an InterMCU message.
Definition: intermcu.h:74
intermcu_PX4_baud_status
Definition: intermcu.h:50
bool enabled
If the InterMCU communication is enabled.
Definition: intermcu.h:73
No interMCU communication anymore.
Definition: intermcu.h:46
struct intermcu_t intermcu
Definition: intermcu_ap.c:41
The status of autopilot_motors_on.
Definition: intermcu.h:58
intermcu_cmd_status
Definition: intermcu.h:57
Hardware independent code for commands handling.
void intermcu_periodic(void)
Definition: intermcu_ap.c:74
struct pprz_transport transport
Transport over communication line (PPRZ)
Definition: intermcu.h:70
unsigned char uint8_t
Definition: types.h:14
uint8_t time_since_last_frame
Time since last frame.
Definition: intermcu.h:72
intermcu_status
Definition: intermcu.h:44
Whether or not to dis-arm the FBW.
Definition: intermcu.h:59