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

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

?? stm32f10x_i2c.c

?? 基于Cortex-M3的STM32的IAR EWARM的工程模塊
?? C
?? 第 1 頁 / 共 3 頁
字號:

/*******************************************************************************
* Function Name  : I2C_DMALastTransferCmd
* Description    : Specifies that the next DMA transfer is the last one.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C DMA last transfer.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Next DMA transfer is the last transfer */
    I2Cx->CR2 |= CR2_LAST_Set;
  }
  else
  {
    /* Next DMA transfer is not the last transfer */
    I2Cx->CR2 &= CR2_LAST_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_GenerateSTART
* Description    : Generates I2Cx communication START condition.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C START condition generation.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None.
*******************************************************************************/
void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Generate a START condition */
    I2Cx->CR1 |= CR1_START_Set;
  }
  else
  {
    /* Disable the START condition generation */
    I2Cx->CR1 &= CR1_START_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_GenerateSTOP
* Description    : Generates I2Cx communication STOP condition.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C STOP condition generation.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None.
*******************************************************************************/
void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Generate a STOP condition */
    I2Cx->CR1 |= CR1_STOP_Set;
  }
  else
  {
    /* Disable the STOP condition generation */
    I2Cx->CR1 &= CR1_STOP_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_AcknowledgeConfig
* Description    : Enables or disables the specified I2C acknowledge feature.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C Acknowledgement.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None.
*******************************************************************************/
void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the acknowledgement */
    I2Cx->CR1 |= CR1_ACK_Set;
  }
  else
  {
    /* Disable the acknowledgement */
    I2Cx->CR1 &= CR1_ACK_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_OwnAddress2Config
* Description    : Configures the specified I2C own address2.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - Address: specifies the 7bit I2C own address2.
* Output         : None
* Return         : None.
*******************************************************************************/
void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address)
{
  u16 tmpreg = 0;

  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));

  /* Get the old register value */
  tmpreg = I2Cx->OAR2;
  /* Reset I2Cx Own address2 bit [7:1] */
  tmpreg &= OAR2_ADD2_Reset;
  /* Set I2Cx Own address2 */
  tmpreg |= (u16)(Address & (u16)0x00FE);
  /* Store the new register value */
  I2Cx->OAR2 = tmpreg;
}

/*******************************************************************************
* Function Name  : I2C_DualAddressCmd
* Description    : Enables or disables the specified I2C dual addressing mode.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C dual addressing mode.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable dual addressing mode */
    I2Cx->OAR2 |= OAR2_ENDUAL_Set;
  }
  else
  {
    /* Disable dual addressing mode */
    I2Cx->OAR2 &= OAR2_ENDUAL_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_GeneralCallCmd
* Description    : Enables or disables the specified I2C general call feature.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C General call.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable generall call */
    I2Cx->CR1 |= CR1_ENGC_Set;
  }
  else
  {
    /* Disable generall call */
    I2Cx->CR1 &= CR1_ENGC_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_ITConfig
* Description    : Enables or disables the specified I2C interrupts.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_IT: specifies the I2C interrupts sources to be enabled
*                    or disabled. 
*                    This parameter can be any combination of the following values:
*                       - I2C_IT_BUF: Buffer interrupt mask
*                       - I2C_IT_EVT: Event interrupt mask
*                       - I2C_IT_ERR: Error interrupt mask
*                  - NewState: new state of the specified I2C interrupts.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  assert_param(IS_I2C_CONFIG_IT(I2C_IT));
  
  if (NewState != DISABLE)
  {
    /* Enable the selected I2C interrupts */
    I2Cx->CR2 |= I2C_IT;
  }
  else
  {
    /* Disable the selected I2C interrupts */
    I2Cx->CR2 &= (u16)~I2C_IT;
  }
}

/*******************************************************************************
* Function Name  : I2C_SendData
* Description    : Sends a data byte through the I2Cx peripheral.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - Data: Byte to be transmitted..
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));

  /* Write in the DR register the data to be sent */
  I2Cx->DR = Data;
}

/*******************************************************************************
* Function Name  : I2C_ReceiveData
* Description    : Returns the most recent received data by the I2Cx peripheral.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output         : None
* Return         : The value of the received data.
*******************************************************************************/
u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));

  /* Return the data in the DR register */
  return (u8)I2Cx->DR;
}

