Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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 #include "pprzlink/pprzlink_device.h"
75 
76 #define InsLinkDevice (&((INS_LINK).device))
77 
78 #ifndef SITL
79 #include "mcu_periph/uart.h"
80 #include "mcu_periph/spi.h"
81 
82 #define InsSend1(c) InsLinkDevice->put_byte(InsLinkDevice->periph, 0, c)
83 #define InsUartSend1(c) InsSend1(c)
84 #define InsSend(_dat,_len) { for (uint8_t i = 0; i< (_len); i++) InsSend1(_dat[i]); };
85 #define InsUartSetBaudrate(_b) uart_periph_set_baudrate(INS_LINK, _b)
86 
87 #endif
89 static inline void ins_event_check_and_handle(void (* handler)(void))
90 {
91  struct link_device *dev = InsLinkDevice;
92  if (dev->char_available(dev->periph)) {
93  while (dev->char_available(dev->periph) && !ins_msg_received) {
94  parse_ins_buffer(dev->get_byte(dev->periph));
95  }
96  }
97  if (ins_msg_received) {
98  parse_ins_msg();
99  handler();
100  ins_msg_received = false;
101  }
102 }
103 
104 #endif /* INS_MODULE_H */
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
INS_FORMAT ins_z
INS_FORMAT ins_mz
INS_FORMAT ins_mx
INS_FORMAT ins_ay
Integrated Navigation System interface.
INS_FORMAT ins_az
volatile uint8_t ins_msg_received
Definition: ins_vn100.c:64
INS_FORMAT ins_vz
INS_FORMAT ins_vy
Architecture independent SPI (Serial Peripheral Interface) API.
#define InsLinkDevice
Definition: ins_module.h:76
INS_FORMAT ins_x
INS_FORMAT ins_my
void handle_ins_msg(void)
Definition: ins_xsens.c:154
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
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:73
INS_FORMAT ins_p
INS_FORMAT ins_ax
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t new_ins_attitude
INS_FORMAT ins_y
INS_FORMAT ins_vx
void parse_ins_buffer(uint8_t)
INS_FORMAT ins_theta
float ins_roll_neutral
Definition: ins_arduimu.c:14
INS_FORMAT ins_r
INS_FORMAT ins_q
INS_FORMAT ins_phi