/* Set Baud Rate of FlexCAN. 
This function set the baud rate of FlexCAN. */
static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps, flexcan_timing_config_t timingConfig)
/* Set Baud Rate of FlexCAN. 
This function set the baud rate of FlexCAN. */
static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps, flexcan_timing_config_t timingConfig)
{
    uint32_t quantum = 1 + (timingConfig.phaseSeg1 + 1) + (timingConfig.phaseSeg2 + 1) + (timingConfig.propSeg + 1);
    uint32_t priDiv = baudRate_Bps * quantum;
    assert(baudRate_Bps <= 1000000U);
    assert(priDiv <= sourceClock_Hz);
    if (0 == priDiv)
    {
        priDiv = 1;
    }
    priDiv = (sourceClock_Hz / priDiv) - 1;
    if (priDiv > 0xFF)
    {
        priDiv = 0xFF;
    }
    timingConfig.preDivider = priDiv;
    FLEXCAN_SetTimingConfig(base, &timingConfig);
}