Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
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-2014 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 
39 #ifndef SERVO_CAM_CTRL_H
40 #define SERVO_CAM_CTRL_H
41 
42 // Include Standard Camera Control Interface
43 #include "dc.h"
44 
45 // Include Servo and airframe servo channels
46 #include "std.h"
47 #include "inter_mcu.h"
48 #include "generated/airframe.h"
49 
50 extern uint8_t dc_timer;
51 
52 static inline void servo_cam_ctrl_init(void)
53 {
54  // Call common DC init
55  dc_init();
56 
57  // Do LED specific DC init
58  dc_timer = 0;
59 }
60 
61 #define DC_PUSH(X) ap_state->commands[X] = -MAX_PPRZ;
62 #define DC_RELEASE(X) ap_state->commands[X] = MAX_PPRZ;
63 
64 #ifndef DC_SHUTTER_DELAY
65 #define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
66 #endif
67 
68 #ifndef DC_SHUTTER_SERVO
69 #error DC: Please specify at least a DC_SHUTTER_SERVO
70 #endif
71 
72 
73 /* 4Hz Periodic */
74 static inline void servo_cam_ctrl_periodic( void )
75 {
76 #ifdef DC_SHOOT_ON_BUTTON_RELEASE
77  if (dc_timer==1) {
79  }
80 #endif
81 
82  if (dc_timer) {
83  dc_timer--;
84  } else {
85  DC_RELEASE(DC_SHUTTER_SERVO);
86 #ifdef DC_ZOOM_IN_SERVO
87  DC_RELEASE(DC_ZOOM_IN_SERVO);
88 #endif
89 #ifdef DC_ZOOM_OUT_SERVO
90  DC_RELEASE(DC_ZOOM_OUT_SERVO);
91 #endif
92 #ifdef DC_POWER_SERVO
93  DC_RELEASE(DC_POWER_SERVO);
94 #endif
95  }
96 
97  // Common DC Periodic task
99 }
100 
101 #endif // SERVO_CAM_CONTROL_H
static void servo_cam_ctrl_init(void)
#define dc_send_shot_position()
Definition: dc.h:126
#define DC_RELEASE
static void servo_cam_ctrl_periodic(void)
uint8_t dc_timer
Definition: gpio_cam_ctrl.c:69
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