Paparazzi UAS v7.0_unstable
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 "modules/ins/ins.h"
33
34#ifndef INS_FORMAT
35#define INS_FORMAT float
36#endif
37
38extern INS_FORMAT ins_x;
39extern INS_FORMAT ins_y;
40extern INS_FORMAT ins_z;
41
42extern INS_FORMAT ins_vx;
43extern INS_FORMAT ins_vy;
44extern INS_FORMAT ins_vz;
45
46extern INS_FORMAT ins_phi;
48extern INS_FORMAT ins_psi;
49
50extern INS_FORMAT ins_p;
51extern INS_FORMAT ins_q;
52extern INS_FORMAT ins_r;
53
54extern INS_FORMAT ins_ax;
55extern INS_FORMAT ins_ay;
56extern INS_FORMAT ins_az;
57
58extern INS_FORMAT ins_mx;
59extern INS_FORMAT ins_my;
60extern INS_FORMAT ins_mz;
61
62#if USE_INS_MODULE
65#endif
66
67extern volatile uint8_t ins_msg_received;
68extern volatile uint8_t new_ins_attitude;
69
70void handle_ins_msg(void);
71void 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
89static inline void ins_event_check_and_handle(void (* handler)(void))
90{
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) {
99 handler();
100 ins_msg_received = false;
101 }
102}
103
104#endif /* INS_MODULE_H */
float ins_roll_neutral
Definition ins_arduimu.c:14
float ins_pitch_neutral
Definition ins_arduimu.c:15
Integrated Navigation System interface.
INS_FORMAT ins_z
INS_FORMAT ins_r
INS_FORMAT ins_p
INS_FORMAT ins_psi
INS_FORMAT ins_my
INS_FORMAT ins_y
INS_FORMAT ins_ay
INS_FORMAT ins_q
volatile uint8_t new_ins_attitude
INS_FORMAT ins_az
INS_FORMAT ins_mx
INS_FORMAT ins_x
INS_FORMAT ins_ax
INS_FORMAT ins_phi
void parse_ins_msg(void)
Definition ins_vn100.c:185
INS_FORMAT ins_vx
INS_FORMAT ins_vz
INS_FORMAT ins_vy
static void ins_event_check_and_handle(void(*handler)(void))
!SITL
Definition ins_module.h:89
void handle_ins_msg(void)
Definition ins_xsens.c:150
void parse_ins_buffer(uint8_t)
#define InsLinkDevice
Definition ins_module.h:76
INS_FORMAT ins_mz
INS_FORMAT ins_theta
volatile uint8_t ins_msg_received
Definition ins_vn100.c:64
#define INS_FORMAT
Definition ins_module.h:35
uint16_t foo
Definition main_demo5.c:58
Architecture independent SPI (Serial Peripheral Interface) API.
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.