Rev 460 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 460 | Rev 597 | ||
---|---|---|---|
1 | #ifndef _MKPROTOCOL_H |
1 | #ifndef _MKPROTOCOL_H |
2 | #define _MKPROTOCOL_H |
2 | #define _MKPROTOCOL_H |
3 | #include "buffer.h" |
3 | #include "buffer.h" |
4 | 4 | ||
5 | // slave addresses |
5 | // slave addresses |
6 | #define ANY_ADDRESS 0 |
6 | #define ANY_ADDRESS 0 |
7 | #define FC_ADDRESS 1 |
7 | #define FC_ADDRESS 1 |
8 | #define NC_ADDRESS 2 |
8 | #define NC_ADDRESS 2 |
9 | #define MK3MAG_ADDRESS 3 |
9 | #define MK3MAG_ADDRESS 3 |
10 | #define MKOSD_ADDRESS 4 |
10 | #define MKOSD_ADDRESS 4 |
11 | #define BL_ADDRESS 5 |
11 | #define BL_ADDRESS 5 |
12 | 12 | ||
13 | typedef struct |
13 | typedef struct |
14 | { |
14 | { |
15 | u8 Address; |
15 | u8 Address; |
16 | u8 CmdID; |
16 | u8 CmdID; |
17 | u8* pData; |
17 | u8* pData; |
18 | u16 DataLen; |
18 | u16 DataLen; |
19 | } __attribute__((packed)) SerialMsg_t; |
19 | } __attribute__((packed)) SerialMsg_t; |
20 | 20 | ||
21 | u8 MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c); |
21 | u8 MKProtocol_CollectSerialFrame(Buffer_t* pRxBuff, u8 c); |
22 | u8 MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....; |
22 | u16 MKProtocol_CreateSerialFrame(Buffer_t* pTxBuff, u8 CmdID, u8 Address, u8 numofbuffers , ...); //u8 *data, u8 len, ....; |
23 | u8 AddSerialData(Buffer_t* pTxBuff, u8 *buffer, u16 size); |
23 | u8 AddSerialData(Buffer_t* pTxBuff, u8 *buffer, u16 size); |
24 | void MKProtocol_DecodeSerialFrameHeader(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
24 | void MKProtocol_DecodeSerialFrameHeader(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
25 | void MKProtocol_DecodeSerialFrameData(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
25 | void MKProtocol_DecodeSerialFrameData(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg); |
26 | 26 | ||
27 | #endif // _MKPROTOCOL_H |
27 | #endif // _MKPROTOCOL_H |
28 | 28 |