2025-06-21 17:19:31 +08:00

79 lines
1.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*******************************************************************************
* the includes
******************************************************************************/
#include "ud_66.h"
#include "Uart2CanDiagApp.h"
/*******************************************************************************
* the defines
******************************************************************************/
/*******************************************************************************
* the typedefs
******************************************************************************/
typedef enum
{
CMD66_CFG,//配置pid,fid,rid,stmin
CMD66_TTreq,//TT Transparent Transmission透明传输
CMD66_NUM,
} CMD66_type;
/*******************************************************************************
* the globals
******************************************************************************/
/*******************************************************************************
* the const
******************************************************************************/
/*******************************************************************************
* the functions
******************************************************************************/
static void ud66_cfg(uint8_t* data, uint16_t len);
void uartapp_cmd66(uint8_t* data, uint16_t len)
{
if (len < 1)
{
return;
}
CMD66_type subid = data[0];
switch (subid)
{
case CMD66_CFG:
ud66_cfg(data+1,len-1);
break;
default:
break;
}
}
static void ud66_cfg(uint8_t* data, uint16_t len)
{
//pid,fid,rid,stmin,fill
//2+2+2+1+rev1
if (len == 8)
{
uint16_t pid = (data[0]<<8) + data[1];
uint16_t fid = (data[2]<<8) + data[3];
uint16_t rid = (data[4]<<8) + data[5];
uint8_t stmin = data[6];
uint8_t fill = data[7];
U2CD_cfg(pid,fid,rid,stmin,fill);
}
}