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
booz_cam.h
Go to the documentation of this file.
1 /*
2  * $Id: $
3  *
4  * Copyright (C) 2009 Gautier Hattenberger <gautier.hattenberger@laas.fr>,
5  * Antoine Drouin <poinix@gmail.com>
6  *
7  * This file is part of paparazzi.
8  *
9  * paparazzi is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * paparazzi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with paparazzi; see the file COPYING. If not, write to
21  * the Free Software Foundation, 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24 
25 #ifndef BOOZ_CAM_H
26 #define BOOZ_CAM_H
27 
28 #include "generated/airframe.h"
29 #include "math/pprz_algebra_int.h"
30 #include "std.h"
31 #include "led.h"
32 
33 #define BOOZ_CAM_MODE_NONE 0
34 #define BOOZ_CAM_MODE_MANUAL 1
35 #define BOOZ_CAM_MODE_HEADING 2
36 #define BOOZ_CAM_MODE_WP 3
37 
38 // Warning:
39 // LED_ON set GPIO low
40 // LED_OFF set GPIO high
41 #ifndef BOOZ_CAM_ON
42 #define BOOZ_CAM_ON LED_OFF(CAM_SWITCH_LED)
43 #endif
44 #ifndef BOOZ_CAM_OFF
45 #define BOOZ_CAM_OFF LED_ON(CAM_SWITCH_LED)
46 #endif
47 
48 extern uint8_t booz_cam_mode;
49 
50 #ifdef BOOZ_CAM_TILT_NEUTRAL
51 extern int16_t booz_cam_tilt_pwm;
52 extern int16_t booz_cam_tilt;
53 #endif
54 #ifdef BOOZ_CAM_PAN_NEUTRAL
55 extern int16_t booz_cam_pan;
56 #endif
57 
58 extern void booz_cam_init(void);
59 extern void booz_cam_periodic(void);
60 
61 #define booz_cam_SetCamMode(_v) { \
62  booz_cam_mode = _v; \
63  if (booz_cam_mode == BOOZ_CAM_MODE_NONE) { BOOZ_CAM_OFF; } \
64  else { BOOZ_CAM_ON; } \
65 }
66 
67 #define BOOZ_CAM_STICK_TILT_INC (ANGLE_BFP_OF_REAL(RadOfDeg(10.))/127.)
68 #define BOOZ_CAM_STICK_PAN_INC (ANGLE_BFP_OF_REAL(RadOfDeg(20.))/127.)
69 
70 #define BOOZ_CAM_STICK_PARSE(_dl_buffer) { \
71  booz_cam_tilt += (int16_t)(BOOZ_CAM_STICK_TILT_INC*(float)DL_BOOZ_CAM_STICK_tilt(_dl_buffer)); \
72  booz_cam_pan += (int16_t)(BOOZ_CAM_STICK_PAN_INC*(float)DL_BOOZ_CAM_STICK_pan(dl_buffer)); \
73  INT32_COURSE_NORMALIZE(booz_cam_pan); \
74 }
75 
76 #endif /* BOOZ2_CAM_H */
77 
void booz_cam_init(void)
Definition: booz_cam.c:75
signed short int16_t
Definition: types.h:17
unsigned char uint8_t
Definition: types.h:14
void booz_cam_periodic(void)
Definition: booz_cam.c:93
arch independent LED (Light Emitting Diodes) API
uint8_t booz_cam_mode
Definition: booz_cam.c:33
Paparazzi fixed point algebra.