Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * nao.h - V4L2 camera with Nao specific extensions 00004 * 00005 * Created: Sun Feb 01 13:56:23 2009 00006 * Copyright 2008 Tobias Kellner 00007 * 2009 Tim Niemueller [www.niemueller.de] 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. A runtime exception applies to 00015 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00023 */ 00024 00025 #ifndef __FIREVISION_CAMS_NAO_H_ 00026 #define __FIREVISION_CAMS_NAO_H_ 00027 00028 #include <fvcams/v4l2.h> 00029 00030 #include <fvcams/control/source.h> 00031 00032 #include <core/exceptions/software.h> 00033 #include <unistd.h> 00034 00035 #define DSPIC_I2C_ADDR 0x8 00036 #define DSPIC_SWITCH_REG 220 00037 #define I2C_SLAVE 0x0703 00038 00039 namespace firevision { 00040 #if 0 /* just to make Emacs auto-indent happy */ 00041 } 00042 #endif 00043 00044 class CameraArgumentParser; 00045 00046 class NaoCamera : 00047 public V4L2Camera, 00048 public CameraControlSource 00049 { 00050 public: 00051 NaoCamera(const CameraArgumentParser *cap); 00052 virtual ~NaoCamera(); 00053 00054 virtual unsigned char source(); 00055 virtual void set_source(unsigned char source); 00056 virtual bool auto_exposure(); 00057 virtual void set_auto_exposure(bool enabled); 00058 00059 private: 00060 static int open_dev(const char *i2c); 00061 static void close_dev(int dev, const char *error = 0); 00062 static int get_open_cam_id(int dev); 00063 static void switch_to_cam_id(int dev, int cam_id); 00064 static void init_cam(const char *cam); 00065 00066 private: 00067 char *__i2c_device_name; ///< I2C device file descriptor 00068 int __cam_id; ///< ID of the Camera to be used 00069 bool __can_switch_cam; ///< Needs to be Nao V3 for camera switching 00070 }; 00071 00072 } // end namespace firevision 00073 00074 #endif //__FIREVISION_CAMS_V4L2_H_ 00075