当前位置: 首页>>代码示例>>C++>>正文


C++ IS_CAN_ALL_PERIPH函数代码示例

本文整理汇总了C++中IS_CAN_ALL_PERIPH函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_CAN_ALL_PERIPH函数的具体用法?C++ IS_CAN_ALL_PERIPH怎么用?C++ IS_CAN_ALL_PERIPH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IS_CAN_ALL_PERIPH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CAN_GetStatus

/**
  * @brief  Returns the CANx Status Register value.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @retval The CANx_STATUS Register value.
  */
uint32_t CAN_GetStatus(MDR_CAN_TypeDef* CANx)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));

  return CANx->STATUS;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:14,代码来源:MDR32F9Qx_can.c

示例2: CAN_TTComModeCmd

/**
  * @brief  Enables or disabes the CAN Time TriggerOperation communication mode.
  * @param  CANx:      where x can be 1 or 2 to to select the CAN peripheral.
  * @param  NewState : Mode new state , can be one of @ref FunctionalState.
  * @note   when enabled, Time stamp (TIME[15:0]) value is sent in the last 
  *         two data bytes of the 8-byte message: TIME[7:0] in data byte 6 
  *         and TIME[15:8] in data byte 7 
  * @note   DLC must be programmed as 8 in order Time Stamp (2 bytes) to be 
  *         sent over the CAN bus.  
  * @retval None
  */
void CAN_TTComModeCmd(CAN_TypeDef* CANx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  if (NewState != DISABLE)
  {
    /* Enable the TTCM mode */
    CANx->MCR |= CAN_MCR_TTCM;

    /* Set TGT bits */
    CANx->sTxMailBox[0].TDTR |= ((uint32_t)CAN_TDT0R_TGT);
    CANx->sTxMailBox[1].TDTR |= ((uint32_t)CAN_TDT1R_TGT);
    CANx->sTxMailBox[2].TDTR |= ((uint32_t)CAN_TDT2R_TGT);
  }
  else
  {
    /* Disable the TTCM mode */
    CANx->MCR &= (uint32_t)(~(uint32_t)CAN_MCR_TTCM);

    /* Reset TGT bits */
    CANx->sTxMailBox[0].TDTR &= ((uint32_t)~CAN_TDT0R_TGT);
    CANx->sTxMailBox[1].TDTR &= ((uint32_t)~CAN_TDT1R_TGT);
    CANx->sTxMailBox[2].TDTR &= ((uint32_t)~CAN_TDT2R_TGT);
  }
}
开发者ID:Carrostic,项目名称:stm32plus,代码行数:37,代码来源:stm32f10x_can.c

示例3: CAN_GetRx

/**
  * @brief  Returns the CANx_Rx Register value.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @retval The CANx_Rx Register value.
  */
uint32_t CAN_GetRx(MDR_CAN_TypeDef* CANx)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));

  return CANx->RX;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:14,代码来源:MDR32F9Qx_can.c

示例4: CAN_BRGInit

/**
  * @brief  Initializes the CANx peripheral Clock according to the
  *         specified parameters.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  CAN_BRG: specifies the HCLK division factor.
  *         This parameter can be one of the following values:
  *           @arg CAN_HCLKdiv1
  *           @arg CAN_HCLKdiv2
  *           @arg CAN_HCLKdiv4
  *           @arg CAN_HCLKdiv8
  *           @arg CAN_HCLKdiv16
  *           @arg CAN_HCLKdiv32
  *           @arg CAN_HCLKdiv64
  *           @arg CAN_HCLKdiv128
  * @retval None
  */
void CAN_BRGInit(MDR_CAN_TypeDef* CANx, uint32_t CAN_BRG)
{
  uint32_t tmpreg;

  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_CLOCK_BRG(CAN_BRG));

  tmpreg = MDR_RST_CLK->CAN_CLOCK;

  if (CANx == MDR_CAN1)
  {
    tmpreg |= RST_CLK_CAN_CLOCK_CAN1_CLK_EN;
    tmpreg &= ~RST_CLK_CAN_CLOCK_CAN1_BRG_Msk;
    tmpreg |= CAN_BRG;
  }
  else if (CANx == MDR_CAN2)
  {
    tmpreg |= RST_CLK_CAN_CLOCK_CAN2_CLK_EN;
    tmpreg &= ~RST_CLK_CAN_CLOCK_CAN2_BRG_Msk;
    tmpreg |= (CAN_BRG << 8);
  }

  MDR_RST_CLK->CAN_CLOCK = tmpreg;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:43,代码来源:MDR32F9Qx_can.c

