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
led_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 LED_CAM_CTRL_H
49 #define LED_CAM_CTRL_H
50 
51 // Include Standard Camera Control Interface
52 #include "dc.h"
53 
54 // Include Digital IO
55 #include "led.h"
56 
57 extern uint8_t dc_timer;
58 
59 #ifndef DC_PUSH
60 #define DC_PUSH LED_ON
61 #endif
62 
63 #ifndef DC_RELEASE
64 #define DC_RELEASE LED_OFF
65 #endif
66 
67 #ifndef DC_SHUTTER_DELAY
68 #define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
69 #endif
70 
71 #ifndef DC_SHUTTER_LED
72 #error DC: Please specify at least a SHUTTER LED
73 #endif
74 
75 static inline void led_cam_ctrl_init(void)
76 {
77  // Call common DC init
78  dc_init();
79 
80  // Do LED specific DC init
81  dc_timer = 0;
82 
83  DC_RELEASE(DC_SHUTTER_LED);
84 #ifdef DC_ZOOM_IN_LED
85  DC_RELEASE(DC_ZOOM_IN_LED);
86 #endif
87 #ifdef DC_ZOOM_OUT_LED
88  DC_RELEASE(DC_ZOOM_OUT_LED);
89 #endif
90 #ifdef DC_POWER_LED
91  DC_RELEASE(DC_POWER_LED);
92 #endif
93 }
94 
95 
96 /* 4Hz Periodic */
97 static inline void led_cam_ctrl_periodic( void )
98 {
99 #ifdef DC_SHOOT_ON_BUTTON_RELEASE
100  if (dc_timer==1) {
102  }
103 #endif
104 
105  if (dc_timer) {
106  dc_timer--;
107  } else {
108  DC_RELEASE(DC_SHUTTER_LED);
109 #ifdef DC_ZOOM_IN_LED
110  DC_RELEASE(DC_ZOOM_IN_LED);
111 #endif
112 #ifdef DC_ZOOM_OUT_LED
113  DC_RELEASE(DC_ZOOM_OUT_LED);
114 #endif
115 #ifdef DC_POWER_LED
116  DC_RELEASE(DC_POWER_LED);
117 #endif
118  }
119 
120  // Common DC Periodic task
121  dc_periodic_4Hz();
122 }
123 
124 
125 
126 
127 
128 #endif // DC_H
#define dc_send_shot_position()
Definition: dc.h:126
static void led_cam_ctrl_init(void)
Definition: led_cam_ctrl.h:75
uint8_t dc_timer
Definition: led_cam_ctrl.c:26
Standard Digital Camera Control Interface.
static void led_cam_ctrl_periodic(void)
Definition: led_cam_ctrl.h:97
static void dc_periodic_4Hz(void)
Definition: dc.h:229
unsigned char uint8_t
Definition: types.h:14
#define DC_RELEASE
Definition: led_cam_ctrl.h:64
arch independent LED (Light Emitting Diodes) API
static void dc_init(void)
Definition: dc.h:198