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
cam_track.h
Go to the documentation of this file.
1 /*
2  * $Id: demo_module.h 3079 2009-03-11 16:55:42Z gautier $
3  *
4  * Copyright (C) 2010 Gautier Hattenberger
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 
30 #ifndef CAM_TRACK_H
31 #define CAM_TRACK_H
32 
33 #include <inttypes.h>
35 
36 extern struct FloatVect3 target_pos_ned;
37 extern struct FloatVect3 target_speed_ned;
38 extern struct FloatVect3 target_accel_ned;
39 
40 extern void track_init(void);
41 extern void track_periodic_task(void);
42 extern void track_event(void);
43 
44 extern volatile uint8_t cam_msg_received;
45 extern void parse_cam_msg( void );
46 extern void parse_cam_buffer( uint8_t );
47 
48 #include "mcu_periph/uart.h"
49 
50 #define __CamLink(dev, _x) dev##_x
51 #define _CamLink(dev, _x) __CamLink(dev, _x)
52 #define CamLink(_x) _CamLink(CAM_LINK, _x)
53 
54 #define CamBuffer() CamLink(ChAvailable())
55 #define ReadCamBuffer() { while (CamLink(ChAvailable())&&!cam_msg_received) parse_cam_buffer(CamLink(Getch())); }
56 #define CamUartSend1(c) CamLink(Transmit(c))
57 #define CamUartSetBaudrate(_b) CamLink(SetBaudrate(_b))
58 #define CamUartRunning CamLink(TxRunning)
59 
60 #define CamEventCheckAndHandle() { \
61  if (CamBuffer()) { \
62  ReadCamBuffer(); \
63  } \
64  if (cam_msg_received) { \
65  parse_cam_msg(); \
66  track_event(); \
67  cam_msg_received = FALSE; \
68  } \
69 }
70 
71 
72 #endif
void track_event(void)
Definition: cam_track.c:122
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
volatile uint8_t cam_msg_received
Definition: cam_track.c:55
struct FloatVect3 target_accel_ned
Definition: cam_track.c:36
void parse_cam_buffer(uint8_t)
Definition: cam_track.c:194
struct FloatVect3 target_speed_ned
Definition: cam_track.c:35
Paparazzi floating point algebra.
void parse_cam_msg(void)
Definition: cam_track.c:161
void track_init(void)
Definition: cam_track.c:59
unsigned char uint8_t
Definition: types.h:14
void track_periodic_task(void)
Definition: cam_track.c:69
struct FloatVect3 target_pos_ned
Definition: cam_track.c:34