/*******************************************************************************
* Function Name  : I2C_Send7bitAddress
* Description    : Transmits the address byte to select the slave device.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - Address: specifies the slave address which will be transmitted
*                  - I2C_Direction: specifies whether the I2C device will be a
*                    Transmitter or a Receiver. 
*                    This parameter can be one of the following values
*                       - I2C_Direction_Transmitter: Transmitter mode
*                       - I2C_Direction_Receiver: Receiver mode
* Output         : None
* Return         : None.
*******************************************************************************/
void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 I2C_Direction)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_I2C_DIRECTION(I2C_Direction));

  /* Test on the direction to set/reset the read/write bit */
  if (I2C_Direction != I2C_Direction_Transmitter)
  {
    /* Set the address bit0 for read */
    Address |= OAR1_ADD0_Set;
  }
  else
  {
    /* Reset the address bit0 for write */
    Address &= OAR1_ADD0_Reset;
  }
  /* Send the address */
  I2Cx->DR = Address;
}

/*******************************************************************************
* Function Name  : I2C_ReadRegister
* Description    : Reads the specified I2C register and returns its value.
* Input1         : - I2C_Register: specifies the register to read.
*                    This parameter can be one of the following values:
*                       - I2C_Register_CR1:  CR1 register.
*                       - I2C_Register_CR2:   CR2 register.
*                       - I2C_Register_OAR1:  OAR1 register.
*                       - I2C_Register_OAR2:  OAR2 register.
*                       - I2C_Register_DR:    DR register.
*                       - I2C_Register_SR1:   SR1 register.
*                       - I2C_Register_SR2:   SR2 register.
*                       - I2C_Register_CCR:   CCR register.
*                       - I2C_Register_TRISE: TRISE register.
* Output         : None
* Return         : The value of the read register.
*******************************************************************************/
u16 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_I2C_REGISTER(I2C_Register));

  /* Return the selected register value */
  return (*(vu16 *)(*((vu32 *)&I2Cx) + I2C_Register));
}

