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

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

?? stm32f10x_i2c.c

?? 基于STM32的數碼相冊.rar
?? 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一区二区三区免费野_久草精品视频
国产一区二区三区四| 亚洲欧美综合网| 三级不卡在线观看| 56国语精品自产拍在线观看| 日本午夜精品视频在线观看 | 国产麻豆91精品| 精品久久国产老人久久综合| 国产乱妇无码大片在线观看| 中文字幕 久热精品 视频在线| 91网上在线视频| 亚洲va国产va欧美va观看| 欧美一区二区三区免费在线看| 精品一区二区三区久久| 欧美国产激情二区三区| 日本久久一区二区| 天天色综合成人网| 久久青草国产手机看片福利盒子| 不卡视频一二三四| 亚洲1区2区3区4区| 欧美不卡一区二区| 色综合天天综合给合国产| 日韩高清电影一区| 中文字幕巨乱亚洲| 3d动漫精品啪啪| 成人妖精视频yjsp地址| 日韩国产精品久久久| 国产精品伦理一区二区| 91精品国产综合久久精品app| 国产一区高清在线| 亚洲狼人国产精品| 26uuu亚洲综合色| 欧美午夜片在线看| 国产成人免费av在线| 五月婷婷激情综合网| 国产欧美一区二区三区网站| 欧美日韩精品电影| www.日韩av| 国模少妇一区二区三区| 性做久久久久久久久| 国产日韩欧美亚洲| 91精品国产综合久久香蕉的特点| 成人晚上爱看视频| 久久精品国产精品亚洲精品| 亚洲免费观看高清完整版在线观看| 欧美大片免费久久精品三p| 91老师片黄在线观看| 国产精品亚洲午夜一区二区三区| 亚洲国产精品自拍| 日韩理论片在线| 国产亚洲一二三区| 日韩网站在线看片你懂的| 91福利社在线观看| av在线播放不卡| 国产69精品久久久久777| 蜜臀99久久精品久久久久久软件| 亚洲一线二线三线视频| 18成人在线观看| 中文字幕欧美国产| 久久日一线二线三线suv| 91精品国产综合久久久蜜臀粉嫩 | 亚洲v日本v欧美v久久精品| 中文字幕五月欧美| 日本一区二区免费在线观看视频| 久久毛片高清国产| 欧美r级在线观看| 日韩精品一区二区三区在线播放| 欧美精品1区2区| 在线观看日韩一区| 91麻豆swag| 日本道精品一区二区三区| 成av人片一区二区| 不卡一区二区中文字幕| 成人性生交大片免费看在线播放| 国产成人aaa| 成人综合婷婷国产精品久久蜜臀 | 狠狠色2019综合网| 精品中文字幕一区二区| 韩国毛片一区二区三区| 国产一区二区网址| 国产一区二区精品久久| 国产美女娇喘av呻吟久久 | 成人18精品视频| 成人激情综合网站| 99国产精品久久久久久久久久久| av在线不卡电影| 日本道精品一区二区三区 | 91在线小视频| 色综合久久精品| 在线观看免费视频综合| 欧美日韩成人在线一区| 久久久久久影视| 久久久一区二区三区捆绑**| 国产午夜精品久久| 亚洲欧洲日韩av| 一区二区三区在线免费视频| 亚洲国产视频一区| 美女视频一区二区| 风间由美一区二区av101| 99久久久精品| 欧美日韩精品电影| 精品国产乱码久久久久久闺蜜 | 欧美国产激情一区二区三区蜜月| 国产精品私人自拍| 亚洲高清免费视频| 另类调教123区| 成人精品电影在线观看| 欧美三级电影一区| 久久青草欧美一区二区三区| 亚洲精品久久嫩草网站秘色| 琪琪一区二区三区| 成人动漫一区二区在线| 欧美日韩日日摸| 久久精品亚洲麻豆av一区二区| 最近中文字幕一区二区三区| 视频一区在线视频| 丁香天五香天堂综合| 欧美日韩夫妻久久| 国产精品久久久一本精品| 日韩av在线播放中文字幕| 成人国产在线观看| 日韩一区二区三区四区五区六区| 欧美激情一区二区三区全黄| 午夜av一区二区| 成人黄动漫网站免费app| 日韩午夜在线播放| 亚洲免费av网站| 狠狠色丁香婷婷综合| 欧美日韩一区二区在线观看视频 | 国产日韩成人精品| 亚洲一级二级三级在线免费观看| 国产精品18久久久久久久网站| 欧美性一二三区| 国产精品三级av| 国内不卡的二区三区中文字幕| 欧美日韩午夜精品| 国产精品二区一区二区aⅴ污介绍| 麻豆成人av在线| 欧美日本乱大交xxxxx| 日韩毛片在线免费观看| 国产美女在线精品| 日韩欧美一区二区视频| 亚洲一二三四在线观看| 成人美女视频在线看| 久久色视频免费观看| 久久激五月天综合精品| 欧美日韩1234| 日本va欧美va精品发布| 色久综合一二码| 国产精品二区一区二区aⅴ污介绍| 久久精品国产一区二区| 3d动漫精品啪啪| 亚洲成人动漫在线免费观看| 在线免费观看日韩欧美| 亚洲免费在线观看| 91日韩一区二区三区| 日韩一区中文字幕| av成人免费在线观看| 国产精品久久久久久户外露出| 国产米奇在线777精品观看| 久久亚洲捆绑美女| 国产资源在线一区| 久久久另类综合| 国产精品99久久久久久有的能看| 久久久久亚洲综合| 福利视频网站一区二区三区| 久久久青草青青国产亚洲免观| 国内精品免费**视频| 久久精品视频一区二区三区| 国产一区二区三区四区五区美女| 久久久美女毛片| 国产成人精品免费一区二区| 国产日韩欧美电影| 成人免费视频免费观看| 一区在线中文字幕| 色婷婷综合久久久久中文 | 欧美一区中文字幕| 日韩av不卡在线观看| 精品欧美乱码久久久久久1区2区| 久久er99热精品一区二区| ww亚洲ww在线观看国产| 国产一区二区91| 国产精品久久久久久久第一福利| 99精品久久久久久| 亚洲国产日韩精品| 91精品一区二区三区久久久久久| 久久精品国产99| 国产清纯白嫩初高生在线观看91 | 中文字幕一区二区三区在线观看 | 亚洲欧洲日韩综合一区二区| 色域天天综合网| 图片区日韩欧美亚洲| 久久久亚洲综合| 91久久一区二区| 免费高清在线视频一区·| 久久久久久电影| 在线免费观看日韩欧美| 激情综合五月婷婷| 国产精品不卡视频| 欧美电影一区二区三区| 国产成人亚洲精品狼色在线|