示例5: CAN_ITClearRxTxPendingBit

/**
  * @brief  Clears the CANx reception buffer interrupt pending bit,
  *         does nothing if transmission interrupt pending bit is specified.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  BufferNumber: The number of the buffer
  * @param  Status_Flag: specifies the interrupt pending bit to clear.
  *         This parameter can be of the following values:
            CAN_STATUS_RX_READY:    Flag indicating that there are messages received
            CAN_STATUS_TX_READY:    Flag indicating that there are buffers for transmitting
  * @retval None.
  */
void CAN_ITClearRxTxPendingBit(MDR_CAN_TypeDef* CANx, uint32_t BufferNumber, uint32_t Status_Flag)
{
  uint32_t tmpreg;

  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_BUFFER(BufferNumber));
  assert_param(IS_CAN_IT_RXTX_FLAG(Status_Flag));

  tmpreg = CANx->BUF_CON[BufferNumber];

  if (Status_Flag == CAN_STATUS_RX_READY)
  {
    tmpreg &= ~CAN_STATUS_RX_FULL;
  }
  /* FIXME: Setting of TX_REQ bit here, initiates a retransmission of a previous
     message. For this reason, the following branch has been commented out.
     The transmission interrupt pending bit will be automatically cleared when you
     start the next transmission.

  else if (Status_Flag == CAN_STATUS_TX_READY)
  {
    tmpreg |= CAN_STATUS_TX_REQ;
  }
  */

  CANx->BUF_CON[BufferNumber] = tmpreg;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:41,代码来源:MDR32F9Qx_can.c

示例6: CAN_Cmd

/**
  * @brief  Enables or disables the specified CAN peripheral.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  NewState: new state of the CANx peripheral.
  *         This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void CAN_Cmd(MDR_CAN_TypeDef* CANx, FunctionalState NewState)
{
  uint32_t tmpreg_CONTROL;

  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  tmpreg_CONTROL = CANx->CONTROL;

  /* Form new value */
  if (NewState != DISABLE)
  {
    /* Enable CANx by setting the CAN_EN bit in the CONTROL register */
    tmpreg_CONTROL |= CAN_CONTROL_CAN_EN;
  }
  else
  {
    /* Disable CANx by resetting the CAN_EN bit in the CONTROL register */
    tmpreg_CONTROL &= ~CAN_CONTROL_CAN_EN;
  }

  /* Configure CONTROL register with new value */
  CANx->CONTROL = tmpreg_CONTROL;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:34,代码来源:MDR32F9Qx_can.c

示例7: CAN_GetRawReceivedData

/**
  * @brief  Reads received message (containing both header and data) from buffer.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  BufferNumber: the number of the buffer that is used for reception.
  * @param  RxMessage: pointer to a CAN_RxMsgTypeDef.
  * @retval None
  */
void CAN_GetRawReceivedData(MDR_CAN_TypeDef* CANx, uint32_t BufferNumber, CAN_RxMsgTypeDef* RxMessage)
{
  uint32_t tmpreg;

  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_BUFFER(BufferNumber));

  /* Get the DLC */
  tmpreg = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].DLC));

  RxMessage->Rx_Header.DLC = (uint8_t)(tmpreg & CAN_DLC_DATA_LENGTH);
  /* Get the IDE */
  RxMessage->Rx_Header.IDE = CAN_ID_STD;
  if ((tmpreg & CAN_DLC_IDE) != 0)
  {
    RxMessage->Rx_Header.IDE = CAN_ID_EXT;
  }
  /* Get the OVER_EN */
  RxMessage->Rx_Header.OVER_EN = DISABLE;
  tmpreg = CAN_ReadBufferSFR(&(CANx->BUF_CON[BufferNumber]));
  if ((tmpreg & CAN_BUF_CON_OVER_EN) != 0)
  {
    RxMessage->Rx_Header.OVER_EN = ENABLE;
  }
  /* Get the Id */
  RxMessage->Rx_Header.ID = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].ID));

  /* Get the data field */
  RxMessage->Data[0] = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].DATAL));
  RxMessage->Data[1] = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].DATAH));
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:41,代码来源:MDR32F9Qx_can.c

示例8: CAN_Transmit

