void LIN_CallBack(const uint8 Instance, const Lpuart_Lin_Ip_StateStructType *LinState)
{
(void)Instance;
const Lpuart_Lin_Ip_StateStructType * linCurrentState = LinState;
Lin_msg_temp.id = linCurrentState->CurrentEventId;
switch (linCurrentState->CurrentEventId)
{
case LPUART_LIN_IP_RECV_HEADER_OK:
if(0x3C == Lin_msg_temp.id)
{
//ready to receive data
//what api could i use??
}
else if(0x3D == Lin_msg_temp.id)
{
//send data
//what api could i use???
}
break;
case LPUART_LIN_IP_RX_COMPLETED:
{
for(uint8 i = 0;i<sizeof(g_aLINRxBuf);i++)
{
Lin_msg_temp.data[i] = g_aLINRxBuf[i];
}
Lin_msg_temp.length = linCurrentState->RxSize;
}
break;
case LPUART_LIN_IP_TX_COMPLETED:
{
//clear tx buffer
}
break;
default:
/* do nothing */
break;
}
}
void Lin_Init()
{
Lpuart_Lin_Ip_Init(INST_LIN2,&Lpuart_Lin_Ip_Sa_pHwConfigPB_0_BOARD_INITPERIPHERALS);
IntCtrl_Ip_EnableIrq(LPUART2_IRQn);
}