Esempio n. 1
0
/*******************************************************************************
* Function Name: I2C_Sleep
********************************************************************************
*
* Summary:
*  Wakeup on address match enabled: All incoming transaction will be NACKed till 
*  power down will be asserted. The address match event wakes up the chip.
*  Wakeup on address match disabled: Disables active mode power template bits or 
*  clock gating as appropriate. Saves I2C configuration and non-retention 
*  register values. 
*  Disables I2C interrupt.
*
* Parameters:
*  None
*
* Return:
*  None
*
* Reentrant:
*  No
*
*******************************************************************************/
void I2C_Sleep(void) 
{
    #if (I2C_ENABLE_WAKEUP)
        /* The I2C block should be always enabled if used as wakeup source */
        I2C_backup.enableState = 0u;
        
    #else
        /* Store I2C enable state */
        if (I2C_IS_I2C_ENABLE(I2C_I2C_ENABLE_REG))
        {
            I2C_backup.enableState = 1u;
            I2C_Stop();
        }
        else
        {
            I2C_backup.enableState = 0u;
        }
    #endif  /* End (I2C_ENABLE_WAKEUP) */
    
    I2C_SaveConfig();
}
Esempio n. 2
0
/*******************************************************************************
* Function Name: I2C_Sleep
********************************************************************************
*
* Summary:
*  Wakeup on address match enabled: All incoming transaction will be NACKed till
*  power down will be asserted. The address match event wakes up the chip.
*  Wakeup on address match disabled: Disables active mode power template bits or
*  clock gating as appropriate. Saves I2C configuration and non-retention
*  register values.
*  Disables I2C interrupt.
*
* Parameters:
*  None
*
* Return:
*  None
*
* Reentrant:
*  No
*
*******************************************************************************/
void I2C_Sleep(void) 
{
    #if(I2C_WAKEUP_ENABLED)
        /* The I2C block should be always enabled if used as wakeup source */
        I2C_backup.enableState = I2C_DISABLE;

        #if(I2C_TIMEOUT_ENABLED)
            I2C_TimeoutStop();
        #endif /* (I2C_TIMEOUT_ENABLED) */

    #else

        I2C_backup.enableState = ((uint8) I2C_IS_ENABLED);

        if(I2C_IS_ENABLED)
        {
            I2C_Stop();
        }
    #endif /* (I2C_WAKEUP_ENABLED) */

    I2C_SaveConfig();
}