/**
  * @brief  Initiates the transmission of a message.
  * @param CANx: where x can be 1 to select the CAN peripheral.
  * @param TxMessage: pointer to a structure which contains CAN Id, CAN
  *   DLC and CAN datas.
  * @retval : The number of the mailbox that is used for transmission
  *   or CAN_NO_MB if there is no empty mailbox.
  */
uint8_t CAN_Transmit(CAN_TypeDef* CANx, CanTxMsg* TxMessage)
{
  uint8_t transmit_mailbox = 0;
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_IDTYPE(TxMessage->IDE));
  assert_param(IS_CAN_RTR(TxMessage->RTR));
  assert_param(IS_CAN_DLC(TxMessage->DLC));
  /* Select one empty transmit mailbox */
  if ((CANx->TSR&TSR_TME0) == TSR_TME0)
  {
    transmit_mailbox = 0;
  }
  else if ((CANx->TSR&TSR_TME1) == TSR_TME1)
  {
    transmit_mailbox = 1;
  }
  else if ((CANx->TSR&TSR_TME2) == TSR_TME2)
  {
    transmit_mailbox = 2;
  }
  else
  {
    transmit_mailbox = CAN_NO_MB;
  }
  if (transmit_mailbox != CAN_NO_MB)
  {
    /* Set up the Id */
    CANx->sTxMailBox[transmit_mailbox].TIR &= TMIDxR_TXRQ;
    if (TxMessage->IDE == CAN_ID_STD)
    {
      assert_param(IS_CAN_STDID(TxMessage->StdId));  
      CANx->sTxMailBox[transmit_mailbox].TIR |= ((TxMessage->StdId << 21) | TxMessage->RTR);
    }
    else
    {
      assert_param(IS_CAN_EXTID(TxMessage->ExtId));
      CANx->sTxMailBox[transmit_mailbox].TIR |= ((TxMessage->ExtId<<3) | TxMessage->IDE | 
                                               TxMessage->RTR);
    }
    
    /* Set up the DLC */
    TxMessage->DLC &= (uint8_t)0x0000000F;
    CANx->sTxMailBox[transmit_mailbox].TDTR &= (uint32_t)0xFFFFFFF0;
    CANx->sTxMailBox[transmit_mailbox].TDTR |= TxMessage->DLC;
    /* Set up the data field */
    CANx->sTxMailBox[transmit_mailbox].TDLR = (((uint32_t)TxMessage->Data[3] << 24) | 
                                             ((uint32_t)TxMessage->Data[2] << 16) |
                                             ((uint32_t)TxMessage->Data[1] << 8) | 
                                             ((uint32_t)TxMessage->Data[0]));
    CANx->sTxMailBox[transmit_mailbox].TDHR = (((uint32_t)TxMessage->Data[7] << 24) | 
                                             ((uint32_t)TxMessage->Data[6] << 16) |
                                             ((uint32_t)TxMessage->Data[5] << 8) |
                                             ((uint32_t)TxMessage->Data[4]));
    /* Request transmission */
    CANx->sTxMailBox[transmit_mailbox].TIR |= TMIDxR_TXRQ;
  }
  return transmit_mailbox;
}
开发者ID:AndreAhmed,项目名称:asteroid-on-stm32,代码行数:67,代码来源:stm32f10x_can.c

示例9: CAN_GetBufferStatus

/**
  * @brief  Returns the CANx_BUF_xx_CON Register value.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  BufferNumber: The number of the buffer.
  * @retval The CANx_BUF_xx_CON Register value.
  */
uint32_t CAN_GetBufferStatus(MDR_CAN_TypeDef* CANx, uint32_t BufferNumber)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_BUFFER(BufferNumber));

  return CANx->BUF_CON[BufferNumber];
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:16,代码来源:MDR32F9Qx_can.c

示例10: CAN_ITClearErrorPendingBit

/**
  * @brief  Clears the CANx interrupt errors pending bits.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be any combination of the following values:
  *         CAN1, CAN2.
  * @param  Status_Flag: specifies the interrupt pending bit to clear.
  *         This parameter can be one of the following values:
            CAN_STATUS_ERROR_OVER:    Flag indicating that TEC or REC exceeds ERROR_MAX value
            CAN_STATUS_BIT_ERR:       Transmitting frame bits error flag
            CAN_STATUS_BIT_STUFF_ERR: Staff frame bits error flag
            CAN_STATUS_CRC_ERR:       Frame CRC error flag
            CAN_STATUS_FRAME_ERR:     Frame format error flag
            CAN_STATUS_ACK_ERR:       Reception acknowledge error flag
  * @retval None.
  */
