Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 869 → Rev 870

/tags/V2.20f/CamCtrl.h
0,0 → 1,145
#ifndef __CAMCTRL_H
#define __CAMCTRL_H
 
#define CAM_SLAVE_ADDRESS 0x26
#define LASER_SLAVE_ADDRESS 0x24
#define GIMBAL_SLAVE_ADDRESS 0x22
 
// FromCamCtrl.CamStatus
#define CAM_STATE_RDY 0x80 // The camera seems to be ready
#define CAM_STATE_REC_ACTIVE 0x40 // Recording Video
#define CAM_STATE_PHOTO_MODE 0x20 // Camera is in Photo Mode
#define CAM_STATE_OFF 0x10 // Camera off but connected
#define CAM_STATE_CAM_DISCONN 0x08 // Camera is not connected
#define CAM_STATE_I2C_OK 0x04 // Cam_Ctrl is connected by I2C (set by NC)
#define CAM_STATE_ZOOM 0x02 // Zoom active
#define CAM_STATE_PIC_CAPTURED 0x01 // Bit for captured one Photo recently
 
 
//FromLaserCtrl.LaserStatus
#define LASER_DATA_OK 0x01
#define LASER_I2C_OK 0x80
 
//FromGimbalCtrl.GimbalStatus
#define GIMBAL_DATA_OK 0x01
#define GIMBAL_I2C_OK 0x80
 
#define GIMBAL_CMD_BEEP 0x01
#define GIMBAL_CMD_YW_REL_FRAME 0x02
#define GIMBAL_CMD_SPEED 0x04
#define GIMBAL_CMD_YW_ZERO 0x08
#define GIMBAL_CMD_OUT1 0x10
#define GIMBAL_CMD_OUT2 0x20
#define GIMBAL_CMD_OUT_TRIGGER 0x40 // will set the Hardware Triggeroutput on the GimbalCtrl
 
// ToCamCtrl.CamCommand
#define CAM_CMD_SWITCH_ON 0x80
#define CAM_CMD_SWITCH_OFF 0x40
#define CAM_CMD_REC_ON 0x20
#define CAM_CMD_REC_OFF 0x10
#define CAM_CMD_SHUTTER 0x08
 
#define CAM_CMD_RESET_CAM 0x02
 
//FromCamCtrl.Type
#define TYPE_LANC 1
#define TYPE_IR 2
#define TYPE_MULTI 3
 
extern s32 FromMenuGimbalYaw,FromMenuServoNickControl, MenuNickGimbalOffset;
 
//ToGimbalCtrl.BitCmd
 
typedef struct
{
u8 CamStatus;
u16 PhotoCount;
u8 free1;
u8 PPM1Okay;
u8 PPM1Data;
u8 PPM2Okay;
u8 PPM2Data;
u8 Type;
u8 Version; // 4 = V1.04 104 = V2.04
u8 Compatible;
} __attribute__((packed)) FromCamCtrl_t;
extern FromCamCtrl_t FromCamCtrl;
 
typedef struct
{
u8 CamCommand;
u8 ZoomInput;
u8 dummy;
} __attribute__((packed)) ToCamCtrl_t;
extern ToCamCtrl_t ToCamCtrl;
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Laser
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
typedef struct
{
u8 LaserStatus;
u16 Distance;
u8 free1;
u8 PPM1Okay;
u8 PPM1Data;
u8 PPM2Okay;
u8 PPM2Data;
u8 Type;
u8 Version; // 4 = V1.04 104 = V2.04
u8 Compatible;
} __attribute__((packed)) FromLaserCtrl_t;
extern FromLaserCtrl_t FromLaserCtrl;
 
typedef struct
{
u8 CamCommand;
u8 ZoomInput;
u8 dummy;
} __attribute__((packed)) ToLaserCtrl_t;
extern ToLaserCtrl_t ToLaserCtrl;
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Gimbal
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
typedef struct
{
u8 GimbalStatus;
s16 Nick;
s16 Roll;
s16 Yaw;
u8 Free1;
u8 Free2;
u8 Version; // 4 = V1.04 104 = V2.04
u8 Compatible;
} __attribute__((packed)) FromGimbalCtrl_t;
extern FromGimbalCtrl_t FromGimbalCtrl;
typedef struct
{
s16 Nick;
s16 Roll;
s16 Yaw;
unsigned char NRY_Speed;
unsigned char Filter;
unsigned char BitCmd;
unsigned char Crc;
} __attribute__((packed)) ToGimbalCtrl_t;
extern ToGimbalCtrl_t ToGimbalCtrl;
 
 
void CamCtrl_GetData(u8);
void InitCamCtrl(void);
extern u16 CamCtrlTimeout;
extern u16 LaserCtrlTimeout;
extern u16 GimbalCtrlTimeout;
extern u16 I2C0_Timeout;
extern u8 ResetNickServoValue;
extern void CamCtrl_UpdateData(u8* pRxBuffer, u8 RxBufferSize);
extern void LaserCtrl_UpdateData(u8* pRxBuffer, u8 RxBufferSize);
extern void LaserCtrl_GetData(u8 timeout);
extern void GimbalCtrl_UpdateData(u8* pRxBuffer, u8 RxBufferSize);
extern void GimbalCtrl_GetData(u8 timeout);
extern void CalcNickServoValue(void);
#endif // __CAMCTRL_H