libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_can.c
/**
  * @brief  Checks whether the specified CAN flag is set or not.
  * @param  CANx:     where x can be 1 or 2 to to select the CAN peripheral.
  * @param  CAN_FLAG: specifies the flag to check.
  *                   This parameter can be one of the following flags: 
  *                  - CAN_FLAG_EWG
  *                  - CAN_FLAG_EPV 
  *                  - CAN_FLAG_BOF
  *                  - CAN_FLAG_RQCP0
  *                  - CAN_FLAG_RQCP1
  *                  - CAN_FLAG_RQCP2
  *                  - CAN_FLAG_FMP1   
  *                  - CAN_FLAG_FF1       
  *                  - CAN_FLAG_FOV1   
  *                  - CAN_FLAG_FMP0   
  *                  - CAN_FLAG_FF0       
  *                  - CAN_FLAG_FOV0   
  *                  - CAN_FLAG_WKU 
  *                  - CAN_FLAG_SLAK  
  *                  - CAN_FLAG_LEC       
  * @retval The new state of CAN_FLAG (SET or RESET).
  */
@brief  Checks whether the specified CAN flag is set or not.
@param  CANx:     where x can be 1 or 2 to to select the CAN peripheral.
@param  CAN_FLAG: specifies the flag to check.
@brief Checks whether the specified CAN flag is set or not . @param CANx : where x can be 1 or 2 to to select the CAN peripheral . @param CAN_FLAG : specifies the flag to check .
FlagStatus CAN_GetFlagStatus(CAN_TypeDef* CANx, uint32_t CAN_FLAG)
{
  FlagStatus bitstatus = RESET;
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_GET_FLAG(CAN_FLAG));
  if((CAN_FLAG & CAN_FLAGS_ESR) != (uint32_t)RESET)
  { 
    if ((CANx->ESR & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
    { 
      bitstatus = SET;
    }
    else
    { 
      bitstatus = RESET;
    }
  }
  else if((CAN_FLAG & CAN_FLAGS_MSR) != (uint32_t)RESET)
  { 
    if ((CANx->MSR & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
    { 
      bitstatus = SET;
    }
    else
    { 
      bitstatus = RESET;
    }
  }
  else if((CAN_FLAG & CAN_FLAGS_TSR) != (uint32_t)RESET)
  { 
    if ((CANx->TSR & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
    { 
      bitstatus = SET;
    }
    else
    { 
      bitstatus = RESET;
    }
  }
  else if((CAN_FLAG & CAN_FLAGS_RF0R) != (uint32_t)RESET)
  { 
    if ((CANx->RF0R & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
    { 
      bitstatus = SET;
    }
    else
    { 
      bitstatus = RESET;
    }
  }
  else 
  { 
    if ((uint32_t)(CANx->RF1R & (CAN_FLAG & 0x000FFFFF)) != (uint32_t)RESET)
    { 
      bitstatus = SET;
    }
    else
    { 
      bitstatus = RESET;
    }
  }
  return  bitstatus;
}
FlagStatus CAN_GetFlagStatus ( CAN_TypeDef * CANx , uint32_t CAN_FLAG ) { FlagStatus bitstatus = RESET ; assert_param ( IS_CAN_ALL_PERIPH ( CANx ) ) ; assert_param ( IS_CAN_GET_FLAG ( CAN_FLAG ) ) ; if ( ( CAN_FLAG & CAN_FLAGS_ESR ) != ( uint32_t ) RESET ) { if ( ( CANx -> ESR & ( CAN_FLAG & 0x000FFFFF ) ) != ( uint32_t ) RESET ) { bitstatus = SET ; } else { bitstatus = RESET ; } } else if ( ( CAN_FLAG & CAN_FLAGS_MSR ) != ( uint32_t ) RESET ) { if ( ( CANx -> MSR & ( CAN_FLAG & 0x000FFFFF ) ) != ( uint32_t ) RESET ) { bitstatus = SET ; } else { bitstatus = RESET ; } } else if ( ( CAN_FLAG & CAN_FLAGS_TSR ) != ( uint32_t ) RESET ) { if ( ( CANx -> TSR & ( CAN_FLAG & 0x000FFFFF ) ) != ( uint32_t ) RESET ) { bitstatus = SET ; } else { bitstatus = RESET ; } } else if ( ( CAN_FLAG & CAN_FLAGS_RF0R ) != ( uint32_t ) RESET ) { if ( ( CANx -> RF0R & ( CAN_FLAG & 0x000FFFFF ) ) != ( uint32_t ) RESET ) { bitstatus = SET ; } else { bitstatus = RESET ; } } else { if ( ( uint32_t ) ( CANx -> RF1R & ( CAN_FLAG & 0x000FFFFF ) ) != ( uint32_t ) RESET ) { bitstatus = SET ; } else { bitstatus = RESET ; } } return bitstatus ; }
@brief  Checks whether the specified CAN flag is set or not.
@brief Checks whether the specified CAN flag is set or not .
/* Check the parameters */ /* Check the status of the specified CAN flag */ /* CAN_FLAG is set */ /* CAN_FLAG is reset */ /* Check the status of the specified CAN flag */ /* CAN_FLAG is set */ /* CAN_FLAG is reset */ /* Check the status of the specified CAN flag */ /* CAN_FLAG is set */ /* CAN_FLAG is reset */ /* Check the status of the specified CAN flag */ /* CAN_FLAG is set */ /* CAN_FLAG is reset */ /* If(CAN_FLAG & CAN_FLAGS_RF1R != (uint32_t)RESET) */ /* Check the status of the specified CAN flag */ /* CAN_FLAG is set */ /* CAN_FLAG is reset */ /* Return the CAN_FLAG status */