void CAN_ITClearErrorPendingBit(MDR_CAN_TypeDef* CANx, uint32_t Status_Flag)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_IT_ERROR_FLAG(Status_Flag));

  CANx->STATUS &= ~Status_Flag;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:23,代码来源:MDR32F9Qx_can.c

示例11: CAN_GetReceivedData

/**
  * @brief  Reads the received data from buffer.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values:
  *         CAN1, CAN2.
  * @param  BufferNumber: the number of the buffer that is used for reception.
  * @param  RxBuffer: CAN_DataTypeDef array to place received data to.
  * @retval None
  */
void CAN_GetReceivedData(MDR_CAN_TypeDef* CANx, uint32_t BufferNumber, CAN_DataTypeDef RxBuffer)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_BUFFER(BufferNumber));

  RxBuffer[0] = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].DATAL));
  RxBuffer[1] = CAN_ReadBufferSFR(&(CANx->CAN_BUF[BufferNumber].DATAH));
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:18,代码来源:MDR32F9Qx_can.c

示例12: CAN_Receive

/**
  * @brief  Receives a message.
  * @param CANx: where x can be 1 to select the CAN peripheral.
  * @param FIFONumber: Receive FIFO number, CAN_FIFO0 or CAN_FIFO1.
  * @param RxMessage: pointer to a structure receive message which
  *   contains CAN Id, CAN DLC, CAN datas and FMI number.
  * @retval : None.
  */
