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
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 
48 #ifndef servo_cam_ctrl_H
49 #define servo_cam_ctrl_H
50 
51 // Include Standard Camera Control Interface
52 #include "dc.h"
53 
54 // Include Servo and airframe servo channels
55 #include "std.h"
56 #include "inter_mcu.h"
57 #include "generated/airframe.h"
58 
59 extern uint8_t dc_timer;
60 
61 static inline void servo_cam_ctrl_init(void)
62 {
63  // Call common DC init
64  dc_init();
65 
66  // Do LED specific DC init
67  dc_timer = 0;
68 }
69 
70 #define DC_PUSH(X) ap_state->commands[X] = -MAX_PPRZ;
71 #define DC_RELEASE(X) ap_state->commands[X] = MAX_PPRZ;
72 
73 #ifndef DC_SHUTTER_DELAY
74 #define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
75 #endif
76 
77 #ifndef DC_SHUTTER_SERVO
78 #error DC: Please specify at least a SHUTTER SERVO
79 #endif
80 
81 
82 /* 4Hz Periodic */
83 static inline void servo_cam_ctrl_periodic( void )
84 {
85 #ifdef DC_SHOOT_ON_BUTTON_RELEASE
86  if (dc_timer==1) {
88  }
89 #endif
90 
91  if (dc_timer) {
92  dc_timer--;
93  } else {
94  DC_RELEASE(DC_SHUTTER_SERVO);
95 #ifdef DC_ZOOM_IN_SERVO
96  DC_RELEASE(DC_ZOOM_IN_SERVO);
97 #endif
98 #ifdef DC_ZOOM_OUT_SERVO
99  DC_RELEASE(DC_ZOOM_OUT_SERVO);
100 #endif
101 #ifdef DC_POWER_SERVO
102  DC_RELEASE(DC_POWER_SERVO);
103 #endif
104  }
105 
106  // Common DC Periodic task
107  dc_periodic_4Hz();
108 }
109 
110 
111 
112 
113 
114 #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