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

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

?? stm32f10x_i2c.c

?? 基于STM32的 模擬時序
?? 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 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉加勒比综合久久| 精品国产一区二区三区久久久蜜月 | 一个色妞综合视频在线观看| 91一区一区三区| 午夜精品久久久久久久蜜桃app| 日韩视频一区二区三区| 国产成人精品免费网站| 亚洲一区二区三区四区在线免费观看| 欧美一级免费大片| zzijzzij亚洲日本少妇熟睡| 午夜精品国产更新| 久久日韩精品一区二区五区| 国产精品一二二区| 亚洲成av人片在www色猫咪| 欧美另类变人与禽xxxxx| 国产激情视频一区二区三区欧美| 一区二区三区在线免费观看| 久久综合九色综合欧美就去吻| 色综合久久久久久久久久久| 蜜桃精品视频在线| 一区二区三区中文字幕电影 | 日本黄色一区二区| 国产一区二区精品久久91| 一区二区三区中文字幕| 久久综合给合久久狠狠狠97色69| 欧美色图片你懂的| 91久久精品国产91性色tv | 日韩欧美不卡在线观看视频| 欧美三级韩国三级日本一级| 91偷拍与自偷拍精品| 成人黄动漫网站免费app| 国产精品自拍毛片| 国产乱一区二区| 国模娜娜一区二区三区| 老鸭窝一区二区久久精品| 日韩电影在线一区二区| 视频在线在亚洲| 视频一区欧美日韩| 日韩国产高清在线| 日韩精品亚洲一区| 青青草国产成人99久久| 日韩不卡一区二区三区| 日韩成人精品在线| 麻豆精品一区二区综合av| 免费高清在线一区| 看电视剧不卡顿的网站| 狂野欧美性猛交blacked| 精品亚洲成av人在线观看| 国产自产高清不卡| 成人午夜免费视频| 99re66热这里只有精品3直播| 91老师片黄在线观看| 色999日韩国产欧美一区二区| 亚洲人成精品久久久久| 精品视频123区在线观看| 99久久精品国产麻豆演员表| 国产麻豆9l精品三级站| 黄页视频在线91| 国产精品12区| 色成人在线视频| 欧美日韩精品一区二区三区 | 日韩激情视频网站| 亚洲欧美日韩在线| 亚洲综合色成人| 亚洲图片欧美色图| 国内成人免费视频| 国产成人欧美日韩在线电影 | 中文字幕国产一区| 亚洲日本欧美天堂| 婷婷久久综合九色综合绿巨人 | 亚洲在线视频免费观看| 日韩有码一区二区三区| 韩国精品主播一区二区在线观看 | 福利一区二区在线观看| av一二三不卡影片| 欧美剧情电影在线观看完整版免费励志电影 | 亚洲日本乱码在线观看| 亚洲成a人v欧美综合天堂| 国精品**一区二区三区在线蜜桃| av亚洲精华国产精华精华 | 日韩三级av在线播放| 欧美国产亚洲另类动漫| 亚洲自拍偷拍网站| 国产综合色视频| 在线观看不卡一区| 欧美精品一区二区三区蜜臀| 亚洲另类在线视频| 另类小说一区二区三区| 一本色道**综合亚洲精品蜜桃冫 | 久久综合国产精品| 亚洲免费资源在线播放| 国产在线精品免费| 欧美午夜电影在线播放| 国产欧美精品日韩区二区麻豆天美 | 精品剧情在线观看| 一区二区三区在线免费| 精品一区二区免费看| 色悠悠亚洲一区二区| 精品少妇一区二区三区免费观看| 一区二区三区欧美日韩| 国产精品亚洲专一区二区三区 | 夜夜嗨av一区二区三区网页| 国产成人精品www牛牛影视| 欧美日韩国产免费一区二区| 国产欧美日韩综合精品一区二区| 亚洲一级二级三级在线免费观看| 欧美高清激情brazzers| 中文字幕欧美区| 亚洲精品国久久99热| 国产精品白丝jk白祙喷水网站| 欧美日韩1234| 一区免费观看视频| 国产999精品久久| 欧美丰满少妇xxxbbb| 一区二区三区精品在线观看| 国产一区二区三区电影在线观看| 欧美精品久久99| 欧美日韩久久久一区| 亚洲视频你懂的| 粉嫩aⅴ一区二区三区四区 | 国产女同互慰高潮91漫画| 日韩av电影一区| 色94色欧美sute亚洲线路一久 | 在线观看国产91| 中文字幕视频一区二区三区久| 美女视频免费一区| 777精品伊人久久久久大香线蕉| 日本一区二区免费在线观看视频| 韩国精品免费视频| 欧美色区777第一页| 中文字幕日韩av资源站| 懂色av中文一区二区三区 | 东方欧美亚洲色图在线| 精品国产91洋老外米糕| 五月激情丁香一区二区三区| 欧美日韩aaa| 亚洲成人第一页| 欧美高清视频一二三区| 色综合久久66| 成人免费在线播放视频| 国产传媒欧美日韩成人| 精品sm捆绑视频| 久久精品国产亚洲a| 在线观看91视频| 亚洲精品日韩专区silk| 色94色欧美sute亚洲线路一ni| 国产精品国产三级国产普通话蜜臀 | 欧美精品一区二区精品网| 久久99精品久久久久久久久久久久| 91成人在线免费观看| 性久久久久久久久久久久| 欧美最新大片在线看| 亚洲精品视频自拍| 欧美伦理电影网| 日韩国产欧美在线观看| 日韩欧美的一区二区| 免费观看在线综合| 久久久久久久久一| 国产一区二区免费在线| 国产精品私人自拍| 色老汉av一区二区三区| 亚洲国产精品久久不卡毛片| 91精品国产综合久久婷婷香蕉| 丝袜国产日韩另类美女| 精品国产免费久久| 国产成人免费视频网站| 亚洲精品高清在线| 欧美三级蜜桃2在线观看| 韩国午夜理伦三级不卡影院| 中文子幕无线码一区tr| 色一区在线观看| 三级欧美在线一区| 久久亚洲综合色| 成人久久视频在线观看| 亚洲18女电影在线观看| 8x8x8国产精品| 国产福利一区二区三区视频在线| 久久久久国产成人精品亚洲午夜| 91蜜桃婷婷狠狠久久综合9色| 成人欧美一区二区三区小说| 91.com视频| 99国产精品久| 天堂在线亚洲视频| 亚洲国产成人一区二区三区| 91蝌蚪porny九色| 黑人精品欧美一区二区蜜桃| 中文字幕欧美日本乱码一线二线| 欧美日韩一区二区在线视频| 国产精品综合一区二区| 中文字幕一区二区在线播放| 欧美一级久久久久久久大片| 国产一区91精品张津瑜| 亚洲国产欧美一区二区三区丁香婷| 日韩三级视频中文字幕| 色天使色偷偷av一区二区| 老鸭窝一区二区久久精品| 国产精品乱码人人做人人爱 | 国产精品久久久久久久岛一牛影视 | 亚洲成人av电影| 中文字幕不卡的av|