void CAN_Receive(CAN_TypeDef* CANx, uint8_t FIFONumber, CanRxMsg* RxMessage)
{
	/* Check the parameters */
	assert_param(IS_CAN_ALL_PERIPH(CANx));
	assert_param(IS_CAN_FIFO(FIFONumber));
	/* Get the Id */
	RxMessage->IDE = (uint8_t)0x04 & CANx->sFIFOMailBox[FIFONumber].RIR;
	if (RxMessage->IDE == CAN_ID_STD) {
		RxMessage->StdId = (uint32_t)0x000007FF & (CANx->sFIFOMailBox[FIFONumber].RIR >> 21);
	} else {
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:18,代码来源:stm32f10x_can.c

示例13: CAN_TransmitStatus

/**
  * @brief  Checks the transmission of a message.
  * @param  CANx:            where x can be 1 or 2 to to select the
  *                          CAN peripheral.
  * @param  TransmitMailbox: the number of the mailbox that is used for
  *                          transmission.
  * @retval CAN_TxStatus_Ok if the CAN driver transmits the message, CAN_TxStatus_Failed
  *         in an other case.
  */
uint8_t CAN_TransmitStatus(CAN_TypeDef* CANx, uint8_t TransmitMailbox)
{
    uint32_t state = 0;

    /* Check the parameters */
    assert_param(IS_CAN_ALL_PERIPH(CANx));
    assert_param(IS_CAN_TRANSMITMAILBOX(TransmitMailbox));

    switch (TransmitMailbox)
    {
    case (CAN_TXMAILBOX_0):
        state =   CANx->TSR &  (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0);
        break;
    case (CAN_TXMAILBOX_1):
        state =   CANx->TSR &  (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1);
        break;
    case (CAN_TXMAILBOX_2):
        state =   CANx->TSR &  (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2);
        break;
    default:
        state = CAN_TxStatus_Failed;
        break;
    }
    switch (state)
    {
    /* transmit pending  */
    case (0x0):
        state = CAN_TxStatus_Pending;
        break;
    /* transmit failed  */
    case (CAN_TSR_RQCP0 | CAN_TSR_TME0):
        state = CAN_TxStatus_Failed;
        break;
    case (CAN_TSR_RQCP1 | CAN_TSR_TME1):
        state = CAN_TxStatus_Failed;
        break;
    case (CAN_TSR_RQCP2 | CAN_TSR_TME2):
        state = CAN_TxStatus_Failed;
        break;
    /* transmit succeeded  */
    case (CAN_TSR_RQCP0 | CAN_TSR_TXOK0 | CAN_TSR_TME0):
        state = CAN_TxStatus_Ok;
        break;
    case (CAN_TSR_RQCP1 | CAN_TSR_TXOK1 | CAN_TSR_TME1):
        state = CAN_TxStatus_Ok;
        break;
    case (CAN_TSR_RQCP2 | CAN_TSR_TXOK2 | CAN_TSR_TME2):
        state = CAN_TxStatus_Ok;
        break;
    default:
        state = CAN_TxStatus_Failed;
        break;
    }
    return (uint8_t) state;
}
开发者ID:szymon2103,项目名称:Stm32,代码行数:64,代码来源:stm32f10x_can.c

示例14: CAN_Receive

/***********************************************************************************************
 功能:CAN 接收一则消息
 形参:CAN_Type: CAN结构
       @arg CAN0 : CAN0模块
			 @arg CAN1 : CAN1模块
			 RxMessage   : CAN邮箱接收结构
 返回:
			 @arg TRUE  : 接收成功
			 @arg FALSE : 接收失败
 详解:0
************************************************************************************************/
uint8_t CAN_Receive(CAN_Type* CANx,CAN_RxMsgTypeDef* RxMessage)
{
	uint8_t code = 0;
	uint8_t i = 0;
	uint8_t len = 0;
	uint32_t word[2] = {0};
	//参数检查
	assert_param(IS_CAN_MB_NUM(RxMessage->MBIndex));
	assert_param(IS_CAN_ALL_PERIPH(CANx));


	code = CANx->TIMER;    // 全局解锁 MB 操作
	
	//查看标志位
	if((CANx->IFLAG1 & (1<<(RxMessage->MBIndex))) == 0)
	{
		return FALSE;
	}
	code = CAN_get_code(CANx->MB[RxMessage->MBIndex].CS);
	if(code != 0x02)
	{
		//接收失败
		RxMessage->IDE = 0;
		return FALSE;
	}
	len = CAN_get_length(CANx->MB[RxMessage->MBIndex].CS);
	if(len < 1)
	{
		RxMessage->IDE = 0;
		return FALSE;
	}
	RxMessage->IDE = len;
	code = CANx->TIMER;    // 全局解锁 MB 操作
	CANx->IFLAG1 = (1<<(RxMessage->MBIndex));//必须清除
	word[0] = CANx->MB[RxMessage->MBIndex].WORD0;   //读取接收的数据
	word[1] = CANx->MB[RxMessage->MBIndex].WORD1;   //读取接收的数据
	//判断是标准帧还是拓展帧
	if(CANx->MB[RxMessage->MBIndex].CS & CAN_CS_IDE_MASK)
	{
		RxMessage->IDE = CAN_IDE_Extended;
		RxMessage->Id =  CANx->MB[RxMessage->MBIndex].ID;
	}
	else
	{
		RxMessage->IDE = CAN_IDE_Standard;
		RxMessage->Id =  CANx->MB[RxMessage->MBIndex].ID>>18;
	}
	//读取地址
    for(i=0;i<len;i++)
    {  
        if(i < 4)
        (RxMessage->Data[0+i])=(word[0]>>((3-i)*8));
        else									 //数据存储转换
        (RxMessage->Data[0+i])=(word[1]>>((7-i)*8));
    }
开发者ID:SproutOrc,项目名称:CH-K-Lib,代码行数:66,代码来源:can.c

示例15: CAN_FilterInit

/**
  * @brief  Initializes the CANx Buffer filter and mask according to the specified
  *         parameters in the CAN_FilterInitStruct.
  * @param  CANx: Select the CAN peripheral.
  *         This parameter can be one of the following values: CAN1, CAN2.
  * @param  BufferNumber: the number of the buffer that is used for reception.
  * @param  CAN_FilterInitStruct: pointer to a CAN_FilterInitTypeDef
  *         structure that contains the configuration information.
  * @retval None.
  */
void CAN_FilterInit(MDR_CAN_TypeDef* CANx, uint32_t BufferNumber, CAN_FilterInitTypeDef* CAN_FilterInitStruct)
{
  /* Check the parameters */
  assert_param(IS_CAN_ALL_PERIPH(CANx));
  assert_param(IS_CAN_BUFFER(BufferNumber));
  assert_param(IS_CAN_ID(CAN_FilterInitStruct->Filter_ID));
  assert_param(IS_CAN_ID(CAN_FilterInitStruct->Mask_ID));

  CANx->CAN_BUF_FILTER[BufferNumber].FILTER  = CAN_FilterInitStruct->Filter_ID;
  CANx->CAN_BUF_FILTER[BufferNumber].MASK    = CAN_FilterInitStruct->Mask_ID;
}
开发者ID:eldarkg,项目名称:emdr1986x-std-per-lib,代码行数:21,代码来源:MDR32F9Qx_can.c


注:本文中的IS_CAN_ALL_PERIPH函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。