/*******************************************************************************
* Function Name  : I2C_SoftwareResetCmd
* Description    : Enables or disables the specified I2C software reset.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C software reset.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美最猛黑人xxxxx猛交| 成人免费高清在线| 在线播放/欧美激情| 日韩二区三区四区| 欧美mv和日韩mv的网站| 精品午夜一区二区三区在线观看| 欧美成人猛片aaaaaaa| 国产精品一区二区免费不卡| 国产精品麻豆欧美日韩ww| 在线一区二区视频| 日本伊人午夜精品| 日本一区二区成人| 99re这里只有精品首页| 亚洲一区在线观看视频| 欧美一级日韩免费不卡| 国产一区二区三区久久悠悠色av| 国产精品久线观看视频| 欧美午夜电影一区| 韩国精品一区二区| 亚洲视频一区二区免费在线观看 | 最新欧美精品一区二区三区| 91日韩精品一区| 五月婷婷另类国产| 久久久久国产成人精品亚洲午夜| 91麻豆国产自产在线观看| 秋霞电影一区二区| 中文字幕中文在线不卡住| 欧美日韩日本视频| 盗摄精品av一区二区三区| 一片黄亚洲嫩模| ww亚洲ww在线观看国产| 欧美在线999| 国产综合成人久久大片91| 一区二区日韩av| 久久婷婷综合激情| 欧美人体做爰大胆视频| 成人深夜在线观看| 久久草av在线| 亚洲国产精品一区二区www| 久久久久久麻豆| 欧美日韩一级二级| 91在线看国产| 国产麻豆午夜三级精品| 午夜日韩在线电影| 亚洲天堂精品视频| 国产亚洲欧美日韩俺去了| 欧美日韩1234| 色综合久久久网| 高清不卡一二三区| 韩国一区二区三区| 日韩av高清在线观看| 一区二区视频免费在线观看| 久久这里只有精品首页| 欧美人狂配大交3d怪物一区| av不卡免费电影| 久久99热99| 免费视频最近日韩| 亚洲第一会所有码转帖| 成人免费一区二区三区视频| 久久久久久电影| 精品国产凹凸成av人导航| 欧美性色欧美a在线播放| 91视频免费观看| 成人手机电影网| 国产a区久久久| 国产一区二区成人久久免费影院| 免播放器亚洲一区| 日韩精品一卡二卡三卡四卡无卡| 亚洲人成人一区二区在线观看 | 日韩欧美国产一区在线观看| 欧美日韩一区二区三区四区| 日本久久电影网| 99久久精品国产观看| jlzzjlzz欧美大全| 国产91高潮流白浆在线麻豆| 国产精品911| 国产乱码精品一区二区三区五月婷 | 国产精品成人网| 欧美国产一区视频在线观看| 久久久精品天堂| 国产女人水真多18毛片18精品视频| 久久久久久久久99精品| 欧美极品xxx| 国产精品欧美一区喷水| 一区在线中文字幕| 亚洲欧美另类综合偷拍| 亚洲欧美日韩国产综合在线| 亚洲色图都市小说| 午夜一区二区三区视频| 免费在线成人网| 国产精品一二三四区| 成人美女视频在线观看18| 91香蕉视频mp4| 欧美日韩高清一区二区| 91麻豆精品国产综合久久久久久| 日韩视频免费直播| 国产欧美一区二区三区在线看蜜臀| 欧美激情一区二区三区蜜桃视频 | 精品99999| 日本一区二区三区电影| 亚洲欧美视频在线观看视频| 亚洲国产精品自拍| 黄网站免费久久| 成人av资源下载| 欧美日韩一区二区不卡| 欧美成人a∨高清免费观看| 久久久久久久电影| 一区二区三区免费看视频| 免费在线成人网| 成人av先锋影音| 欧美日韩精品是欧美日韩精品| 欧美一二三四在线| 国产精品家庭影院| 日韩中文欧美在线| 成人av在线一区二区三区| 91成人免费网站| 久久女同精品一区二区| 亚洲综合在线观看视频| 久久激情五月激情| 在线视频一区二区三| 日韩欧美二区三区| 一区二区三区在线看| 久久国内精品视频| 欧美视频在线观看一区| 国产午夜久久久久| 亚洲sss视频在线视频| 国产99一区视频免费| 欧美丰满一区二区免费视频 | 国产美女av一区二区三区| 91国偷自产一区二区三区观看| 精品人伦一区二区色婷婷| 亚洲欧洲综合另类| 高清免费成人av| 日韩视频在线你懂得| 亚洲啪啪综合av一区二区三区| 国内久久精品视频| 制服丝袜激情欧洲亚洲| ●精品国产综合乱码久久久久| 国内欧美视频一区二区| 7777精品伊人久久久大香线蕉超级流畅 | 日韩欧美一级精品久久| 一区二区三区四区在线播放| 国产久卡久卡久卡久卡视频精品| 欧美性高清videossexo| 亚洲欧洲日韩一区二区三区| 国产伦理精品不卡| 欧美一区二区精美| 亚洲成av人片一区二区三区| 99久久久精品免费观看国产蜜| 久久久国产一区二区三区四区小说| 日韩av中文在线观看| 欧美自拍偷拍一区| 亚洲人成人一区二区在线观看| 福利视频网站一区二区三区| 精品1区2区在线观看| 久久99精品一区二区三区| 91精选在线观看| 日韩成人一级片| 91精品国产综合久久精品麻豆| 亚洲一二三四区| 在线观看网站黄不卡| 亚洲免费av在线| 91视频国产观看| 亚洲男人的天堂在线观看| 成人激情动漫在线观看| 国产精品乱码久久久久久| 丁香激情综合五月| 中文字幕在线一区二区三区| 成人免费毛片aaaaa**| 中文字幕av一区二区三区免费看| 国产成人在线观看免费网站| 欧美精品一区二区不卡| 国产原创一区二区三区| 久久精品亚洲一区二区三区浴池| 韩国欧美国产一区| 国产精品少妇自拍| 99re在线精品| 亚洲福利电影网| 日韩欧美成人一区二区| 久久精品二区亚洲w码| 国产亚洲一区二区三区在线观看| 国产成人av福利| 亚洲视频免费在线观看| 91精品福利视频| 日产国产高清一区二区三区| 精品国产乱码久久久久久蜜臀| 国产在线观看免费一区| 国产精品美女www爽爽爽| 一本大道久久精品懂色aⅴ| 亚洲va欧美va人人爽午夜 | 久久久久久久电影| www.欧美.com| 亚洲成人一区二区在线观看| 日韩欧美国产一二三区| 成人视屏免费看| 五月天一区二区三区| 久久久久亚洲蜜桃| 在线视频中文字幕一区二区| 久久精品国产秦先生| 亚洲欧洲日韩女同|