亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stm32f10x_spi.c

?? 基于Cortex-M3的STM32的IAR EWARM的工程模塊
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
* Description    : Enables or disables the CRC value calculation of the
*                  transfered bytes.
* Input          : - SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
*                  - NewState: new state of the SPIx CRC value calculation.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the selected SPI CRC calculation */
    SPIx->CR1 |= CR1_CRCEN_Set;
  }
  else
  {
    /* Disable the selected SPI CRC calculation */
    SPIx->CR1 &= CR1_CRCEN_Reset;
  }
}

/*******************************************************************************
* Function Name  : SPI_GetCRC
* Description    : Returns the transmit or the receive CRC register value for
*                  the specified SPI.
* Input          : - SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
*                  - SPI_CRC: specifies the CRC register to be read.
*                    This parameter can be one of the following values:
*                       - SPI_CRC_Tx: Selects Tx CRC register
*                       - SPI_CRC_Rx: Selects Rx CRC register
* Output         : None
* Return         : The selected CRC register value..
*******************************************************************************/
u16 SPI_GetCRC(SPI_TypeDef* SPIx, u8 SPI_CRC)
{
  u16 crcreg = 0;

  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_CRC(SPI_CRC));

  if (SPI_CRC != SPI_CRC_Rx)
  {
    /* Get the Tx CRC register */
    crcreg = SPIx->TXCRCR;
  }
  else
  {
    /* Get the Rx CRC register */
    crcreg = SPIx->RXCRCR;
  }

  /* Return the selected CRC register */
  return crcreg;
}

/*******************************************************************************
* Function Name  : SPI_GetCRCPolynomial
* Description    : Returns the CRC Polynomial register value for the specified SPI.
* Input          : - SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
* Output         : None
* Return         : The CRC Polynomial register value.
*******************************************************************************/
u16 SPI_GetCRCPolynomial(SPI_TypeDef* SPIx)
{
  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  
  /* Return the CRC polynomial register */
  return SPIx->CRCPR;
}

/*******************************************************************************
* Function Name  : SPI_BiDirectionalLineConfig
* Description    : Selects the data transfer direction in bi-directional mode
*                  for the specified SPI.
* Input          : - SPIx: where x can be 1, 2 or 3 to select the SPI peripheral.
*                  - SPI_Direction: specifies the data transfer direction in
*                    bi-directional mode. 
*                    This parameter can be one of the following values:
*                       - SPI_Direction_Tx: Selects Tx transmission direction
*                       - SPI_Direction_Rx: Selects Rx receive direction
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, u16 SPI_Direction)
{
  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_DIRECTION(SPI_Direction));

  if (SPI_Direction == SPI_Direction_Tx)
  {
    /* Set the Tx only mode */
    SPIx->CR1 |= SPI_Direction_Tx;
  }
  else
  {
    /* Set the Rx only mode */
    SPIx->CR1 &= SPI_Direction_Rx;
  }
}

/*******************************************************************************
* Function Name  : SPI_I2S_GetFlagStatus
* Description    : Checks whether the specified SPI/I2S flag is set or not.
* Input          : - SPIx: where x can be :
*                         - 1, 2 or 3 in SPI mode 
*                         - 2 or 3 in I2S mode
*                  - SPI_I2S_FLAG: specifies the SPI/I2S flag to check. 
*                    This parameter can be one of the following values:
*                       - SPI_I2S_FLAG_TXE: Transmit buffer empty flag.
*                       - SPI_I2S_FLAG_RXNE: Receive buffer not empty flag.
*                       - SPI_I2S_FLAG_BSY: Busy flag.
*                       - SPI_I2S_FLAG_OVR: Overrun flag.
*                       - SPI_FLAG_MODF: Mode Fault flag.
*                       - SPI_FLAG_CRCERR: CRC Error flag.
*                       - I2S_FLAG_UDR: Underrun Error flag.
*                       - I2S_FLAG_CHSIDE: Channel Side flag.
* Output         : None
* Return         : The new state of SPI_I2S_FLAG (SET or RESET).
*******************************************************************************/
FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, u16 SPI_I2S_FLAG)
{
  FlagStatus bitstatus = RESET;

  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG));

  /* Check the status of the specified SPI/I2S flag */
  if ((SPIx->SR & SPI_I2S_FLAG) != (u16)RESET)
  {
    /* SPI_I2S_FLAG is set */
    bitstatus = SET;
  }
  else
  {
    /* SPI_I2S_FLAG is reset */
    bitstatus = RESET;
  }
  /* Return the SPI_I2S_FLAG status */
  return  bitstatus;
}

