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
servo_cam_ctrl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 The Paparazzi Team
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 
23 
44 #ifndef servo_cam_ctrl_H
45 #define servo_cam_ctrl_H
46 
47 // Include Standard Camera Control Interface
48 #include "dc.h"
49 
50 // Include Servo and airframe servo channels
51 #include "std.h"
52 #include "inter_mcu.h"
53 #include "generated/airframe.h"
54 
55 extern uint8_t dc_timer;
56 
57 static inline void servo_cam_ctrl_init(void)
58 {
59  // Call common DC init
60  dc_init();
61 
62  // Do LED specific DC init
63  dc_timer = 0;
64 }
65 
66 #define DC_PUSH(X) ap_state->commands[X] = -MAX_PPRZ;
67 #define DC_RELEASE(X) ap_state->commands[X] = MAX_PPRZ;
68 
69 #ifndef DC_SHUTTER_DELAY
70 #define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
71 #endif
72 
73 #ifndef DC_SHUTTER_SERVO
74 #error DC: Please specify at least a SHUTTER SERVO
75 #endif
76 
77 
78 /* 4Hz Periodic */
79 static inline void servo_cam_ctrl_periodic( void )
80 {
81 #ifdef DC_SHOOT_ON_BUTTON_RELEASE
82  if (dc_timer==1) {
84  }
85 #endif
86 
87  if (dc_timer) {
88  dc_timer--;
89  } else {
90  DC_RELEASE(DC_SHUTTER_SERVO);
91 #ifdef DC_ZOOM_IN_SERVO
92  DC_RELEASE(DC_ZOOM_IN_SERVO);
93 #endif
94 #ifdef DC_ZOOM_OUT_SERVO
95  DC_RELEASE(DC_ZOOM_OUT_SERVO);
96 #endif
97 #ifdef DC_POWER_SERVO
98  DC_RELEASE(DC_POWER_SERVO);
99 #endif
100  }
101 
102  // Common DC Periodic task
103  dc_periodic_4Hz();
104 }
105 
106 
107 
108 
109 
110 #endif // DC_H
static void servo_cam_ctrl_init(void)
#define dc_send_shot_position()
Definition: dc.h:126
#define DC_RELEASE(X)
static void servo_cam_ctrl_periodic(void)
uint8_t dc_timer
Definition: led_cam_ctrl.c:26
Standard Digital Camera Control Interface.
static void dc_periodic_4Hz(void)
Definition: dc.h:229
unsigned char uint8_t
Definition: types.h:14
static void dc_init(void)
Definition: dc.h:198