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

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

?? stm32f10x_i2c.c

?? 基于Cortex-M3的STM32的IAR EWARM的工程模塊
?? C
?? 第 1 頁 / 共 3 頁
字號:
    /* Peripheral under reset */
    I2Cx->CR1 |= CR1_SWRST_Set;
  }
  else
  {
    /* Peripheral not under reset */
    I2Cx->CR1 &= CR1_SWRST_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_SMBusAlertConfig
* Description    : Drives the SMBusAlert pin high or low for the specified I2C.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_SMBusAlert: specifies SMBAlert pin level. 
*                    This parameter can be one of the following values:
*                       - I2C_SMBusAlert_Low: SMBAlert pin driven low
*                       - I2C_SMBusAlert_High: SMBAlert pin driven high
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, u16 I2C_SMBusAlert)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_I2C_SMBUS_ALERT(I2C_SMBusAlert));

  if (I2C_SMBusAlert == I2C_SMBusAlert_Low)
  {
    /* Drive the SMBusAlert pin Low */
    I2Cx->CR1 |= I2C_SMBusAlert_Low;
  }
  else
  {
    /* Drive the SMBusAlert pin High  */
    I2Cx->CR1 &= I2C_SMBusAlert_High;
  }
}

/*******************************************************************************
* Function Name  : I2C_TransmitPEC
* Description    : Enables or disables the specified I2C PEC transfer.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2C PEC transmission.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_TransmitPEC(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 selected I2C PEC transmission */
    I2Cx->CR1 |= CR1_PEC_Set;
  }
  else
  {
    /* Disable the selected I2C PEC transmission */
    I2Cx->CR1 &= CR1_PEC_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_PECPositionConfig
* Description    : Selects the specified I2C PEC position.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_PECPosition: specifies the PEC position. 
*                    This parameter can be one of the following values:
*                       - I2C_PECPosition_Next: indicates that the next
*                         byte is PEC
*                       - I2C_PECPosition_Current: indicates that current
*                         byte is PEC
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, u16 I2C_PECPosition)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_I2C_PEC_POSITION(I2C_PECPosition));

  if (I2C_PECPosition == I2C_PECPosition_Next)
  {
    /* Next byte in shift register is PEC */
    I2Cx->CR1 |= I2C_PECPosition_Next;
  }
  else
  {
    /* Current byte in shift register is PEC */
    I2Cx->CR1 &= I2C_PECPosition_Current;
  }
}

/*******************************************************************************
* Function Name  : I2C_CalculatePEC
* Description    : Enables or disables the PEC value calculation of the
*                  transfered bytes.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2Cx PEC value calculation.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_CalculatePEC(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 selected I2C PEC calculation */
    I2Cx->CR1 |= CR1_ENPEC_Set;
  }
  else
  {
    /* Disable the selected I2C PEC calculation */
    I2Cx->CR1 &= CR1_ENPEC_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_GetPEC
* Description    : Returns the PEC value for the specified I2C.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output         : None
* Return         : The PEC value.
*******************************************************************************/
u8 I2C_GetPEC(I2C_TypeDef* I2Cx)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));

  /* Return the selected I2C PEC value */
  return ((I2Cx->SR2) >> 8);
}

/*******************************************************************************
* Function Name  : I2C_ARPCmd
* Description    : Enables or disables the specified I2C ARP.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2Cx ARP. 
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_ARPCmd(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 selected I2C ARP */
    I2Cx->CR1 |= CR1_ENARP_Set;
  }
  else
  {
    /* Disable the selected I2C ARP */
    I2Cx->CR1 &= CR1_ENARP_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_StretchClockCmd
* Description    : Enables or disables the specified I2C Clock stretching.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - NewState: new state of the I2Cx Clock stretching.
*                    This parameter can be: ENABLE or DISABLE.
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_StretchClockCmd(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 selected I2C Clock stretching */
    I2Cx->CR1 |= CR1_NOSTRETCH_Set;
  }
  else
  {
    /* Disable the selected I2C Clock stretching */
    I2Cx->CR1 &= CR1_NOSTRETCH_Reset;
  }
}