/*******************************************************************************
* Function Name  : SPI_I2S_ClearFlag
* Description    : Clears the SPIx/I2Sx pending flags.
* Input          : - SPIx: where x can be :
*                         - 1, 2 or 3 in SPI mode 
*                         - 2 or 3 in I2S mode
*                  - SPI_I2S_FLAG: specifies the SPI/I2S flag to clear. 
*                    This parameter can be one of the following values:
*                       - SPI_I2S_FLAG_OVR: Overrun flag 
*                       - SPI_FLAG_MODF: Mode Fault flag.
*                       - SPI_FLAG_CRCERR: CRC Error flag.
*                       - I2S_FLAG_UDR: Underrun Error flag.
*                    Note: Before clearing OVR flag, it is mandatory to read 
*                          SPI_I2S_DR register, so that the last data is not lost.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, u16 SPI_I2S_FLAG)
{
  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_I2S_CLEAR_FLAG(SPI_I2S_FLAG));
    
  /* SPI_FLAG_MODF flag clear */
  if(SPI_I2S_FLAG == SPI_FLAG_MODF)
  {
    /* Read SR register */
    (void)SPIx->SR;
    
    /* Write on CR1 register */
    SPIx->CR1 |= CR1_SPE_Set; 
  }
  /* SPI_I2S_FLAG_OVR flag or I2S_FLAG_UDR flag clear */
  else if ((SPI_I2S_FLAG == SPI_I2S_FLAG_OVR) || (SPI_I2S_FLAG == I2S_FLAG_UDR))  
  {
    /* Read SR register  (Before clearing OVR flag, it is mandatory to read 
       SPI_I2S_DR register)*/
    (void)SPIx->SR;
  }
  else /* SPI_FLAG_CRCERR flag clear */
  {
    /* Clear the selected SPI flag */
    SPIx->SR = (u16)~SPI_I2S_FLAG;
  }
}

/*******************************************************************************
* Function Name  : SPI_I2S_GetITStatus
* Description    : Checks whether the specified SPI/I2S interrupt has occurred or not.
* Input          : - SPIx: where x can be :
*                         - 1, 2 or 3 in SPI mode 
*                         - 2 or 3 in I2S mode
*                  - SPI_I2S_IT: specifies the SPI/I2S interrupt source to check. 
*                    This parameter can be one of the following values:
*                       - SPI_I2S_IT_TXE: Transmit buffer empty interrupt.
*                       - SPI_I2S_IT_RXNE: Receive buffer not empty interrupt.
*                       - SPI_I2S_IT_OVR: Overrun interrupt.
*                       - SPI_IT_MODF: Mode Fault interrupt.
*                       - SPI_IT_CRCERR: CRC Error interrupt.
*                       - I2S_IT_UDR: Underrun Error interrupt.
* Output         : None
* Return         : The new state of SPI_I2S_IT (SET or RESET).
*******************************************************************************/
ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, u8 SPI_I2S_IT)
{
  ITStatus bitstatus = RESET;
  u16 itpos = 0, itmask = 0, enablestatus = 0;

  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_I2S_GET_IT(SPI_I2S_IT));

  /* Get the SPI/I2S IT index */
  itpos = (u16)((u16)0x01 << (SPI_I2S_IT & (u8)0x0F));

  /* Get the SPI/I2S IT mask */
  itmask = SPI_I2S_IT >> 4;
  /* Set the IT mask */
  itmask = (u16)((u16)0x01 << itmask);
  /* Get the SPI_I2S_IT enable bit status */
  enablestatus = (SPIx->CR2 & itmask) ;

  /* Check the status of the specified SPI/I2S interrupt */
  if (((SPIx->SR & itpos) != (u16)RESET) && enablestatus)
  {
    /* SPI_I2S_IT is set */
    bitstatus = SET;
  }
  else
  {
    /* SPI_I2S_IT is reset */
    bitstatus = RESET;
  }
  /* Return the SPI_I2S_IT status */
  return bitstatus;
}

