00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00040
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
00089 bool get_command(uint8* command);
00091
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
00108 bool _error;
00109 oCameraC328(void);
00110 private:
00111 bool check_rest(word c, word icheck);
00112
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