Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cam_track.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Gautier Hattenberger
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  */
22 
28 #ifndef CAM_TRACK_H
29 #define CAM_TRACK_H
30 
31 #include <inttypes.h>
33 
34 extern struct FloatVect3 target_pos_ned;
35 extern struct FloatVect3 target_speed_ned;
36 extern struct FloatVect3 target_accel_ned;
37 
38 extern void track_init(void);
39 extern void track_periodic_task(void);
40 extern void track_event(void);
41 
42 extern volatile uint8_t cam_msg_received;
43 extern void parse_cam_msg( void );
44 extern void parse_cam_buffer( uint8_t );
45 
46 #include "mcu_periph/uart.h"
47 
48 #define __CamLink(dev, _x) dev##_x
49 #define _CamLink(dev, _x) __CamLink(dev, _x)
50 #define CamLink(_x) _CamLink(CAM_LINK, _x)
51 
52 #define CamBuffer() CamLink(ChAvailable())
53 #define ReadCamBuffer() { while (CamLink(ChAvailable())&&!cam_msg_received) parse_cam_buffer(CamLink(Getch())); }
54 #define CamUartSend1(c) CamLink(Transmit(c))
55 #define CamUartSetBaudrate(_b) CamLink(SetBaudrate(_b))
56 #define CamUartRunning CamLink(TxRunning)
57 
58 #define CamEventCheckAndHandle() { \
59  if (CamBuffer()) { \
60  ReadCamBuffer(); \
61  } \
62  if (cam_msg_received) { \
63  parse_cam_msg(); \
64  track_event(); \
65  cam_msg_received = FALSE; \
66  } \
67 }
68 
69 
70 #endif
void track_event(void)
Definition: cam_track.c:121
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
volatile uint8_t cam_msg_received
Definition: cam_track.c:53
struct FloatVect3 target_accel_ned
Definition: cam_track.c:34
void parse_cam_buffer(uint8_t)
Definition: cam_track.c:197
struct FloatVect3 target_speed_ned
Definition: cam_track.c:33
Paparazzi floating point algebra.
void parse_cam_msg(void)
Definition: cam_track.c:164
void track_init(void)
Definition: cam_track.c:57
unsigned char uint8_t
Definition: types.h:14
void track_periodic_task(void)
Definition: cam_track.c:67
struct FloatVect3 target_pos_ned
Definition: cam_track.c:32