Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ins_module.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2003 Pascal Brisset, Antoine Drouin
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
31 #ifndef INS_H
32 #define INS_H
33 
34 #include "std.h"
35 #include "led.h"
36 
37 #ifndef INS_FORMAT
38 #define INS_FORMAT float
39 #endif
40 
41 extern INS_FORMAT ins_x;
42 extern INS_FORMAT ins_y;
43 extern INS_FORMAT ins_z;
44 
45 extern INS_FORMAT ins_vx;
46 extern INS_FORMAT ins_vy;
47 extern INS_FORMAT ins_vz;
48 
49 extern INS_FORMAT ins_phi;
50 extern INS_FORMAT ins_theta;
51 extern INS_FORMAT ins_psi;
52 
53 extern INS_FORMAT ins_p;
54 extern INS_FORMAT ins_q;
55 extern INS_FORMAT ins_r;
56 
57 extern INS_FORMAT ins_ax;
58 extern INS_FORMAT ins_ay;
59 extern INS_FORMAT ins_az;
60 
61 extern INS_FORMAT ins_mx;
62 extern INS_FORMAT ins_my;
63 extern INS_FORMAT ins_mz;
64 
67 
68 
69 extern volatile uint8_t ins_msg_received;
70 extern volatile uint8_t new_ins_attitude;
71 
72 extern void ins_init( void );
73 extern void ins_periodic_task( void );
74 void handle_ins_msg( void);
75 void parse_ins_msg( void );
77 
78 #ifndef SITL
79 #include "mcu_periph/uart.h"
80 
81 #define __InsLink(dev, _x) dev##_x
82 #define _InsLink(dev, _x) __InsLink(dev, _x)
83 #define InsLink(_x) _InsLink(INS_LINK, _x)
84 
85 #define InsBuffer() InsLink(ChAvailable())
86 #define ReadInsBuffer() { while (InsLink(ChAvailable())&&!ins_msg_received) parse_ins_buffer(InsLink(Getch())); }
87 #define InsSend1(c) InsLink(Transmit(c))
88 #define InsUartSend1(c) InsSend1(c)
89 #define InsSend(_dat,_len) { for (uint8_t i = 0; i< (_len); i++) InsSend1(_dat[i]); };
90 #define InsUartSetBaudrate(_b) InsLink(SetBaudrate(_b))
91 #define InsUartRunning InsLink(TxRunning)
92 
93 #endif
95 #define InsEventCheckAndHandle(handler) { \
96  if (InsBuffer()) { \
97  ReadInsBuffer(); \
98  } \
99  if (ins_msg_received) { \
100  LED_TOGGLE(2); \
101  parse_ins_msg(); \
102  handler; \
103  ins_msg_received = FALSE; \
104  } \
105  }
106 
107 
108 #endif /* INS_H */
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void ins_init(void)
Definition: fw_ins_vn100.c:38
INS_FORMAT ins_z
Definition: ins_xsens.c:49
INS_FORMAT ins_mz
Definition: ins_xsens.c:69
INS_FORMAT ins_mx
Definition: ins_xsens.c:67
INS_FORMAT ins_ay
Definition: ins_xsens.c:64
INS_FORMAT ins_az
Definition: ins_xsens.c:65
volatile uint8_t ins_msg_received
Definition: ins_vn100.c:49
INS_FORMAT ins_vz
Definition: ins_xsens.c:53
INS_FORMAT ins_vy
Definition: ins_xsens.c:52
void ins_periodic_task(void)
Definition: fw_ins_vn100.c:85
INS_FORMAT ins_pitch_neutral
Definition: ins_arduimu.c:15
INS_FORMAT ins_x
Definition: ins_xsens.c:47
INS_FORMAT ins_my
Definition: ins_xsens.c:68
void handle_ins_msg(void)
Definition: ins_xsens.c:306
void parse_ins_msg(void)
Definition: ins_chimu_spi.c:70
#define INS_FORMAT
Definition: ins_module.h:38
INS_FORMAT ins_psi
Definition: ins_xsens.c:57
INS_FORMAT ins_p
Definition: ins_xsens.c:59
INS_FORMAT ins_ax
Definition: ins_xsens.c:63
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t new_ins_attitude
Definition: ins_chimu_spi.c:36
INS_FORMAT ins_y
Definition: ins_xsens.c:48
INS_FORMAT ins_vx
Definition: ins_xsens.c:51
void parse_ins_buffer(uint8_t)
Definition: ins_xsens.c:580
INS_FORMAT ins_theta
Definition: ins_xsens.c:56
arch independent LED (Light Emitting Diodes) API
INS_FORMAT ins_r
Definition: ins_xsens.c:61
INS_FORMAT ins_q
Definition: ins_xsens.c:60
INS_FORMAT ins_phi
Definition: ins_xsens.c:55
INS_FORMAT ins_roll_neutral
driver for the VectorNav VN100
Definition: ins_arduimu.c:14