/*******************************************************************************
* Function Name  : SPI_I2S_ClearITPendingBit
* Description    : Clears the SPIx/I2Sx interrupt pending bits.
* Input          : - SPIx: where x can be :
*                         - 1, 2 or 3 in SPI mode 
*                         - 2 or 3 in I2S mode
*                  - SPI_I2S_IT: specifies the SPI/I2S interrupt pending bit to clear.
*                    This parameter can be one of the following values:
*                       - SPI_I2S_IT_OVR: Overrun interrupt.
*                       - SPI_IT_MODF: Mode Fault interrupt.
*                       - SPI_IT_CRCERR: CRC Error interrupt.
*                       - I2S_IT_UDR: Underrun Error interrupt.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, u8 SPI_I2S_IT)
{
  u16 itpos = 0;

  /* Check the parameters */
  assert_param(IS_SPI_ALL_PERIPH(SPIx));
  assert_param(IS_SPI_I2S_CLEAR_IT(SPI_I2S_IT));

  /* SPI_IT_MODF pending bit clear */
  if(SPI_I2S_IT == SPI_IT_MODF)
  {
    /* Read SR register */
    (void)SPIx->SR;
    /* Write on CR1 register */
    SPIx->CR1 |= CR1_SPE_Set; 
  }
  /* SPI_I2S_IT_OVR or I2S_IT_UDR pending bit clear */ 
  else if((SPI_I2S_IT == SPI_I2S_IT_OVR) || (SPI_I2S_IT == I2S_IT_UDR))    
  {
    /* Read SR register */
    (void)(SPIx->SR);
  }  
  else   /* SPI_IT_CRCERR pending bit clear */
  {
    /* Get the SPI/I2S IT index */
    itpos = (u16)((u16)0x01 << (SPI_I2S_IT & (u8)0x0F));
    /* Clear the selected SPI/I2S interrupt pending bits */
    SPIx->SR = (u16)~itpos;
  }
}

