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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stm32f10x_spi.c

?? 提供萬利的板子上能跑的在MDK下的UCOS源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - NewState: new state of the SPIx SS output. 
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState)
{
  /* Check the parameters */
  assert(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the selected SPI SS output */
    SPIx->CR2 |= CR2_SSOE_Set;
  }
  else
  {
    /* Disable the selected SPI SS output */
    SPIx->CR2 &= CR2_SSOE_Reset;
  }
}

/*******************************************************************************
* Function Name  : SPI_DataSizeConfig
* Description    : Configures the data size for the selected SPI.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - SPI_DataSize: specifies the SPI data size.
*                    This parameter can be one of the following values:
*                       - SPI_DataSize_16b: Set data frame format to 16bit
*                       - SPI_DataSize_8b: Set data frame format to 8bit
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_DataSizeConfig(SPI_TypeDef* SPIx, u16 SPI_DataSize)
{
  /* Check the parameters */
  assert(IS_SPI_DATASIZE(SPI_DataSize));

  /* Clear DFF bit */
  SPIx->CR1 &= (u16)~SPI_DataSize_16b;
  /* Set new DFF bit value */
  SPIx->CR1 |= SPI_DataSize;
}

/*******************************************************************************
* Function Name  : SPI_TransmitCRC
* Description    : Transmit the SPIx CRC value.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_TransmitCRC(SPI_TypeDef* SPIx)
{
  /* Enable the selected SPI CRC transmission */
  SPIx->CR1 |= CR1_CRCNext_Set;
}

