Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 #include "mcu_periph/uart.h"
34 #include "pprzlink/messages.h"
36 #include "state.h"
37 
38 
40 {
41 }
42 
44 {
45  dc_periodic();
46 
47  // Request Status
49 }
50 
51 
52 
54 {
55  static uint8_t zoom = 0;
56  static uint8_t mode = 0;
57  unsigned char cam_ret[1];
58 
59  if (cmd == DC_SHOOT) {
61  } else if (cmd == DC_TALLER) {
62  zoom = 1;
63  } else if (cmd == DC_WIDER) {
64  zoom = 0;
65  } else if (cmd == DC_GET_STATUS) {
66  mode++;
67  if (mode > 15) {
68  mode = 0;
69  }
70  }
71 
72  cam_ret[0] = mode + zoom * 0x20;
73  RunOnceEvery(6, DOWNLINK_SEND_PAYLOAD(DefaultChannel, DefaultDevice, 1, cam_ret));
74 
75 }
76 
78 {
79 }
80 
81 
82 
void dc_send_command(uint8_t cmd)
Send Command To Camera.
void dc_periodic(void)
periodic function
Definition: dc.c:279
void dc_send_shot_position(void)
Send Down the coordinates of where the photo was taken.
Definition: dc.c:106
@ DC_GET_STATUS
Definition: dc.h:99
@ DC_WIDER
Definition: dc.h:104
@ DC_SHOOT
Definition: dc.h:102
@ DC_TALLER
Definition: dc.h:105
void atmega_i2c_cam_ctrl_event(void)
void atmega_i2c_cam_ctrl_init(void)
void atmega_i2c_cam_ctrl_send(uint8_t cmd)
void atmega_i2c_cam_ctrl_periodic(void)
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition: sonar_bebop.c:65
API to get/set the generic vehicle states.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98