📄 photo.h
字号:
#ifndef PHOTO_HEADER
#define PHOTO_HEADER
//定义摄像头的波特率
#define PHOTOBAUD_115200 0x00h
#define PHOTOBAUD_9600 0x01h
#define PHOTOBAUD_14400 0x02h
#define PHOTOBAUD_19200 0x03h
#define PHOTOBAUD_38400 0x05h
#define PHOTOBAUD_57600 0x06h
#define PHOTOSTATE_THRD 0x80
//摄像头的四种状态机
//定义摄像头的状态
#define PHOTO_INIAL 0//初始状态
#define PHOTO_SENDINIAL 0//发送初始化
#define PHOTO_RECIEVEINIAL PHOTOSTATE_THRD+PHOTO_SENDINIAL//接受初始化信息
#define PHOTO_RECIEVEPHOTOINIAL PHOTOSTATE_THRD+PHOTO_SENDINIAL+0x10
#define PHOTO_SETFORMAT 1//发送设置图象格式
#define PHOTO_RECIEVEFORMAT PHOTOSTATE_THRD+PHOTO_SETFORMAT//接收设置图象格式
#define PHOTO_SETPACKETSIZE 2//设置包大小
#define PHOTO_RECIEVEPACKETSIZE PHOTOSTATE_THRD+PHOTO_SETPACKETSIZE//接收设置包大小
#define PHOTO_QUICKSNAP 3//快照
#define PHOTO_RECIEVEQUICKSNAP PHOTOSTATE_THRD+PHOTO_QUICKSNAP
#define PHOTO_GETPHOTODATA 4//获取照相数据
#define PHOTO_RECIEVEGETPHOTODATA PHOTOSTATE_THRD+PHOTO_GETPHOTODATA//应答
#define PHOTO_PHOTOSNAP PHOTOSTATE_THRD+PHOTO_GETPHOTODATA+0x10
#define PHOTO_FIRSTPHOTO 9
#define PHOTO_PHOTOPACKET PHOTOSTATE_THRD+PHOTO_FIRSTPHOTO
#define PHOTO_PHOTODATAREQ 5
#define PHOTO_RETRYDATA 7
#define PHOTO_RETRYDATATIMING 8
#define PHOTO_RECIEVERETRYDATA PHOTOSTATE_THRD+PHOTO_RETRYDATA
#define PHOTO_RECIEVETIMINGDATA PHOTOSTATE_THRD+PHOTO_RETRYDATATIMING
#define PHOTO_RESPONSEINIAL 6
#define PHOTO_PHOTODATAOVER 10
#define PHOTO_WAITCOMMAND PHOTOSTATE_THRD-1
#define PHOTO_NOPHOTO 0xff
//命令ID
#define PHOTO_COMMAND_INIAL 0x0d
#define PHOTO_ERRORPACKET 0xff//对于无法解析的包
//定义照片机返回应答的种类
#define PHOTO_RESPONSE_NUM 5
//应答
#define PHOTO_RET_INIAL 0//0x0d//初始化应答
#define PHOTO_RET_MODE 1//0x01//设置图象格式应答
#define PHOTO_RET_PACKETSIZE 2//0x06//设置包大小应答
#define PHOTO_RET_SNAP 3//0x05//快照应答
#define PHOTO_RET_DATA 4//0x04//照片数据应答
//相机主动发送的包
#define PHOTO_REQ_PHOTOINIAL 0x81
#define PHOTO_REQ_PHOTOSIZE 0x82
/*照片模式*/
#define PHOTO_VGAMODE 0x07//320*240, 352*288
#define PHOTO_CIFMODE 0x05//160*120, 176*144
#define PHOTO_QCIFMODE 0x03//640*480, 640*480
/***以下定义照片包的宏********/
#define PHOTO_PACK_NUM 200//最多200个包?
#define PHOTO_PACK_NOUSE 0x00//无需发送
#define PHOTO_PACK_WAITACK 0x01//等待确认
void photo_init();
//1s处理一次
void photo_1s_process();
//每50ms处理一次
void photo_process();
void photo_addretryThrd(Byte nValue);
//组织发送包
void photo_sendpacket(Byte* pBuf, Byte type, Uint16 value);
//发送模块
void photo_sendpro();
/***需要查询下一个,返回VALID_DATA
不需要查询,返回INVALID_DATA***/
Byte photo_setnextPacket();
//接收模块
void photo_recievepro();
void photo_setPacketState(Byte nValue);
void photostart_photo(Byte *pMsgNum);
#define PHOTO_GPRSTIMEOUT 18//28//16
#define PHOTO_REPHOTOTIMEOUT 8
void photo_stopphoto();
#define PHOTO_DATASENDING 1
#define PHOTO_NODATASEND 0
Byte photo_getdatastatus();
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -