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