Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ins_module.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 Pascal Brisset, Antoine Drouin
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 
28 #ifndef INS_MODULE_H
29 #define INS_MODULE_H
30 
31 #include "std.h"
32 #include "subsystems/ins.h"
33 
34 #ifndef INS_FORMAT
35 #define INS_FORMAT float
36 #endif
37 
38 extern INS_FORMAT ins_x;
39 extern INS_FORMAT ins_y;
40 extern INS_FORMAT ins_z;
41 
42 extern INS_FORMAT ins_vx;
43 extern INS_FORMAT ins_vy;
44 extern INS_FORMAT ins_vz;
45 
46 extern INS_FORMAT ins_phi;
47 extern INS_FORMAT ins_theta;
48 extern INS_FORMAT ins_psi;
49 
50 extern INS_FORMAT ins_p;
51 extern INS_FORMAT ins_q;
52 extern INS_FORMAT ins_r;
53 
54 extern INS_FORMAT ins_ax;
55 extern INS_FORMAT ins_ay;
56 extern INS_FORMAT ins_az;
57 
58 extern INS_FORMAT ins_mx;
59 extern INS_FORMAT ins_my;
60 extern INS_FORMAT ins_mz;
61 
62 #if USE_INS_MODULE
65 #endif
66 
67 extern volatile uint8_t ins_msg_received;
68 extern volatile uint8_t new_ins_attitude;
69 
70 void handle_ins_msg(void);
71 void parse_ins_msg(void);
73 
74 #ifndef SITL
75 #include "mcu_periph/uart.h"
76 
77 #define __InsLink(dev, _x) dev##_x
78 #define _InsLink(dev, _x) __InsLink(dev, _x)
79 #define InsLink(_x) _InsLink(INS_LINK, _x)
80 
81 #define InsBuffer() InsLink(ChAvailable())
82 #define ReadInsBuffer() { while (InsLink(ChAvailable())&&!ins_msg_received) parse_ins_buffer(InsLink(Getch())); }
83 #define InsSend1(c) InsLink(Transmit(c))
84 #define InsUartSend1(c) InsSend1(c)
85 #define InsSend(_dat,_len) { for (uint8_t i = 0; i< (_len); i++) InsSend1(_dat[i]); };
86 #define InsUartSetBaudrate(_b) InsLink(SetBaudrate(_b))
87 #define InsUartRunning InsLink(TxRunning)
88 
89 #endif
91 #define InsEventCheckAndHandle(handler) { \
92  if (InsBuffer()) { \
93  ReadInsBuffer(); \
94  } \
95  if (ins_msg_received) { \
96  parse_ins_msg(); \
97  handler; \
98  ins_msg_received = FALSE; \
99  } \
100  }
101 
102 
103 #endif /* INS_MODULE_H */
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
INS_FORMAT ins_z
Definition: ins_xsens.c:52
INS_FORMAT ins_mz
Definition: ins_xsens.c:77
INS_FORMAT ins_mx
Definition: ins_xsens.c:75
INS_FORMAT ins_ay
Definition: ins_xsens.c:71
Integrated Navigation System interface.
INS_FORMAT ins_az
Definition: ins_xsens.c:72
volatile uint8_t ins_msg_received
Definition: ins_vn100.c:64
INS_FORMAT ins_vz
Definition: ins_xsens.c:57
INS_FORMAT ins_vy
Definition: ins_xsens.c:56
INS_FORMAT ins_x
Definition: ins_xsens.c:50
INS_FORMAT ins_my
Definition: ins_xsens.c:76
void handle_ins_msg(void)
Definition: ins_xsens.c:380
void parse_ins_msg(void)
float ins_pitch_neutral
Definition: ins_arduimu.c:15
#define INS_FORMAT
Definition: ins_module.h:35
INS_FORMAT ins_psi
Definition: ins_xsens.c:62
INS_FORMAT ins_p
Definition: ins_xsens.c:65
INS_FORMAT ins_ax
Definition: ins_xsens.c:70
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t new_ins_attitude
INS_FORMAT ins_y
Definition: ins_xsens.c:51
INS_FORMAT ins_vx
Definition: ins_xsens.c:55
void parse_ins_buffer(uint8_t)
Definition: ins_xsens.c:668
INS_FORMAT ins_theta
Definition: ins_xsens.c:61
float ins_roll_neutral
Definition: ins_arduimu.c:14
INS_FORMAT ins_r
Definition: ins_xsens.c:67
INS_FORMAT ins_q
Definition: ins_xsens.c:66
INS_FORMAT ins_phi
Definition: ins_xsens.c:60