Rev 418 | Rev 432 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 418 | Rev 430 | ||
---|---|---|---|
Line 238... | Line 238... | ||
238 | u16 ptrIn = 3; // start with first data byte in rx buffer |
238 | u16 ptrIn = 3; // start with first data byte in rx buffer |
239 | u16 ptrOut = 3; |
239 | u16 ptrOut = 3; |
240 | u16 len = pRxBuff->DataBytes - 6; // must be a multiple of 4 (3 bytes at begin and 3 bytes at end are no payload ) |
240 | u16 len = pRxBuff->DataBytes - 6; // must be a multiple of 4 (3 bytes at begin and 3 bytes at end are no payload ) |
Line 241... | Line 241... | ||
241 | 241 | ||
242 | len/=4; // number of 4 byte blocks |
242 | len/=4; // number of 4 byte blocks |
243 | while(len) |
243 | while(len--) |
244 | { |
244 | { |
245 | a = pRxBuff->pData[ptrIn++] - '='; |
245 | a = pRxBuff->pData[ptrIn++] - '='; |
246 | b = pRxBuff->pData[ptrIn++] - '='; |
246 | b = pRxBuff->pData[ptrIn++] - '='; |
247 | c = pRxBuff->pData[ptrIn++] - '='; |
247 | c = pRxBuff->pData[ptrIn++] - '='; |
Line 254... | Line 254... | ||
254 | pSerialMsg->pData = &(pRxBuff->pData[3]); |
254 | pSerialMsg->pData = &(pRxBuff->pData[3]); |
255 | pSerialMsg->DataLen = ptrOut - 3; // return number of data in bytes |
255 | pSerialMsg->DataLen = ptrOut - 3; // return number of data in bytes |
256 | pRxBuff->Position = 0; |
256 | pRxBuff->Position = 0; |
257 | pRxBuff->DataBytes = ptrOut; |
257 | pRxBuff->DataBytes = ptrOut; |
258 | } |
258 | } |
- | 259 | ||
- | 260 | /* |
|
- | 261 | void MKProtocol_DecodeSerialFrameData(Buffer_t* pRxBuff, SerialMsg_t* pSerialMsg) |
|
- | 262 | { |
|
- | 263 | u8 a,b,c,d; |
|
- | 264 | u8 x,y,z; |
|
- | 265 | u16 ptrIn = 3; // start with first data byte in rx buffer |
|
- | 266 | u16 ptrOut = 3; |
|
- | 267 | u16 len = pRxBuff->DataBytes - 6; // must be a multiple of 4 (3 bytes at begin and 3 bytes at end are no payload ) |
|
- | 268 | while(len) |
|
- | 269 | { |
|
- | 270 | a = pRxBuff->pData[ptrIn++] - '='; |
|
- | 271 | b = pRxBuff->pData[ptrIn++] - '='; |
|
- | 272 | c = pRxBuff->pData[ptrIn++] - '='; |
|
- | 273 | d = pRxBuff->pData[ptrIn++] - '='; |
|
- | 274 | //if(ptrIn > ReceivedBytes - 3) break; |
|
- | 275 | ||
- | 276 | x = (a << 2) | (b >> 4); |
|
- | 277 | y = ((b & 0x0f) << 4) | (c >> 2); |
|
- | 278 | z = ((c & 0x03) << 6) | d; |
|
- | 279 | ||
- | 280 | if(len--) pRxBuff->pData[ptrOut++] = x; else break; |
|
- | 281 | if(len--) pRxBuff->pData[ptrOut++] = y; else break; |
|
- | 282 | if(len--) pRxBuff->pData[ptrOut++] = z; else break; |
|
- | 283 | } |
|
- | 284 | pSerialMsg->pData = &(pRxBuff->pData[3]); |
|
- | 285 | pSerialMsg->DataLen = ptrOut - 3; // return number of data in bytes |
|
- | 286 | pRxBuff->Position = 0; |
|
- | 287 | pRxBuff->DataBytes = ptrOut; |
|
- | 288 | } |
|
- | 289 | */ |
|
- | 290 |