Paparazzi UAS  v4.0.4_stable-3-gf39211a
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 static inline void led_cam_ctrl_init(void)
56 {
57  // Call common DC init
58  dc_init();
59 
60  // Do LED specific DC init
61  dc_timer = 0;
62 }
63 
64 #ifndef DC_PUSH
65 #define DC_PUSH LED_ON
66 #endif
67 
68 #ifndef DC_RELEASE
69 #define DC_RELEASE LED_OFF
70 #endif
71 
72 #ifndef DC_SHUTTER_DELAY
73 #define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
74 #endif
75 
76 #ifndef DC_SHUTTER_LED
77 #error DC: Please specify at least a SHUTTER LED
78 #endif
79 
80 
81 /* 4Hz Periodic */
82 static inline void led_cam_ctrl_periodic( void )
83 {
84  if (dc_timer) {
85  dc_timer--;
86  } else {
87  DC_RELEASE(DC_SHUTTER_LED);
88 #ifdef DC_ZOOM_IN_LED
89  DC_RELEASE(DC_ZOOM_IN_LED);
90 #endif
91 #ifdef DC_ZOOM_OUT_LED
92  DC_RELEASE(DC_ZOOM_OUT_LED);
93 #endif
94 #ifdef DC_POWER_LED
95  DC_RELEASE(DC_POWER_LED);
96 #endif
97  }
98 
99  // Common DC Periodic task
100  dc_periodic_4Hz();
101 }
102 
103 
104 
105 
106 
107 #endif // DC_H
static void led_cam_ctrl_init(void)
Definition: led_cam_ctrl.h:55
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:82
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:69
arch independent LED (Light Emitting Diodes) API
static void dc_init(void)
Definition: dc.h:198