From c0d1562d674585eaa5f089b323a9d9a109128989 Mon Sep 17 00:00:00 2001 From: Christophe De Wagter Date: Fri, 4 Sep 2015 21:26:09 +0200 Subject: [PATCH] [video] main idea --- sw/airborne/boards/ardrone2.h | 6 ++++ sw/airborne/boards/bebop.h | 3 ++ sw/airborne/boards/bebop/video.c | 20 ++++++++++++ sw/airborne/subsystems/video_device.h | 45 +++++++++++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 sw/airborne/subsystems/video_device.h diff --git a/sw/airborne/boards/ardrone2.h b/sw/airborne/boards/ardrone2.h index cbba10fa890..608cb9ba67e 100644 --- a/sw/airborne/boards/ardrone2.h +++ b/sw/airborne/boards/ardrone2.h @@ -3,10 +3,16 @@ #define BOARD_ARDRONE2 +#include "subsystems/video_device.h" + #ifndef UART1_DEV #define UART1_DEV "/dev/ttyUSB0" #endif +/* Cameras */ +extern struct video_device_t bottom_camera; +extern struct video_device_t front_camera; + /* Default actuators driver */ #define DEFAULT_ACTUATORS "boards/ardrone/actuators.h" #define ActuatorDefaultSet(_x,_y) ActuatorArdroneSet(_x,_y) diff --git a/sw/airborne/boards/bebop.h b/sw/airborne/boards/bebop.h index 45b72faf7ba..e1e50f2984f 100644 --- a/sw/airborne/boards/bebop.h +++ b/sw/airborne/boards/bebop.h @@ -34,6 +34,9 @@ #define ActuatorsDefaultInit() ActuatorsBebopInit() #define ActuatorsDefaultCommit() ActuatorsBebopCommit() +/* Cameras */ +extern struct video_device_t bottom_camera; +extern struct video_device_t front_camera; /* by default activate onboard baro */ #ifndef USE_BARO_BOARD diff --git a/sw/airborne/boards/bebop/video.c b/sw/airborne/boards/bebop/video.c index 4863542011c..1e1606f9352 100644 --- a/sw/airborne/boards/bebop/video.c +++ b/sw/airborne/boards/bebop/video.c @@ -37,6 +37,26 @@ #include #include +#include "subsystems/video_device.h" + +struct video_device_t bottom_camera = { + .w = 640, + .h = 480, + .dev_name = "/dev/video0", + .subdev_name = NULL, + .format = V4L2_PIX_FMT_UYVY, + .filters = NULL +}; + +struct video_device_t front_camera = { + .w = 1408, + .h = 2112, + .dev_name = "/dev/video1", + .subdev_name = "/dev/v4l-subdev1", + .format = V4L2_PIX_FMT_SGBRG10, + .filters = NULL //{DeMosaic, AEC, ABW} +}; + static bool_t write_reg(int fd, char *addr_val, uint8_t cnt) { char resp[cnt - 2]; diff --git a/sw/airborne/subsystems/video_device.h b/sw/airborne/subsystems/video_device.h new file mode 100644 index 00000000000..3bbd1172bbe --- /dev/null +++ b/sw/airborne/subsystems/video_device.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2015 + * + * This file is part of Paparazzi. + * + * Paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * Paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, see + * . + * + */ + +/** + * @file subsystems/video_device.h + * @brief v4l2 video device settings interface + * Works on Linux platforms + */ + +#ifndef VIDEO_DEVICE_H +#define VIDEO_DEVICE_H + +#include "std.h" +#include "lib/v4l/v4l2.h" + +/** V4L2 device settings */ +struct video_device_t { + int w; ///< Width + int h; ///< Height + char* dev_name; ///< path to device + char* subdev_name; ///< path to sub device + uint32_t format; ///< Video format + void* filters; ///< filters to use +}; + + +#endif /* VIDEO_DEVICE_H */