コード例 #1
0
ファイル: UART.c プロジェクト: 777string/reload-pro
/*******************************************************************************
* Function Name: UART_Enable
********************************************************************************
*
* Summary:
*  Enables SCB component operation.
*  The SCB configuration should be not changed when the component is enabled.
*  Any configuration changes should be made after disabling the component.
*
* Parameters:
*  None
*
* Return:
*  None
*
*******************************************************************************/
void UART_Enable(void)
{
#if(UART_SCB_MODE_UNCONFIG_CONST_CFG)
    if(!UART_SCB_MODE_UNCONFIG_RUNTM_CFG)
    {
        /* Enable SCB block, only if already configured */
        UART_CTRL_REG |= UART_CTRL_ENABLED;
        
        /* Enable interrupt */
        UART_ScbEnableIntr();
    }
#else
    UART_CTRL_REG |= UART_CTRL_ENABLED; /* Enable SCB block */
    
    UART_ScbEnableIntr();
#endif /* (UART_SCB_MODE_UNCONFIG_CONST_CFG) */
}
コード例 #2
0
ファイル: UART.c プロジェクト: iotexpert/Pinball
/*******************************************************************************
* Function Name: UART_Enable
****************************************************************************//**
*
*  Enables UART component operation: activates the hardware and 
*  internal interrupt. It also restores TX interrupt sources disabled after the 
*  UART_Stop() function was called (note that level-triggered TX 
*  interrupt sources remain disabled to not cause code lock-up).
*  For I2C and EZI2C modes the interrupt is internal and mandatory for 
*  operation. For SPI and UART modes the interrupt can be configured as none, 
*  internal or external.
*  The UART configuration should be not changed when the component
*  is enabled. Any configuration changes should be made after disabling the 
*  component.
*  When configuration is set to “Unconfigured UART”, the component 
*  must first be initialized to operate in one of the following configurations: 
*  I2C, SPI, UART or EZ I2C, using the mode-specific initialization API. 
*  Otherwise this function does not enable the component.
*
*******************************************************************************/
void UART_Enable(void)
{
#if (UART_SCB_MODE_UNCONFIG_CONST_CFG)
    /* Enable SCB block, only if it is already configured */
    if (!UART_SCB_MODE_UNCONFIG_RUNTM_CFG)
    {
        UART_CTRL_REG |= UART_CTRL_ENABLED;

        UART_ScbEnableIntr();

        /* Call PostEnable function specific to current operation mode */
        UART_ScbModePostEnable();
    }
#else
    UART_CTRL_REG |= UART_CTRL_ENABLED;

    UART_ScbEnableIntr();

    /* Call PostEnable function specific to current operation mode */
    UART_ScbModePostEnable();
#endif /* (UART_SCB_MODE_UNCONFIG_CONST_CFG) */
}