Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

ocamerac328.h

00001 /*
00002 Object Oriented Mobile Robot Model (OOMRM) C++  Library Copyright (C) 2006  Derek Jones
00003 
00004 This library is free software; you can redistribute it  and/or
00005 modify it under the terms of the GNU Lesser General Public
00006 License  as published by the Free Software Foundation; either
00007 version 2.1 of the  License, or (at your option) any later version.
00008 
00009 This library is  distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY;  without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU
00012 Lesser General Public License for more  details.
00013 
00014 You should have received a copy of the GNU Lesser General  Public
00015 License along with this library; if not, write to the Free  Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307  USA
00017 
00018 $Id: ocamerac328.h,v 1.6 2007/10/09 01:58:59 derek Exp $ 
00019 */
00020 
00021 #ifndef CAMERAC328_H
00022 #define CAMERAC328_H
00023 #include <types.h>
00024 #include <hardware/ouart.h>
00025 #include <hardware/ocamera.h>
00026 #include <oconsole.h>
00036 #define C328_VIEW_STOP ((char)0xD)
00037 /*
00038 
00039 Camera: RX [Output Vcc=3.3 Tx Input Vcc=5v]
00040 MRM   : RX [Output Vcc=5v  Tx Input Vcc=3.3]
00041 */
00042 #define C328_Command_Start 0xAA
00043 
00045 
00061 class oCameraC328
00062 {   
00063 public:
00065 
00070   oCameraC328(IOLINE rx, IOLINE tx, uint8 subclass=0);
00072 
00077   C328_ERROR_NUMBER receive_data_ack(int timeout=100000);
00078   C328_ERROR_NUMBER compressed_picture(int psize, uint32 sz);
00079   C328_ERROR_NUMBER uncompressed_picture(uint32 sz); 
00080   C328_ERROR_NUMBER shoot(void); 
00082   C328_ERROR_NUMBER reshoot(void);
00083   bool baudrate(int baud);
00084   bool connect(void);
00085   void send_command(C328_COMMAND, uint8 p1, uint8 p2, uint8 p3, uint8 p4);
00086   bool wait_receive(C328_COMMAND c);
00087   bool wait_data(C328_DATA_TYPE& t, uint32& size);
00088 //  bool wait_receive(C328_COMMAND c, uint8 p1, uint8 p2, uint8 p3, uint8 p4);
00089   bool get_command(uint8* command);
00091 //  bool receive_ack(void);
00093   bool error(void);
00095   void reset(void);
00096   bool get_any_ack();
00098   static uint8    status(void); 
00100   static void status(uint8 s);
00102   static foo2 callback(void);
00103   oUART _tx;
00104   oUART _rx;
00105 protected:
00106   uint8 _status; 
00107 //  word RXbuffer[C328_BUFFSIZE+1];
00108   bool _error;
00109   oCameraC328(void);
00110 private:
00111   bool check_rest(word c, word icheck);
00112   // polls for the character  on uart rx channel.  Built-in time-out counter.
00113   bool wait_char(uint8& cwait, int timeout=50000);
00114   uint8 _command[7];
00115   C328_PICTURE_TYPE _pt;
00116   C328_SNAPSHOT_TYPE _st;
00117 
00118 };
00119 
00120 
00121 #endif

Generated on Mon Oct 8 19:32:43 2007 for OOMRM Hardware API by doxygen1.3