예제 #1
0
/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_HAL_SetBitCountPerChar
 * Description   : Configures the number of bits per character in the LPUART controller.
 * In some LPUART instances, the user should disable the transmitter/receiver
 * before calling this function.
 * Generally, this may be applied to all LPUARTs to ensure safe operation.
 *
 *END**************************************************************************/
void LPUART_HAL_SetBitCountPerChar(uint32_t baseAddr, lpuart_bit_count_per_char_t bitCountPerChar)
{
    if(bitCountPerChar == kLpuart10BitsPerChar)
    {
        BW_LPUART_BAUD_M10(baseAddr, 1); /* set M10 for 10-bit mode, M bit in C1 is don't care */
    }
    else
    {
        BW_LPUART_CTRL_M(baseAddr, bitCountPerChar);  /* config 8- (M=0) or 9-bits (M=1) */
        BW_LPUART_BAUD_M10(baseAddr, 0); /* clear M10 to make sure not 10-bit mode */
    }
}
예제 #2
0
/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_HAL_SetBitCountPerChar
 * Description   : Configures the number of bits per char in LPUART controller.
 * In some LPUART instances, the user should disable the transmitter/receiver
 * before calling this function.
 * Generally, this may be applied to all LPUARTs to ensure safe operation.
 *
 *END**************************************************************************/
void LPUART_HAL_SetBitCountPerChar(uint32_t baseAddr,
                                   lpuart_bit_count_per_char_t bitCountPerChar)
{
    if (bitCountPerChar == kLpuart10BitsPerChar)
    {
        BW_LPUART_BAUD_M10(baseAddr, 0x1U);
    }
    else
    {
        /* config 8-bit (M=0) or 9-bits (M=1) */
        BW_LPUART_CTRL_M(baseAddr, bitCountPerChar);
        /* clear M10 to make sure not 10-bit mode */
        BW_LPUART_BAUD_M10(baseAddr, 0x0U);
    }
}