Paparazzi UAS  v5.15_devel-50-g4d7045d
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 */
62 };
63 
64 /* Easy accessible defines for cmd_status bits */
65 #define INTERMCU_SET_CMD_STATUS(_bit) { intermcu.cmd_status |= (1 << _bit); }
66 #define INTERMCU_CLR_CMD_STATUS(_bit) { intermcu.cmd_status &= ~(1 << _bit); }
67 #define INTERMCU_GET_CMD_STATUS(_bit) (intermcu.cmd_status & (1 << _bit))
68 
69 /* Main InterMCU structure */
70 struct intermcu_t {
71  struct link_device *device;
72  struct pprz_transport transport;
75  bool enabled;
78 
79 #ifdef BOARD_PX4IO
80  enum intermcu_PX4_baud_status stable_px4_baud;
81 #endif
82 };
83 extern struct intermcu_t intermcu;
84 
85 /* Functions defined in XML */
86 void intermcu_init(void);
87 void intermcu_periodic(void);
88 
89 #endif
struct link_device * device
Device used for communication.
Definition: intermcu.h:71
uint8_t cmd_status
Command status information that is transfered (intermcu_cmd_status)
Definition: intermcu.h:77
void intermcu_init(void)
Definition: intermcu_ap.c:71
enum intermcu_status status
Status of the INTERMCU.
Definition: intermcu.h:73
Set FBW in failsafe mode.
Definition: intermcu.h:61
InterMCU communication is OK.
Definition: intermcu.h:45
bool msg_available
If we have an InterMCU message.
Definition: intermcu.h:76
Enable tip props.
Definition: intermcu.h:60
intermcu_PX4_baud_status
Definition: intermcu.h:50
bool enabled
If the InterMCU communication is enabled.
Definition: intermcu.h:75
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:90
struct pprz_transport transport
Transport over communication line (PPRZ)
Definition: intermcu.h:72
unsigned char uint8_t
Definition: types.h:14
uint8_t time_since_last_frame
Time since last frame.
Definition: intermcu.h:74
intermcu_status
Definition: intermcu.h:44
Whether or not to dis-arm the FBW.
Definition: intermcu.h:59