/*******************************************************************************
* Function Name  : SPI_CalculateCRC
* Description    : Enables or disables the CRC value calculation of the
*                  transfered bytes.
* Input          : - SPIx: where x can be 1 or 2 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(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 or 2 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(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 or 2 to select the SPI peripheral.
* Output         : None
* Return         : The CRC Polynomial register value.
*******************************************************************************/
u16 SPI_GetCRCPolynomial(SPI_TypeDef* 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 or 2 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(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_GetFlagStatus
* Description    : Checks whether the specified SPI flag is set or not.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - SPI_FLAG: specifies the flag to check. 
*                    This parameter can be one of the following values:
*                       - SPI_FLAG_BSY: Busy flag.
*                       - SPI_FLAG_OVR: Overrun flag.
*                       - SPI_FLAG_MODF: Mode Fault flag.
*                       - SPI_FLAG_CRCERR: CRC Error flag.
*                       - SPI_FLAG_TXE: Transmit buffer empty flag.
*                       - SPI_FLAG_RXNE: Receive buffer not empty flag.
* Output         : None
* Return         : The new state of SPI_FLAG (SET or RESET).
*******************************************************************************/
FlagStatus SPI_GetFlagStatus(SPI_TypeDef* SPIx, u16 SPI_FLAG)
{
  FlagStatus bitstatus = RESET;

  /* Check the parameters */
  assert(IS_SPI_GET_FLAG(SPI_FLAG));

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

/*******************************************************************************
* Function Name  : SPI_ClearFlag
* Description    : Clears the SPIx's pending flags.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - SPI_FLAG: specifies the flag to clear. 
*                    This parameter can be any combination of the following values:
*                       - SPI_FLAG_OVR: Overrun flag.
*                       - SPI_FLAG_MODF: Mode Fault flag.
*                       - SPI_FLAG_CRCERR: CRC Error flag.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_ClearFlag(SPI_TypeDef* SPIx, u16 SPI_FLAG)
{
  /* Check the parameters */
  assert(IS_SPI_CLEAR_FLAG(SPI_FLAG));
    
  /* SPI_FLAG_MODF flag clear */
  if(SPI_FLAG == SPI_FLAG_MODF)
  {
    /* Read SR register */
    (void)SPIx->SR;
    /* Write on CR1 register */
    SPIx->CR1 |= CR1_SPE_Set; 
  }
  /* SPI_FLAG_OVR flag clear */
  else if(SPI_FLAG == SPI_FLAG_OVR)  
  {
    /* Read SR register */
    (void)SPIx->SR;
  }
  else /* SPI_FLAG_CRCERR flag clear */
  {
    /* Clear the selected SPI flag */
    SPIx->SR &= (u16)~SPI_FLAG;
  }
}

/*******************************************************************************
* Function Name  : SPI_GetITStatus
* Description    : Checks whether the specified SPI interrupt has occurred or not.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - SPI_IT: specifies the SPI interrupt source to check. 
*                    This parameter can be one of the following values:
*                       - SPI_IT_OVR: Overrun interrupt.
*                       - SPI_IT_MODF: Mode Fault interrupt.
*                       - SPI_IT_CRCERR: CRC Error interrupt.
*                       - SPI_IT_TXE: Transmit buffer empty interrupt.
*                       - SPI_IT_RXNE: Receive buffer not empty interrupt.
* Output         : None
* Return         : The new state of SPI_IT (SET or RESET).
*******************************************************************************/
ITStatus SPI_GetITStatus(SPI_TypeDef* SPIx, u8 SPI_IT)
{
  ITStatus bitstatus = RESET;
  u16 itpos = 0, itmask = 0, enablestatus = 0;

  /* Check the parameters */
  assert(IS_SPI_GET_IT(SPI_IT));

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

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

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

/*******************************************************************************
* Function Name  : SPI_ClearITPendingBit
* Description    : Clears the SPIx抯 interrupt pending bits.
* Input          : - SPIx: where x can be 1 or 2 to select the SPI peripheral.
*                  - SPI_IT: specifies the SPI interrupt pending bit to clear.
*                    This parameter can be one of the following values:
*                       - SPI_IT_OVR: Overrun interrupt.
*                       - SPI_IT_MODF: Mode Fault interrupt.
*                       - SPI_IT_CRCERR: CRC Error interrupt.
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_ClearITPendingBit(SPI_TypeDef* SPIx, u8 SPI_IT)
{
  u16 itpos = 0;

  /* Check the parameters */
  assert(IS_SPI_CLEAR_IT(SPI_IT));

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品白丝jk黑袜喷水| 欧美色男人天堂| 欧美午夜精品一区二区蜜桃| 91精品麻豆日日躁夜夜躁| 国产精品青草久久| 老司机午夜精品99久久| 91色综合久久久久婷婷| 精品99999| 日本女人一区二区三区| 色综合激情五月| 国产亚洲精品7777| 免费成人性网站| 欧美区一区二区三区| 亚洲人成伊人成综合网小说| 国产精品资源在线看| 欧美一区二区三区色| 一区二区三区.www| 91老师国产黑色丝袜在线| 久久久777精品电影网影网 | 亚洲免费观看高清完整版在线| 日本欧美大码aⅴ在线播放| 欧美三级午夜理伦三级中视频| 欧美国产精品中文字幕| 国产一区二区在线免费观看| 欧美一二三区在线| 日韩成人免费电影| 欧美日韩电影在线| 亚洲电影视频在线| 欧美影院一区二区| 一区二区三区四区激情| 91麻豆123| 一级做a爱片久久| 色哦色哦哦色天天综合| 亚洲视频免费观看| 91免费精品国自产拍在线不卡 | av在线不卡免费看| 国产精品素人一区二区| 成人免费av在线| 国产精品久久午夜夜伦鲁鲁| 成人国产亚洲欧美成人综合网| 亚洲国产精品v| 99久久99久久精品免费观看 | 亚洲国产毛片aaaaa无费看| 色偷偷成人一区二区三区91| 亚洲激情自拍视频| 91麻豆精品国产自产在线| 奇米色777欧美一区二区| 日韩欧美亚洲一区二区| 精品午夜一区二区三区在线观看 | 久久精品二区亚洲w码| 精品国产一区二区三区忘忧草 | 国产成人免费视频网站高清观看视频| 精品成人在线观看| 丁香亚洲综合激情啪啪综合| 亚洲欧美日韩在线| 欧美色男人天堂| 国产精品一区二区在线观看网站| 国产色产综合产在线视频| 色综合天天综合狠狠| 日韩高清国产一区在线| 久久久精品综合| 欧美日韩综合在线| 国产精品一区二区在线观看不卡| 亚洲欧美视频一区| 91精品福利在线一区二区三区| 国产高清不卡二三区| 亚洲一区二区综合| 欧美精品一区二区三区很污很色的 | 欧美一区二区三区四区高清| 成人性生交大片| 日韩电影免费在线看| 国产精品理伦片| 欧美一区二区三区在线观看| www.激情成人| 久88久久88久久久| 一区二区三区精品视频| 久久伊99综合婷婷久久伊| 色一情一乱一乱一91av| 国内一区二区视频| 午夜私人影院久久久久| 国产欧美一区二区三区在线老狼| 精品视频一区二区不卡| 成人av中文字幕| 免费高清在线一区| 一区二区激情小说| 亚洲国产精品ⅴa在线观看| 日韩一卡二卡三卡国产欧美| 91久久免费观看| 成人av集中营| 国产麻豆午夜三级精品| 日韩福利电影在线| 亚洲综合精品自拍| 成人欧美一区二区三区黑人麻豆| 精品免费国产一区二区三区四区| 欧洲亚洲精品在线| 99热99精品| 成人免费毛片高清视频| 精品一区二区三区蜜桃| 青青青伊人色综合久久| 亚洲国产一区二区三区青草影视| 国产精品久久毛片| 亚洲国产精品t66y| 久久久久国产精品厨房| 337p粉嫩大胆噜噜噜噜噜91av| 678五月天丁香亚洲综合网| 91视频在线观看免费| av网站一区二区三区| 粉嫩一区二区三区性色av| 国产精品一色哟哟哟| 国产伦精品一区二区三区免费迷 | 欧美xxx久久| 制服丝袜在线91| 欧美一区二区三区免费观看视频| 欧美日韩一卡二卡三卡| 欧美专区日韩专区| 欧美视频在线观看一区| 欧美亚洲日本国产| 欧美久久一二区| 91精品国产色综合久久不卡电影| 欧美妇女性影城| 日韩一区二区免费在线电影 | 中文字幕一区二区三区在线不卡 | 久久亚洲私人国产精品va媚药| 欧美一区二区播放| 日韩欧美一级精品久久| 精品国产一区二区三区av性色| 91精品国产色综合久久不卡蜜臀 | 91亚洲国产成人精品一区二三 | 97久久超碰精品国产| 色琪琪一区二区三区亚洲区| 欧美性大战久久久久久久 | 国产精品国产a级| 亚洲精品免费在线播放| 午夜在线电影亚洲一区| 激情综合网最新| 成人avav影音| 欧美最猛性xxxxx直播| 91精品国模一区二区三区| 日韩精品影音先锋| 国产精品麻豆视频| 亚洲国产精品欧美一二99| 奇米色一区二区| 成人av电影在线| 欧美日韩在线播放一区| 精品剧情v国产在线观看在线| 亚洲国产精品传媒在线观看| 一区二区三区在线看| 蜜臀av性久久久久蜜臀aⅴ| 岛国一区二区三区| 欧美色综合久久| 久久一区二区视频| 亚洲资源在线观看| 国产一区二区三区| 欧美色视频一区| 中文字幕不卡三区| 日本一区中文字幕| 91亚洲精品一区二区乱码| 欧美不卡在线视频| 亚洲老司机在线| 国产在线精品一区二区夜色| 欧美视频一区二区三区| 久久嫩草精品久久久精品一| 亚洲一区二区偷拍精品| 国产成人在线视频播放| 日韩一区二区三区精品视频| 18成人在线观看| 国产一区二区伦理片| 91精品久久久久久久91蜜桃| 亚洲精品日韩综合观看成人91| 久久精品国产久精国产爱| 欧美写真视频网站| 亚洲欧美在线视频| 国产精品中文字幕一区二区三区| 欧美日韩在线直播| 亚洲免费观看高清完整| 国产经典欧美精品| 日韩三级中文字幕| 亚洲va韩国va欧美va精品| 在线免费观看成人短视频| 中文乱码免费一区二区| 国产自产高清不卡| 日韩久久精品一区| 美女视频第一区二区三区免费观看网站| 99re热这里只有精品视频| 欧美国产在线观看| 国产大片一区二区| 国产亚洲午夜高清国产拍精品| 秋霞电影一区二区| 91麻豆精品国产无毒不卡在线观看| 亚洲一区视频在线| 91久久国产最好的精华液| 综合久久久久综合| 91网上在线视频| 一区二区理论电影在线观看| aaa欧美日韩| 亚洲欧美精品午睡沙发| 99精品在线观看视频| 亚洲精品国产a| 欧美色图在线观看| 秋霞午夜鲁丝一区二区老狼|