Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
pprzlink_cam_ctrl.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
26 #include "generated/airframe.h"
27 #include "generated/modules.h"
28 
29 // Include Standard Camera Control Interface
30 #include "dc.h"
31 
33 
35 {
36  digital_cam_exposure = 0.f; // auto expo
37 }
38 
40 {
41  // Common DC Periodic task
42  dc_periodic();
43 }
44 
45 /* Command The Camera */
47 {
48 
49  if (cmd == DC_SHOOT) {
51  }
52 
53  // call command send_command function
55 }
56 
59 
61 {
62  digital_cam_exposure = expo;
63  uint8_t tab[2];
64  tab[0] = 'e';
65  tab[1] = (uint8_t)(expo * 10.f);
66  uint8_t dst_id = 0;
67  DOWNLINK_SEND_PAYLOAD_COMMAND(extra_pprz_tp, EXTRA_DOWNLINK_DEVICE, &dst_id, 2, tab);
68 }
69 
70 void dc_expo_cb(uint8_t* buf) {
71  if (DL_PAYLOAD_COMMAND_ac_id(buf) != AC_ID) { return; }
72 
73  // feedback from camera
74  if (DL_PAYLOAD_COMMAND_command_length(buf) == 2 && DL_PAYLOAD_COMMAND_command(buf)[0] == 'e') {
75  digital_cam_exposure = DL_PAYLOAD_COMMAND_command(buf)[1] / 10.0;
76  }
77 }
78 
void dc_periodic(void)
periodic function
Definition: dc.c:274
void dc_send_command_common(uint8_t cmd)
Command sending function.
Definition: dc.c:189
void dc_send_shot_position(void)
Send Down the coordinates of where the photo was taken.
Definition: dc.c:104
Standard Digital Camera Control Interface.
@ DC_SHOOT
Definition: dc.h:100
struct pprz_transport extra_pprz_tp
Definition: extra_pprz_dl.c:57
Extra datalink and telemetry using PPRZ protocol.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98