libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_can.c
/**
  * @brief  Checks whether the specified CANx interrupt has occurred or not.
  * @param  CANx:    where x can be 1 or 2 to to select the CAN peripheral.
  * @param  CAN_IT:  specifies the CAN interrupt source to check.
  *                  This parameter can be one of the following flags: 
  *                 -  CAN_IT_TME               
  *                 -  CAN_IT_FMP0              
  *                 -  CAN_IT_FF0               
  *                 -  CAN_IT_FOV0              
  *                 -  CAN_IT_FMP1              
  *                 -  CAN_IT_FF1               
  *                 -  CAN_IT_FOV1              
  *                 -  CAN_IT_WKU  
  *                 -  CAN_IT_SLK  
  *                 -  CAN_IT_EWG    
  *                 -  CAN_IT_EPV    
  *                 -  CAN_IT_BOF    
  *                 -  CAN_IT_LEC    
  *                 -  CAN_IT_ERR 
  * @retval The current state of CAN_IT (SET or RESET).
  */
@brief  Checks whether the specified CANx interrupt has occurred or not.
@param  CANx:    where x can be 1 or 2 to to select the CAN peripheral.
@param  CAN_IT:  specifies the CAN interrupt source to check.
@brief Checks whether the specified CANx interrupt has occurred or not . @param CANx : where x can be 1 or 2 to to select the CAN peripheral . @param CAN_IT : specifies the CAN interrupt source to check .
ITStatus CAN_GetITStatus(CAN_TypeDef* CANx, uint32_t CAN_IT)
{
  ITStatus itstatus = RESET;
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_IT(CAN_IT));
 if((CANx->IER & CAN_IT) != RESET)
 {
    switch (CAN_IT)
    {
      case CAN_IT_TME:
	             itstatus = CheckITStatus(CANx->TSR, CAN_TSR_RQCP0|CAN_TSR_RQCP1|CAN_TSR_RQCP2);  
	      break;
      case CAN_IT_FMP0:
	             itstatus = CheckITStatus(CANx->RF0R, CAN_RF0R_FMP0);  
	      break;
      case CAN_IT_FF0:
               itstatus = CheckITStatus(CANx->RF0R, CAN_RF0R_FULL0);  
	      break;
      case CAN_IT_FOV0:
               itstatus = CheckITStatus(CANx->RF0R, CAN_RF0R_FOVR0);  
	      break;
      case CAN_IT_FMP1:
               itstatus = CheckITStatus(CANx->RF1R, CAN_RF1R_FMP1);  
	      break;
      case CAN_IT_FF1:
	             itstatus = CheckITStatus(CANx->RF1R, CAN_RF1R_FULL1);  
	      break;
      case CAN_IT_FOV1:
	             itstatus = CheckITStatus(CANx->RF1R, CAN_RF1R_FOVR1);  
	      break;
      case CAN_IT_WKU:
               itstatus = CheckITStatus(CANx->MSR, CAN_MSR_WKUI);  
	      break;
      case CAN_IT_SLK:
	             itstatus = CheckITStatus(CANx->MSR, CAN_MSR_SLAKI);  
	      break;
      case CAN_IT_EWG:
	             itstatus = CheckITStatus(CANx->ESR, CAN_ESR_EWGF);  
	      break;
      case CAN_IT_EPV:
	             itstatus = CheckITStatus(CANx->ESR, CAN_ESR_EPVF);  
	      break;
      case CAN_IT_BOF:
	             itstatus = CheckITStatus(CANx->ESR, CAN_ESR_BOFF);  
	      break;
      case CAN_IT_LEC:
	             itstatus = CheckITStatus(CANx->ESR, CAN_ESR_LEC);  
	      break;
      case CAN_IT_ERR:
               itstatus = CheckITStatus(CANx->MSR, CAN_MSR_ERRI); 
	      break;
      default :
              itstatus = RESET;
              break;
    }
  }
  else
  {
    itstatus  = RESET;
  }
  return  itstatus;
}
ITStatus CAN_GetITStatus ( CAN_TypeDef * CANx , uint32_t CAN_IT ) { ITStatus itstatus = RESET ; assert_param ( IS_CAN_ALL_PERIPH ( CANx ) ) ; assert_param ( IS_CAN_IT ( CAN_IT ) ) ; if ( ( CANx -> IER & CAN_IT ) != RESET ) { switch ( CAN_IT ) { case CAN_IT_TME : itstatus = CheckITStatus ( CANx -> TSR , CAN_TSR_RQCP0 | CAN_TSR_RQCP1 | CAN_TSR_RQCP2 ) ; break ; case CAN_IT_FMP0 : itstatus = CheckITStatus ( CANx -> RF0R , CAN_RF0R_FMP0 ) ; break ; case CAN_IT_FF0 : itstatus = CheckITStatus ( CANx -> RF0R , CAN_RF0R_FULL0 ) ; break ; case CAN_IT_FOV0 : itstatus = CheckITStatus ( CANx -> RF0R , CAN_RF0R_FOVR0 ) ; break ; case CAN_IT_FMP1 : itstatus = CheckITStatus ( CANx -> RF1R , CAN_RF1R_FMP1 ) ; break ; case CAN_IT_FF1 : itstatus = CheckITStatus ( CANx -> RF1R , CAN_RF1R_FULL1 ) ; break ; case CAN_IT_FOV1 : itstatus = CheckITStatus ( CANx -> RF1R , CAN_RF1R_FOVR1 ) ; break ; case CAN_IT_WKU : itstatus = CheckITStatus ( CANx -> MSR , CAN_MSR_WKUI ) ; break ; case CAN_IT_SLK : itstatus = CheckITStatus ( CANx -> MSR , CAN_MSR_SLAKI ) ; break ; case CAN_IT_EWG : itstatus = CheckITStatus ( CANx -> ESR , CAN_ESR_EWGF ) ; break ; case CAN_IT_EPV : itstatus = CheckITStatus ( CANx -> ESR , CAN_ESR_EPVF ) ; break ; case CAN_IT_BOF : itstatus = CheckITStatus ( CANx -> ESR , CAN_ESR_BOFF ) ; break ; case CAN_IT_LEC : itstatus = CheckITStatus ( CANx -> ESR , CAN_ESR_LEC ) ; break ; case CAN_IT_ERR : itstatus = CheckITStatus ( CANx -> MSR , CAN_MSR_ERRI ) ; break ; default : itstatus = RESET ; break ; } } else { itstatus = RESET ; } return itstatus ; }
@brief  Checks whether the specified CANx interrupt has occurred or not.
@brief Checks whether the specified CANx interrupt has occurred or not .
/* Check the parameters */ /* check the enable interrupt bit */ /* in case the Interrupt is enabled, .... */ /* Check CAN_TSR_RQCPx bits */ /* Check CAN_RF0R_FMP0 bit */ /* Check CAN_RF0R_FULL0 bit */ /* Check CAN_RF0R_FOVR0 bit */ /* Check CAN_RF1R_FMP1 bit */ /* Check CAN_RF1R_FULL1 bit */ /* Check CAN_RF1R_FOVR1 bit */ /* Check CAN_MSR_WKUI bit */ /* Check CAN_MSR_SLAKI bit */ /* Check CAN_ESR_EWGF bit */ /* Check CAN_ESR_EPVF bit */ /* Check CAN_ESR_BOFF bit */ /* Check CAN_ESR_LEC bit */ /* Check CAN_MSR_ERRI bit */ /* in case of error, return RESET */ /* in case the Interrupt is not enabled, return RESET */ /* Return the CAN_IT status */