/*******************************************************************************
* Function Name  : I2C_FastModeDutyCycleConfig
* Description    : Selects the specified I2C fast mode duty cycle.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_DutyCycle: specifies the fast mode duty cycle.
*                    This parameter can be one of the following values:
*                       - I2C_DutyCycle_2: I2C fast mode Tlow/Thigh = 2
*                       - I2C_DutyCycle_16_9: I2C fast mode Tlow/Thigh = 16/9
* Output         : None
* Return         : None
*******************************************************************************/
void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, u16 I2C_DutyCycle)
{
  /* Check the parameters */
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_I2C_DUTY_CYCLE(I2C_DutyCycle));

  if (I2C_DutyCycle != I2C_DutyCycle_16_9)
  {
    /* I2C fast mode Tlow/Thigh=2 */
    I2Cx->CCR &= I2C_DutyCycle_2;
  }
  else
  {
    /* I2C fast mode Tlow/Thigh=16/9 */
    I2Cx->CCR |= I2C_DutyCycle_16_9;
  }
}

/*******************************************************************************
* Function Name  : I2C_GetLastEvent
* Description    : Returns the last I2Cx Event.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output         : None
* Return         : The last event
*******************************************************************************/
u32 I2C_GetLastEvent(I2C_TypeDef* I2Cx)
{
  u32 lastevent = 0;
  u32 flag1 = 0, flag2 = 0;

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

  /* Read the I2Cx status register */
  flag1 = I2Cx->SR1;
  flag2 = I2Cx->SR2;
  flag2 = flag2 << 16;

  /* Get the last event value from I2C status register */
  lastevent = (flag1 | flag2) & FLAG_Mask;

  /* Return status */
  return lastevent;
}

/*******************************************************************************
* Function Name  : I2C_CheckEvent
* Description    : Checks whether the last I2Cx Event is equal to the one passed
*                  as parameter.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_EVENT: specifies the event to be checked. 
*                    This parameter can be one of the following values:
*                       - I2C_EVENT_SLAVE_ADDRESS_MATCHED   : EV1
*                       - I2C_EVENT_SLAVE_BYTE_RECEIVED     : EV2
*                       - I2C_EVENT_SLAVE_BYTE_TRANSMITTED  : EV3
*                       - I2C_EVENT_SLAVE_ACK_FAILURE       : EV3-2
*                       - I2C_EVENT_MASTER_MODE_SELECT      : EV5
*                       - I2C_EVENT_MASTER_MODE_SELECTED    : EV6
*                       - I2C_EVENT_MASTER_BYTE_RECEIVED    : EV7
*                       - I2C_EVENT_MASTER_BYTE_TRANSMITTED : EV8
*                       - I2C_EVENT_MASTER_MODE_ADDRESS10   : EV9
*                       - I2C_EVENT_SLAVE_STOP_DETECTED     : EV4
* Output         : None
* Return         : An ErrorStatus enumuration value:
*                       - SUCCESS: Last event is equal to the I2C_EVENT
*                       - ERROR: Last event is different from the I2C_EVENT
*******************************************************************************/
ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, u32 I2C_EVENT)
{
  u32 lastevent = 0;
  u32 flag1 = 0, flag2 = 0;
  ErrorStatus status = ERROR;

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

  /* Read the I2Cx status register */
  flag1 = I2Cx->SR1;
  flag2 = I2Cx->SR2;
  flag2 = flag2 << 16;

  /* Get the last event value from I2C status register */
  lastevent = (flag1 | flag2) & FLAG_Mask;

  /* Check whether the last event is equal to I2C_EVENT */
  if (lastevent == I2C_EVENT )
  {
    /* SUCCESS: last event is equal to I2C_EVENT */
    status = SUCCESS;
  }
  else
  {
    /* ERROR: last event is different from I2C_EVENT */
    status = ERROR;
  }

  /* Return status */
  return status;
}

