Esempio n. 1
0
void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t DeviceError)
{
  // generate warning message
  mBusTypeDef* mBus;
  if (pDevInstance == CPAL_I2C1)
    mBus = getmBusPtr(1);
  else if (pDevInstance == CPAL_I2C2)
    mBus = getmBusPtr(2);
  else
    return;
  WarnReport(ERROR_CPAL_I2C_ERR, "MBUS CPAL_I2C_ERR,Mode=%u,State=%u,Error=%u",
    mBus->CPAL_InitStruct->CPAL_Mode,
    mBus->CPAL_InitStruct->CPAL_State,
    mBus->CPAL_InitStruct->wCPAL_DevError);

  // reset after error
  if (pDevInstance == CPAL_I2C1)
    mBusRestart(1);
  else if (pDevInstance == CPAL_I2C2)
    mBusRestart(2);
}
Esempio n. 2
0
//void CPAL_I2C_DMARXHT_UserCallback(CPAL_InitTypeDef* pDevInitStruct)
//{ }
//void CPAL_I2C_DMARXTE_UserCallback(CPAL_InitTypeDef* pDevInitStruct)
//{ }
void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t DeviceError)
{
	if ((DeviceError & CPAL_I2C_ERR_AF) != 0)
      {mRedON; mWaitms(2000);}
  if ((DeviceError & CPAL_I2C_ERR_BERR) != 0)
      {mGreenON; mWaitms(2000);}
  if ((DeviceError & CPAL_I2C_ERR_ARLO) != 0)
      {mYellowON;mWaitms(2000);}
  if ((DeviceError & CPAL_I2C_ERR_OVR) != 0)
      {mBlueON;  mWaitms(2000);}
  if ((DeviceError & CPAL_I2C_ERR_TIMEOUT) != 0)
      {mWhiteON; mWaitms(2000);}
  uint32_t i;
	for(i=0; i<10; i++)
    {
    	mGreenOFF; mRedOFF; mYellowON; mBlueOFF; mWhiteON;
    	mWait(800000);
    	mGreenON; mRedON; mYellowOFF; mBlueON; mWhiteOFF;
    	mWait(800000);  	
    }
	mBusRestart();
}