Skip to content

Commit

Permalink
[video] main idea
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter authored and flixr committed Sep 4, 2015
1 parent f2a0bd5 commit c0d1562
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sw/airborne/boards/ardrone2.h
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions sw/airborne/boards/bebop.h
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions sw/airborne/boards/bebop/video.c
Expand Up @@ -37,6 +37,26 @@
#include <linux/i2c-dev.h>
#include <linux/types.h>

#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];
Expand Down
45 changes: 45 additions & 0 deletions 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
* <http://www.gnu.org/licenses/>.
*
*/

/**
* @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 */

0 comments on commit c0d1562

Please sign in to comment.