/*******************************************************************************
* Function Name  : I2C_GetFlagStatus
* Description    : Checks whether the specified I2C flag is set or not.
* Input          : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
*                  - I2C_FLAG: specifies the flag to check. 
*                    This parameter can be one of the following values:
*                       - I2C_FLAG_DUALF: Dual flag (Slave mode)
*                       - I2C_FLAG_SMBHOST: SMBus host header (Slave mode)
*                       - I2C_FLAG_SMBDEFAULT: SMBus default header (Slave mode)
*                       - I2C_FLAG_GENCALL: General call header flag (Slave mode)
*                       - I2C_FLAG_TRA: Transmitter/Receiver flag
*                       - I2C_FLAG_BUSY: Bus busy flag
*                       - I2C_FLAG_MSL: Master/Slave flag
*                       - I2C_FLAG_SMBALERT: SMBus Alert flag
*                       - I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
*                       - I2C_FLAG_PECERR: PEC error in reception flag
*                       - I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
*                       - I2C_FLAG_AF: Acknowledge failure flag
*                       - I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
*                       - I2C_FLAG_BERR: Bus error flag
*                       - I2C_FLAG_TXE: Data register empty flag (Transmitter)
*                       - I2C_FLAG_RXNE: Data register not empty (Receiver) flag
*                       - I2C_FLAG_STOPF: Stop detection flag (Slave mode)
*                       - I2C_FLAG_ADD10: 10-bit header sent flag (Master mode)
*                       - I2C_FLAG_BTF: Byte transfer finished flag
*                       - I2C_FLAG_ADDR: Address sent flag (Master mode) 揂DSL

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区免费播放| 欧美日韩国产区一| 91在线观看地址| 欧美一个色资源| 亚洲自拍偷拍综合| 福利一区二区在线| 日韩精品一区二区在线观看| 亚洲精品欧美专区| 国产成人亚洲精品青草天美 | 精品国产99国产精品| 久久电影网电视剧免费观看| 91猫先生在线| 中文一区二区在线观看| 免费欧美日韩国产三级电影| 欧美日韩精品一区二区天天拍小说| 中文子幕无线码一区tr| 狠狠色丁香婷婷综合| 91精品啪在线观看国产60岁| 亚洲天堂中文字幕| 成人国产精品免费观看| 久久久www成人免费无遮挡大片| 日韩激情视频网站| 欧美日韩极品在线观看一区| 一区二区三区自拍| 色婷婷综合久色| 亚洲欧美中日韩| av男人天堂一区| 国产精品热久久久久夜色精品三区 | 五月天丁香久久| 欧美偷拍一区二区| 一区二区三区不卡在线观看 | 亚洲激情中文1区| 色美美综合视频| 亚洲美女视频一区| 欧美视频自拍偷拍| 亚洲福利电影网| 4438x亚洲最大成人网| 日韩影院在线观看| 欧美一区二区在线播放| 免费欧美高清视频| 26uuu另类欧美| 成人午夜免费视频| 国产精品成人一区二区艾草 | www.日韩大片| 一区二区三区四区亚洲| 欧美午夜精品一区二区蜜桃| 日精品一区二区| 久久亚洲二区三区| 成人app在线观看| 一区二区三区国产| 日韩一级片网址| 国产成人精品影院| 亚洲欧美日韩一区二区三区在线观看 | 欧美一级久久久| 日本不卡在线视频| 久久久久高清精品| 成年人午夜久久久| 丝袜美腿亚洲一区二区图片| 欧美tk—视频vk| 99在线视频精品| 婷婷开心激情综合| 久久久久久久久一| 色婷婷精品大在线视频| 免费在线观看视频一区| 国产精品无码永久免费888| 色婷婷激情久久| 成人av电影免费在线播放| 一二三四区精品视频| 精品盗摄一区二区三区| 色综合天天综合在线视频| 日本亚洲三级在线| 国产精品国产三级国产| 日韩视频在线永久播放| 懂色av一区二区三区免费看| 亚洲精品一二三区| 久久婷婷一区二区三区| 91福利精品第一导航| 精品无人码麻豆乱码1区2区| 亚洲最色的网站| 久久久精品综合| 制服丝袜av成人在线看| 99久久99久久精品国产片果冻 | 亚洲在线一区二区三区| 精品国产乱码久久久久久久 | 国产亚洲精品中文字幕| 欧美午夜一区二区三区| 成人精品一区二区三区四区| 午夜精品久久一牛影视| 亚洲欧洲国产日本综合| 欧美精品一区二区三区蜜臀| 欧美日韩亚洲国产综合| www.欧美精品一二区| 国产精品一区二区三区网站| 偷窥少妇高潮呻吟av久久免费| 欧美激情一二三区| 精品久久国产老人久久综合| 欧美乱熟臀69xxxxxx| 91麻豆国产福利精品| 成人av电影免费在线播放| 国产一区二区三区四区五区入口 | 26uuu国产一区二区三区| 在线免费观看成人短视频| 粉嫩久久99精品久久久久久夜| 蜜臂av日日欢夜夜爽一区| 亚洲高清免费观看高清完整版在线观看| 国产精品美女久久久久久久久久久 | 在线不卡一区二区| 欧美三级电影精品| 在线免费不卡视频| 欧美伊人久久大香线蕉综合69| 91丨porny丨国产| 91色视频在线| 一本到一区二区三区| 不卡av电影在线播放| 成人免费av在线| 不卡视频在线观看| 成人福利电影精品一区二区在线观看| 国产精品1区2区| 国产不卡高清在线观看视频| 国产乱理伦片在线观看夜一区| 国产精品中文字幕欧美| 国产成人午夜电影网| 成人一二三区视频| 不卡的av在线播放| 91丝袜高跟美女视频| 91毛片在线观看| 欧美日产国产精品| 日韩欧美一区二区久久婷婷| 26uuu精品一区二区| 久久精品夜夜夜夜久久| 国产精品久久久久永久免费观看| 日韩久久一区二区| 亚洲自拍欧美精品| 日韩影院免费视频| 国产精品资源在线看| gogo大胆日本视频一区| 在线观看精品一区| 91精品国产综合久久久久久久久久| 欧美一区二区网站| 国产日韩高清在线| 亚洲免费观看高清完整版在线观看| 亚洲综合在线第一页| 日本不卡免费在线视频| 高清久久久久久| 一本久久综合亚洲鲁鲁五月天| 911精品国产一区二区在线| 2023国产精品| 亚洲一区二区三区四区在线免费观看| 日本成人在线视频网站| 国产精品99久久久久久似苏梦涵| 91网站最新地址| 日韩精品最新网址| 亚洲色欲色欲www| 久久精品国产99| 色猫猫国产区一区二在线视频| 日韩西西人体444www| 国产精品午夜春色av| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人综合在线视频| 欧美精品第1页| 中文久久乱码一区二区| 日韩精品每日更新| 99国产精品99久久久久久| 日韩欧美国产综合在线一区二区三区| 亚洲视频一二三区| 国产一区二区伦理片| 日韩欧美国产综合在线一区二区三区| 日本一区二区三区dvd视频在线| 亚洲成av人片在线| 99久久精品免费精品国产| 精品播放一区二区| 亚欧色一区w666天堂| 91浏览器入口在线观看| 久久久久久亚洲综合| 麻豆精品在线视频| 日本精品视频一区二区三区| 欧美激情在线免费观看| 麻豆成人av在线| 欧美日韩精品一区视频| 亚洲免费在线电影| 91在线观看美女| 中文字幕一区二区三中文字幕| 国产在线精品不卡| 欧美成人伊人久久综合网| 三级久久三级久久久| 欧美系列日韩一区| 亚洲精品国产一区二区精华液| 成人免费精品视频| 国产欧美一区二区三区在线看蜜臀 | 美日韩黄色大片| 欧美丰满一区二区免费视频| 亚洲一区在线视频| 色综合网站在线| 一区二区在线看| 欧美亚洲尤物久久| 一区二区三区电影在线播| 欧洲一区在线电影| 亚瑟在线精品视频| 7777精品伊人久久久大香线蕉最新版 | 国模无码大尺度一区二区三区|