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