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
sim_i2c_cam_ctrl.c
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 
30 #include "atmega_i2c_cam_ctrl.h"
31 
32 
33 #ifndef DOWNLINK_DEVICE
34 #define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
35 #endif
36 #include "mcu_periph/uart.h"
37 #include "messages.h"
39 #include "state.h"
40 
41 
43 {
44  dc_init();
45 }
46 
48 {
50 
51  // Request Status
53 }
54 
55 
56 
58 {
59  static uint8_t zoom = 0;
60  static uint8_t mode = 0;
61  unsigned char cam_ret[1];
62 
63  if (cmd == DC_SHOOT)
64  {
66  }
67  else if (cmd == DC_TALLER)
68  {
69  zoom = 1;
70  }
71  else if (cmd == DC_WIDER)
72  {
73  zoom = 0;
74  }
75  else if (cmd == DC_GET_STATUS)
76  {
77  mode++;
78  if (mode > 15)
79  mode = 0;
80  }
81 
82  cam_ret[0] = mode + zoom * 0x20;
83  RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, DefaultDevice, 1, cam_ret ));
84 
85 }
86 
88 {
89 }
90 
91 
92 
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define dc_send_shot_position()
Definition: dc.h:126
Definition: dc.h:82
Definition: dc.h:85
static void dc_periodic_4Hz(void)
Definition: dc.h:229
Definition: dc.h:84
void atmega_i2c_cam_ctrl_init(void)
void dc_send_command(uint8_t cmd)
unsigned char uint8_t
Definition: types.h:14
API to get/set the generic vehicle states.
void atmega_i2c_cam_ctrl_send(uint8_t cmd)
void atmega_i2c_cam_ctrl_periodic(void)
void atmega_i2c_cam_ctrl_event(void)
static void dc_init(void)
Definition: dc.h:198