Rev 116 | Rev 190 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 116 | Rev 153 | ||
---|---|---|---|
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 | #define MKOSD_ADDRESS 4 |
9 | 9 | ||
10 | typedef struct |
10 | typedef struct |
11 | { |
11 | { |
12 | u8* pData; |
12 | u8* pData; |
13 | u16 Size; |
13 | u16 Size; |
14 | u16 DataBytes; |
14 | u16 DataBytes; |
15 | u16 Position; |
15 | u16 Position; |
16 | u8 Locked; |
16 | u8 Locked; |
17 | } __attribute__((packed)) Buffer_t; |
17 | } __attribute__((packed)) Buffer_t; |
18 | 18 | ||
19 | extern void Buffer_Init(Buffer_t* pBuffer, u8* pDataBuffer, u16 DataBufferSize); |
19 | extern void Buffer_Init(Buffer_t* pBuffer, u8* pDataBuffer, u16 DataBufferSize); |
20 | extern void Buffer_Clear(Buffer_t* pBuffer); |
20 | extern void Buffer_Clear(Buffer_t* pBuffer); |
21 | 21 | ||
22 | typedef struct |
22 | typedef struct |
23 | { |
23 | { |
24 | u8 Address; |
24 | u8* pAddress; |
25 | u8 CmdID; |
25 | u8* pCmdID; |
26 | u8* pData; |
26 | u8* pData; |
27 | u16 DataLen; |
27 | u16 DataLen; |
28 | } __attribute__((packed)) SerialMsg_t; |
28 | } __attribute__((packed)) SerialMsg_t; |
- | 29 | ||
29 | 30 | extern u8 MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c); |
|
30 | extern void MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....; |
- | |
31 | extern void MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c); |
31 | extern void MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....; |
32 | extern void MKProtocol_DecodeSerialFrame(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
32 | extern void MKProtocol_DecodeSerialFrame(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
33 | 33 | ||
34 | #endif // _MKPROTOCOL_H |
34 | #endif // _MKPROTOCOL_H |
35 | 35 |