It is ok for this sample code
* @param[in] u32SrcFreq UART clock source(UART_S) was divided by UART divider(UART_N)
* @param[in] u32BaudRate Target bitrate (Hz)
/*---------------------------------------------------------------------------------------------------------*/
/* LIN Function Test */
/*---------------------------------------------------------------------------------------------------------*/
void LIN_FunctionTest()
{
uint32_t u32Item;
/* LIN Max Speeed is 20K */
UART1->BAUD = UART_BAUD_MODE2 | UART_BAUD_DIV_MODE2(48000000,20000);
/**
* @brief Compute Baud Rate Divider Settings by mode 2
*
* @param[in] u32SrcFreq UART clock source(UART_S) was divided by UART divider(UART_N)
* @param[in] u32BaudRate Target bitrate (Hz)
*
* @return None
*
* @details The function is used to get baud rate divider settings by mode 2 based on your settings.\n
*
* Example: UART clock source from PLL(48MHz) and UART clock divider is set 2.\n
* If desired baudrate is 115200, you can call UART_BAUD_DIV_MODE2(24000000,115200);
*
*/
#define UART_BAUD_DIV_MODE2(u32SrcFreq, u32BaudRate) (((u32SrcFreq + (u32BaudRate/2)) / u32BaudRate)-2) |