1234567891011121314151617181920212223242526272829303132 |
- #include "bsp_protocol.h"
- void send_protocol(uint8_t index,uint8_t cmd,uint8_t* dat,uint8_t datLen)
- {
- uint8_t buf[128];
- uint16_t Len = datLen+5;
- uint16_t L=0;
- uint8_t i;
- uint8_t ver = 0;
-
- if(Len>128) return;
-
- buf[L++] = 0xAA; ver += 0xAA;
- buf[L++] = Len; ver += Len;
- buf[L++] = ~Len; ver += (~Len);
- buf[L++] = cmd; ver += cmd;
- for(i=0;i<datLen;i++){ buf[L++] = dat[i]; ver += dat[i];}
- buf[L++] = ver;
-
- ESB_SendBuff(buf,L);
- }
|