Subversion Repositories NaviCtrl

Rev

Rev 112 | Rev 153 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 112 Rev 116
1
#ifndef _MKPROTOCOL_H
1
#ifndef _MKPROTOCOL_H
2
#define _MKPROTOCOL_H
2
#define _MKPROTOCOL_H
3
 
3
 
4
// slave addresses
4
// slave addresses
5
#define FC_ADDRESS 1
5
#define FC_ADDRESS 1
6
#define NC_ADDRESS 2
6
#define NC_ADDRESS 2
7
#define MK3MAG_ADDRESS 3
7
#define MK3MAG_ADDRESS 3
-
 
8
#define MKOSD_ADDRESS 4
8
 
9
 
9
typedef struct
10
typedef struct
10
{
11
{
11
        u8* pData;
12
        u8* pData;
12
        u16 Size;
13
        u16 Size;
13
        u16 DataBytes;
14
        u16 DataBytes;
14
        u16 Position;
15
        u16 Position;
15
        u8  Locked;
16
        u8  Locked;
16
} __attribute__((packed)) Buffer_t;
17
} __attribute__((packed)) Buffer_t;
17
 
18
 
18
extern void Buffer_Init(Buffer_t* pBuffer, u8* pDataBuffer, u16 DataBufferSize);
19
extern void Buffer_Init(Buffer_t* pBuffer, u8* pDataBuffer, u16 DataBufferSize);
19
extern void Buffer_Clear(Buffer_t* pBuffer);
20
extern void Buffer_Clear(Buffer_t* pBuffer);
20
 
21
 
21
typedef struct
22
typedef struct
22
{
23
{
23
        u8 Address;
24
        u8 Address;
24
        u8 CmdID;
25
        u8 CmdID;
25
        u8* pData;
26
        u8* pData;
26
        u16 DataLen;
27
        u16 DataLen;
27
} __attribute__((packed)) SerialMsg_t;
28
} __attribute__((packed)) SerialMsg_t;
28
 
29
 
29
extern void MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....;
30
extern void MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....;
30
extern void MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c);
31
extern void MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c);
31
extern void MKProtocol_DecodeSerialFrame(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg);
32
extern void MKProtocol_DecodeSerialFrame(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg);
32
 
33
 
33
#endif // _MKPROTOCOL_H
34
#endif // _MKPROTOCOL_H
34
 
35