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 
38 {
39  // Common DC Periodic task
40  dc_periodic();
41 }
42 
43 /* Command The Camera */
45 {
46 
47  if (cmd == DC_SHOOT) {
49  }
50 
51  // call command send_command function
53 }
54 
57 
58 void dc_set_expo(float expo)
59 {
60  dc_exposure = expo;
61  uint8_t tab[2];
62  tab[0] = 'e';
63  tab[1] = (uint8_t)(expo * 10.f);
64  uint8_t dst_id = 0;
65  DOWNLINK_SEND_PAYLOAD_COMMAND(extra_pprz_tp, EXTRA_DOWNLINK_DEVICE, &dst_id, 2, tab);
66 }
67 
68 void dc_expo_cb(uint8_t* buf) {
69  if (DL_PAYLOAD_COMMAND_ac_id(buf) != AC_ID) { return; }
70 
71  // feedback from camera
72  if (DL_PAYLOAD_COMMAND_command_length(buf) == 2 && DL_PAYLOAD_COMMAND_command(buf)[0] == 'e') {
73  dc_exposure = DL_PAYLOAD_COMMAND_command(buf)[1] / 10.0;
74  }
75 }
76 
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:106
float dc_exposure
camera exposure
Definition: dc.c:72
Standard Digital Camera Control Interface.
@ DC_SHOOT
Definition: dc.h:102
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