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

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

?? stm32f10x_i2c.c

?? STM32不完全手冊 例程源碼 29個
?? 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)
  {
    /* Peripheral under reset */
    I2Cx->CR1 |= CR1_SWRST_Set;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩专区中文字幕一区二区| 成人av网站在线观看免费| 韩国精品久久久| 91在线视频播放地址| 欧美成人一区二区三区片免费| 国产精品剧情在线亚洲| 九九视频精品免费| 欧美视频在线播放| 亚洲少妇最新在线视频| 国产一区二区导航在线播放| 欧美伦理视频网站| 一区二区三区在线看| 99国产精品视频免费观看| 久久久精品免费网站| 日本欧美一区二区三区| 欧美午夜免费电影| 亚洲激情图片一区| 91亚洲精品久久久蜜桃| 中文字幕欧美日韩一区| 国产一区二区看久久| 精品国产sm最大网站| 日韩成人一区二区| 欧美一区二区在线观看| 亚洲一区二区三区影院| 91黄视频在线| 亚洲精品视频在线观看网站| a亚洲天堂av| 中文字幕一区二区三区四区不卡 | 国产盗摄精品一区二区三区在线| 3d成人h动漫网站入口| 亚洲成人av在线电影| 欧美日韩三级一区二区| 亚洲综合一区二区三区| 精品视频免费在线| 日产精品久久久久久久性色| 欧美一区二区三区的| 日韩avvvv在线播放| 日韩三级.com| 国产一区二区不卡在线| 久久精品亚洲精品国产欧美kt∨| 高清国产一区二区| 中文字幕一区二区三| 91美女视频网站| 亚洲国产成人av网| 日韩欧美高清在线| 国产成人在线视频网站| 最新日韩在线视频| 欧美偷拍一区二区| 久久超碰97中文字幕| 久久久久久久久蜜桃| 北条麻妃一区二区三区| 亚洲黄色小视频| 欧美另类z0zxhd电影| 麻豆91在线播放| 国产精品久久久久久久裸模| 欧美网站大全在线观看| 九九久久精品视频| 亚洲精品免费播放| 日韩一级高清毛片| 成人自拍视频在线观看| 亚洲精品久久嫩草网站秘色| 欧美电影免费观看完整版| 成人理论电影网| 午夜av区久久| 国产精品久线在线观看| 欧美久久久久久久久中文字幕| 国产一级精品在线| 亚洲一区电影777| 精品国产3级a| 欧美日韩免费观看一区二区三区| 老汉av免费一区二区三区 | www.在线欧美| 毛片不卡一区二区| 亚洲欧美另类图片小说| 精品少妇一区二区三区在线视频| 成人高清视频在线观看| 久久国产精品第一页| 亚洲男帅同性gay1069| 久久久久久久精| 91精品欧美一区二区三区综合在 | 国产欧美精品一区aⅴ影院| 欧美综合视频在线观看| 国产成人超碰人人澡人人澡| 日韩一区欧美二区| 17c精品麻豆一区二区免费| 精品对白一区国产伦| 欧美日韩高清在线播放| 一本大道久久a久久综合婷婷| 国产在线一区二区综合免费视频| 亚洲午夜影视影院在线观看| 国产精品久久久久久久久久久免费看 | 欧美在线free| 白白色亚洲国产精品| 国产一区二区精品久久91| 视频一区在线播放| 亚洲综合网站在线观看| 亚洲视频中文字幕| 国产精品久久国产精麻豆99网站| 精品久久久久久久久久久久久久久| 欧美人妇做爰xxxⅹ性高电影 | 国产91精品一区二区麻豆亚洲| 日韩精品成人一区二区三区 | 亚洲天堂免费在线观看视频| 国产欧美va欧美不卡在线| 26uuu成人网一区二区三区| 欧美一区二区福利在线| 欧美一区二区三区在线| 91精品婷婷国产综合久久性色| 欧美另类久久久品| 欧美精品日韩精品| 日韩亚洲欧美一区| 日韩免费一区二区三区在线播放| 欧美日本精品一区二区三区| 欧美久久久久久蜜桃| 欧美日韩国产一级片| 欧美日本一区二区| 日韩欧美在线123| 精品999久久久| 国产欧美精品日韩区二区麻豆天美| 国产日产精品1区| 中文字幕一区二区三区不卡 | 国产欧美一区二区精品性| 国产日产欧美一区| 最新不卡av在线| 一区二区国产视频| 亚洲va中文字幕| 美腿丝袜一区二区三区| 国产一区二区在线观看视频| 国产精品一级黄| 99re热这里只有精品视频| 欧美探花视频资源| 欧美xxxxxxxx| 国产精品乱码人人做人人爱| 综合久久久久综合| 亚洲va欧美va国产va天堂影院| 亚洲国产欧美一区二区三区丁香婷| 日韩av电影天堂| 丁香亚洲综合激情啪啪综合| 色呦呦网站一区| 日韩一区二区免费电影| 国产欧美日韩综合| 一区二区三区视频在线看| 日本强好片久久久久久aaa| 粉嫩一区二区三区性色av| 91久久一区二区| 日韩三级精品电影久久久| 国产精品国产三级国产有无不卡 | 日韩欧美激情一区| 中文字幕一区二区三区四区不卡| 石原莉奈在线亚洲三区| 国产精品18久久久久久久网站| 日本黄色一区二区| 久久久久久久久免费| 亚洲电影欧美电影有声小说| 国产精品一区二区在线看| 欧美最新大片在线看| 2021中文字幕一区亚洲| 亚洲精品免费在线观看| 国产真实乱对白精彩久久| 欧美系列日韩一区| 欧美韩日一区二区三区四区| 日韩一区精品字幕| 日本精品视频一区二区| 久久中文娱乐网| 免费观看成人鲁鲁鲁鲁鲁视频| 91日韩一区二区三区| 久久九九全国免费| 日韩av网站免费在线| 99riav久久精品riav| 精品1区2区在线观看| 五月婷婷综合激情| 欧美亚洲综合另类| 国产精品久久久久久妇女6080| 久久99国产乱子伦精品免费| 欧美日韩国产精选| 综合久久久久久久| 成人国产精品免费网站| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲成av人综合在线观看| 99久久夜色精品国产网站| 日韩欧美一二三四区| 亚洲v精品v日韩v欧美v专区| 在线看一区二区| 专区另类欧美日韩| 成人黄色片在线观看| 精品久久一区二区三区| 日韩**一区毛片| 欧美日韩大陆在线| 午夜激情综合网| 在线观看不卡视频| 一区二区三区国产精华| 色香色香欲天天天影视综合网| 国产精品午夜春色av| 岛国精品在线观看| 日本一区二区久久| 精品一区二区免费| 日韩免费看网站| 奇米影视7777精品一区二区| 在线播放视频一区| 亚洲一区二区三区四区五区黄|