示例#1
0
/**
  * @brief  User callback that manages the Timeout error.
  * @param  pDevInitStruct .
  * @retval None.
  */
uint32_t CPAL_TIMEOUT_UserCallback(CPAL_InitTypeDef* pDevInitStruct)
{  
  /* Deinitialize peripheral */
  sEE_DeInit(sEE_DevStructures[pDevInitStruct->CPAL_Dev]) ;
  
  /* Initialize peripherals for communication with sEE */
  sEE_StructInit(sEE_DevStructures[pDevInitStruct->CPAL_Dev]);
  sEE_Init(sEE_DevStructures[pDevInitStruct->CPAL_Dev]); 
    
  sEE_DevStructures[pDevInitStruct->CPAL_Dev]->sEEState = sEE_STATE_ERROR;
    
  return CPAL_PASS;   
}
示例#2
0
/**
  * @brief  User callback that manages the I2C device errors.
  * @note   Make sure that the define USE_SINGLE_ERROR_CALLBACK is uncommented in
  *         the cpal_conf.h file, otherwise this callback will not be functional.
  * @param  pDevInitStruct. 
  * @param  DeviceError.
  * @retval None
  */  
void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t DeviceError)
{
  /* Stop timeout countdown */ 
  sEE_DevStructures[pDevInstance]->sEE_CPALStructure->wCPAL_Timeout  = CPAL_I2C_TIMEOUT_DEFAULT;  
  
  /* Deinitialize peripheral */
  sEE_DeInit(sEE_DevStructures[pDevInstance]) ;
  
  /* Initialize peripherals for communication with sEE */
  sEE_StructInit(sEE_DevStructures[pDevInstance]);
  sEE_Init(sEE_DevStructures[pDevInstance]); 
    
  sEE_DevStructures[pDevInstance]->sEEState = sEE_STATE_ERROR;
}
/**
  * @brief  User callback that manages the I2C device errors.
  * @note   Make sure that the define USE_SINGLE_ERROR_CALLBACK is uncommented in
  *         the cpal_conf.h file, otherwise this callback will not be functional.
  * @param  pDevInitStruct. 
  * @param  DeviceError.
  * @retval None
  */ 
void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t DeviceError)
{  
  /* Generate STOP */
  __CPAL_I2C_HAL_STOP(pDevInstance);
  
  LCD_DisplayStringLine(Line6, (uint8_t*)" Device Err occurred ");
  
  /* Deinitialize peripheral */
  sEE_DeInit(sEE_DevStructures[pDevInstance]) ;
  
  /* Initialize peripheral To communication with sEE and IOE and TempSensor*/
  sEE_StructInit(sEE_DevStructures[pDevInstance]);
  sEE_Init(sEE_DevStructures[pDevInstance]); 
  
  /* Initialize sEE state */
  if ((sEE_DevStructures[pDevInstance]->sEEState == sEE_STATE_WRITING)\
    || (sEE_DevStructures[pDevInstance]->sEEState == sEE_STATE_READING))
  {      
    sEE_DevStructures[pDevInstance]->sEEState = sEE_STATE_ERROR;
  }  
}
/**
  * @brief  User callback that manages the Timeout error.
  * @param  pDevInitStruct .
  * @retval None.
  */
uint32_t CPAL_TIMEOUT_UserCallback(CPAL_InitTypeDef* pDevInitStruct)
{
  /* Generate STOP */
  __CPAL_I2C_HAL_STOP(pDevInitStruct->CPAL_Dev);
  
  LCD_DisplayStringLine(Line7, (uint8_t*)"Timeout Err occurred ");
  
  /* Deinitialize peripheral */
  sEE_DeInit(sEE_DevStructures[pDevInitStruct->CPAL_Dev]) ;
  
  /* Initialize peripheral to communication with sEE and IOE and TempSensor */
  sEE_StructInit(sEE_DevStructures[pDevInitStruct->CPAL_Dev]);
  sEE_Init(sEE_DevStructures[pDevInitStruct->CPAL_Dev]); 
  
  /* Initialize sEE state */
  if ((sEE_DevStructures[pDevInitStruct->CPAL_Dev]->sEEState == sEE_STATE_WRITING)\
    || (sEE_DevStructures[pDevInitStruct->CPAL_Dev]->sEEState == sEE_STATE_READING))
  {    
    sEE_DevStructures[pDevInitStruct->CPAL_Dev]->sEEState = sEE_STATE_ERROR;
  }
  
  return CPAL_PASS;
}