Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gpio_cam_ctrl.c
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
36#include "gpio_cam_ctrl.h"
37#include "generated/airframe.h"
38#include "generated/modules.h"
39
40// Include Standard Camera Control Interface
41#include "dc.h"
42
43#include "mcu_periph/gpio.h"
44
45#ifndef DC_PUSH
46#define DC_PUSH gpio_set
47#endif
48
49#ifndef DC_RELEASE
50#define DC_RELEASE gpio_clear
51#endif
52
54#ifndef DC_SHUTTER_DELAY
55#define DC_SHUTTER_DELAY 0.5
56#endif
57
59#ifndef DC_POWER_OFF_DELAY
60#define DC_POWER_OFF_DELAY 0.75
61#endif
62
63#ifdef DC_SHUTTER_LED
64#warning DC_SHUTTER_LED is obsolete, please use DC_SHUTTER_GPIO
65#endif
66#ifndef DC_SHUTTER_GPIO
67#error DC: Please specify at least a DC_SHUTTER_GPIO (e.g. <define name="DC_SHUTTER_GPIO" value="GPIOC,GPIO12"/>)
68#endif
69
70
71// Button Timer
73
75{
76 // Do gpio specific DC init
77 dc_timer = 0;
78
81#ifdef DC_ZOOM_IN_GPIO
84#endif
85#ifdef DC_ZOOM_OUT_GPIO
88#endif
89#ifdef DC_POWER_GPIO
92#endif
93#ifdef DC_POWER_OFF_GPIO
96#endif
97}
98
100{
101#ifdef DC_SHOOT_ON_BUTTON_RELEASE
102 if (dc_timer == 1) {
104 }
105#endif
106
107 if (dc_timer) {
108 dc_timer--;
109 } else {
111#ifdef DC_ZOOM_IN_GPIO
113#endif
114#ifdef DC_ZOOM_OUT_GPIO
116#endif
117#ifdef DC_POWER_GPIO
119#endif
120#ifdef DC_POWER_OFF_GPIO
122#endif
123 }
124
125 // Common DC Periodic task
126 dc_periodic();
127}
128
129/* Command The Camera */
131{
133
134 switch (cmd) {
135 case DC_SHOOT:
137#ifndef DC_SHOOT_ON_BUTTON_RELEASE
139#endif
140 break;
141#ifdef DC_ZOOM_IN_GPIO
142 case DC_TALLER:
144 break;
145#endif
146#ifdef DC_ZOOM_OUT_GPIO
147 case DC_WIDER:
149 break;
150#endif
151#ifdef DC_POWER_GPIO
152 case DC_ON:
154 break;
155#endif
156#ifdef DC_POWER_OFF_GPIO
157 case DC_OFF:
160 break;
161#endif
162 default:
163 break;
164 }
165
166 // call command send_command function
168}
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
Definition gpio_arch.c:33
void dc_periodic(void)
periodic function
Definition dc.c:279
void dc_send_command_common(uint8_t cmd)
Command sending function.
Definition dc.c:192
void dc_send_shot_position(void)
Send Down the coordinates of where the photo was taken.
Definition dc.c:153
Standard Digital Camera Control Interface.
@ DC_OFF
Definition dc.h:118
@ DC_WIDER
Definition dc.h:104
@ DC_SHOOT
Definition dc.h:102
@ DC_TALLER
Definition dc.h:105
@ DC_ON
Definition dc.h:117
Some architecture independent helper functions for GPIOs.
#define DC_POWER_OFF_DELAY
how long to send power off in seconds
#define DC_PUSH
void dc_send_command(uint8_t cmd)
Send Command To Camera.
void gpio_cam_ctrl_init(void)
#define DC_SHUTTER_DELAY
how long to push shutter in seconds
void gpio_cam_ctrl_periodic(void)
Periodic.
uint8_t dc_timer
#define DC_RELEASE
Digital Camera Control.
uint16_t foo
Definition main_demo5.c:58
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.