/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费在线观看| 国产视频一区二区三区在线观看| 中文字幕一区视频| 成人h版在线观看| 亚洲视频一二区| www.久久久久久久久| 亚洲精品伦理在线| 91麻豆精品91久久久久同性| 蜜桃一区二区三区在线观看| 26uuu精品一区二区在线观看| 国产乱子轮精品视频| 亚洲特黄一级片| 欧美色男人天堂| 裸体歌舞表演一区二区| 国产午夜亚洲精品羞羞网站| 欧美三区在线观看| 理论电影国产精品| 亚洲国产高清aⅴ视频| 色噜噜狠狠成人网p站| 日韩av一区二| 国产精品久久久一本精品| 色屁屁一区二区| 日韩电影在线一区二区| 国产欧美日韩在线视频| 色综合久久中文字幕| 日韩不卡一二三区| 国产精品色眯眯| 6080日韩午夜伦伦午夜伦| 国产美女精品在线| 亚洲色图清纯唯美| 欧美xxxxx牲另类人与| 91美女片黄在线观看91美女| 久久精品99国产精品| 国产精品久久久久aaaa樱花| 欧美丰满美乳xxx高潮www| 国产成人av自拍| 五月天视频一区| 国产精品全国免费观看高清| 欧美一区二区三区在线观看视频 | 青青草一区二区三区| 免费在线观看成人| 17c精品麻豆一区二区免费| 欧美一区午夜视频在线观看| a级精品国产片在线观看| 久久精品国产第一区二区三区| 亚洲激情欧美激情| 久久综合久久久久88| 51精品久久久久久久蜜臀| 91丨九色丨蝌蚪丨老版| 国产精品1区二区.| 美国三级日本三级久久99| 亚洲一区二区在线免费看| 亚洲国产精品国自产拍av| 日韩欧美国产系列| 欧美亚州韩日在线看免费版国语版| 国产精品1024| 裸体歌舞表演一区二区| 丝袜美腿成人在线| 一区二区三区日韩精品| 中文字幕日韩欧美一区二区三区| 久久噜噜亚洲综合| 精品女同一区二区| 欧美电影免费观看高清完整版在线观看 | 欧美天堂一区二区三区| 99久久精品99国产精品| 成人av免费观看| 国产99久久久国产精品| 国模大尺度一区二区三区| 久久精品国产免费看久久精品| 亚洲福利电影网| 亚洲一区二区成人在线观看| 一区二区成人在线| 亚洲一区二区在线免费观看视频| 亚洲一区二区四区蜜桃| 午夜欧美一区二区三区在线播放| 亚洲综合免费观看高清完整版在线| 亚洲乱码国产乱码精品精小说| 亚洲视频每日更新| 亚洲三级电影全部在线观看高清| 中文字幕一区二区三| 亚洲欧美另类小说| 一区二区三区视频在线看| 亚洲国产婷婷综合在线精品| 午夜av一区二区| 欧美a级理论片| 国产在线精品一区二区夜色| 精品一区二区三区不卡| 国产精品亚洲一区二区三区在线| 国产一区二区精品在线观看| 成人激情开心网| 91国偷自产一区二区三区观看| 日本国产一区二区| 在线观看91精品国产麻豆| 日韩视频在线永久播放| 久久久久久久精| 亚洲欧洲制服丝袜| 亚洲sss视频在线视频| 久久国产精品一区二区| 国产精品1区2区3区| 色婷婷综合久久久中文字幕| 亚洲欧美日韩久久精品| 一区av在线播放| 久久91精品国产91久久小草| 懂色av噜噜一区二区三区av| 91九色02白丝porn| 欧美一区二区三区在线| 国产精品久久久久影院色老大 | 丁香一区二区三区| 一本大道久久精品懂色aⅴ| 欧美喷水一区二区| 久久免费午夜影院| 一区二区三区**美女毛片| 久久不见久久见中文字幕免费| 成人在线综合网| 91精品国产欧美日韩| 国产午夜精品一区二区三区视频 | 三级不卡在线观看| 国产乱码精品一区二区三| 在线视频欧美区| 久久这里只有精品6| 一区二区三区欧美亚洲| 国产麻豆欧美日韩一区| 精品视频免费看| 国产精品国产三级国产有无不卡| 日韩电影一区二区三区四区| 粉嫩av一区二区三区粉嫩| 4438x成人网最大色成网站| 国产精品毛片久久久久久| 日韩vs国产vs欧美| 一本在线高清不卡dvd| 久久久精品国产免大香伊| 亚洲午夜一二三区视频| 成人午夜视频免费看| 日韩精品一区二区三区中文不卡 | 国产美女精品人人做人人爽| 欧美色综合影院| 中日韩免费视频中文字幕| 日本一区中文字幕| 欧美系列日韩一区| 成人免费在线视频| 粉嫩一区二区三区性色av| 26uuu久久综合| 麻豆精品一区二区av白丝在线| 欧美在线视频你懂得| 日韩伦理av电影| 不卡av在线网| 国产亚洲一二三区| 国产在线看一区| 欧美videos大乳护士334| 亚洲成人av在线电影| 色悠悠亚洲一区二区| 中文字幕日本不卡| 成人黄色网址在线观看| 国产三级一区二区| 国产九色精品成人porny | 911精品国产一区二区在线| 亚洲免费观看在线视频| 91在线视频免费观看| 成人免费在线视频观看| 丁香激情综合五月| 国产丝袜在线精品| 国产成a人亚洲精| 国产亚洲综合性久久久影院| 狠狠色丁香婷婷综合| 欧美不卡一区二区三区| 蓝色福利精品导航| 欧美电视剧在线看免费| 久色婷婷小香蕉久久| 日韩精品专区在线| 国产一区二区在线观看视频| 日韩精品一区二| 国产高清不卡一区二区| 久久久高清一区二区三区| 国产乱子轮精品视频| 国产日韩精品一区二区三区在线| 国产91精品一区二区麻豆网站| 中文av字幕一区| 91原创在线视频| 一区二区三区在线观看国产| 91精品福利在线| 奇米综合一区二区三区精品视频| 欧美大片在线观看一区| 国产精品18久久久久久vr | 一区二区三区色| 777欧美精品| 国产精品资源网站| 欧美国产1区2区| 色综合色综合色综合| 亚洲超丰满肉感bbw| 欧美电影免费观看高清完整版在线| 国产一区二区免费视频| 国产精品久久久久永久免费观看| 在线观看一区二区视频| 午夜欧美电影在线观看| 精品国产乱码91久久久久久网站| 粉嫩蜜臀av国产精品网站| 亚洲中国最大av网站| 欧美xxxxx牲另类人与| 91丨porny丨蝌蚪视频| 日本美女一区二区三区|