📄 packet.c
字号:
#include "libepc.h"
#include "os_cpu.h"
#include "os_cfg.h"
#include "ucos_ii.h"
#include "serial.h"
#include "inbound.h"
#include "elapsed.h"
void ReceivePackets(void)
{
SerialInit() ;
for (;;)
{
int type, byte, bytes ;
BYTE8 *bfr ;
if (SerialGet() != 0xFF) continue ;
switch (type = SerialGet())
{
default:
continue ;
case 1:
case 2:
break ;
}
bytes = SerialGet();
bfr = (BYTE8 *) malloc(bytes) ;
if (!bfr) for (;;) ;
for (byte = 0; byte < bytes; byte++)
{
bfr[byte] = SerialGet() ;
}
switch (type)
{
case 1:
PostText(bfr) ;
break ;
case 2:
PostTime(bfr) ;
break ;
}
}
}
void SendPacket(int type, BYTE8 *bfr, int bytes)
{
SerialInit() ;
...
You fill in the rest!
...
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -