/*---------------------------------------------------------------------------------------------------------*/ void LIN_SendResponseWithByteCnt(int32_t checkSumOption, uint32_t *pu32TxBuf, uint32_t u32ByteCnt) { int32_t i32; /* Prepare data */ for(i32 = 0; i32 < u32ByteCnt; i32++) g_u8SendData[g_i32pointer++] = pu32TxBuf[i32] ; /* Prepare check sum */ if(checkSumOption == MODE_CLASSIC) g_u8SendData[g_i32pointer++] = GetCheckSumValue(&g_u8SendData[2], u32ByteCnt) ; //CheckSum Field else if(checkSumOption == MODE_ENHANCED) g_u8SendData[g_i32pointer++] = GetCheckSumValue(&g_u8SendData[1], (u32ByteCnt + 1)) ; //CheckSum Field /* Send data and check sum */ UART_Write(UART1, g_u8SendData + 2, 9); }
/*---------------------------------------------------------------------------------------------------------*/ void LIN_SendResponse(int32_t checkSumOption,uint32_t *pu32TxBuf) { int32_t i32; for(i32=0;i32<8;i32++) g_u8SendData[g_i32pointer++] = pu32TxBuf[i32] ; g_u8SendData[g_i32pointer++] = GetCheckSumValue(g_u8SendData,checkSumOption) ; //CheckSum Field UART_Write(UART1,g_u8SendData+2,9); }
/*---------------------------------------------------------------------------------------------------------*/ void LIN_SendResponseWithByteCnt(int32_t checkSumOption, uint32_t *pu32TxBuf, uint32_t u32ByteCnt) { int32_t i32; /* Prepare data */ for(i32 = 0; i32 < u32ByteCnt; i32++) g_u8SendData[g_i32pointer++] = pu32TxBuf[i32] ; /* Prepare check sum */ if(checkSumOption == MODE_CLASSIC) g_u8SendData[g_i32pointer++] = GetCheckSumValue(&g_u8SendData[2], u32ByteCnt) ; //CheckSum Field else if(checkSumOption == MODE_ENHANCED) g_u8SendData[g_i32pointer++] = GetCheckSumValue(&g_u8SendData[1], (u32ByteCnt + 1)) ; //CheckSum Field /* Send data and check sum */ for(i32 = 0; i32 < 9; i32++) { while(!(UART1->FSR & UART_FSR_TE_FLAG_Msk)); /* Wait Tx empty */ UART1->THR = g_u8SendData[i32 + 2]; /* Send UART Data from buffer */ } }
/*---------------------------------------------------------------------------------------------------------*/ void LIN_SendResponse(int32_t checkSumOption, uint32_t *pu32TxBuf) { int32_t i32; for(i32 = 0; i32 < 8; i32++) g_u8SendData[g_i32pointer++] = pu32TxBuf[i32] ; g_u8SendData[g_i32pointer++] = GetCheckSumValue(g_u8SendData, checkSumOption) ; //CheckSum Field for(i32 = 0; i32 < 9; i32++) { while(!(UART1->FSR & UART_FSR_TE_FLAG_Msk)); /* Wait Tx empty */ UART1->THR = g_u8SendData[i32 + 2]; /* Send UART Data from buffer */ } }