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

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

?? stm32l1xx_i2c.c

?? VS1003_MP3_SPI_SDHC_FAT32
?? C
?? 第 1 頁 / 共 4 頁
字號:

/**
  * @}
  */

/** @defgroup I2C_Group3 PEC management functions
 *  @brief   PEC management functions 
 *
@verbatim
 ===============================================================================
                    ##### PEC management functions #####
 ===============================================================================

@endverbatim
  * @{
  */

/**
  * @brief  Enables or disables the specified I2C PEC transfer.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  NewState: new state of the I2C PEC transmission.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval 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 |= I2C_CR1_PEC;
  }
  else
  {
    /* Disable the selected I2C PEC transmission */
    I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_PEC);
  }
}

/**
  * @brief  Selects the specified I2C PEC position.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  I2C_PECPosition: specifies the PEC position. 
  *   This parameter can be one of the following values:
  *     @arg I2C_PECPosition_Next: indicates that the next byte is PEC
  *     @arg I2C_PECPosition_Current: indicates that current byte is PEC
  * @note    This function configures the same bit (POS) as I2C_NACKPositionConfig()
  *          but is intended to be used in SMBUS mode while I2C_NACKPositionConfig() 
  *          is intended to used in I2C mode.
  * @retval None
  */
void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, uint16_t 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;
  }
}

/**
  * @brief  Enables or disables the PEC value calculation of the transferred bytes.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  NewState: new state of the I2Cx PEC value calculation.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval 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 |= I2C_CR1_ENPEC;
  }
  else
  {
    /* Disable the selected I2C PEC calculation */
    I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_ENPEC);
  }
}

/**
  * @brief  Returns the PEC value for the specified I2C.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @retval The PEC value.
  */
uint8_t 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);
}

/**
  * @}
  */

/** @defgroup I2C_Group4 DMA transfers management functions
 *  @brief   DMA transfers management functions 
 *
@verbatim
 ===============================================================================
               ##### DMA transfers management functions #####
 ===============================================================================
  [..] This section provides functions allowing to configure the I2C DMA channels 
       requests.
@endverbatim
  * @{
  */

/**
  * @brief  Enables or disables the specified I2C DMA requests.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  NewState: new state of the I2C DMA transfer.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void I2C_DMACmd(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 DMA requests */
    I2Cx->CR2 |= I2C_CR2_DMAEN;
  }
  else
  {
    /* Disable the selected I2C DMA requests */
    I2Cx->CR2 &= (uint16_t)~((uint16_t)I2C_CR2_DMAEN);
  }
}

/**
  * @brief  Specifies that the next DMA transfer is the last one.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  NewState: new state of the I2C DMA last transfer.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval 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 |= I2C_CR2_LAST;
  }
  else
  {
    /* Next DMA transfer is not the last transfer */
    I2Cx->CR2 &= (uint16_t)~((uint16_t)I2C_CR2_LAST);
  }
}

/**
  * @}
  */

/** @defgroup I2C_Group5 Interrupts events and flags management functions
 *  @brief   Interrupts, events and flags management functions
 *
@verbatim
 ===============================================================================
        ##### Interrupts, events and flags management functions #####
 ===============================================================================
    [..] This section provides functions allowing to configure the I2C Interrupts 
         sources and check or clear the flags or pending bits status.
         The user should identify which mode will be used in his application to manage 
         the communication: Polling mode, Interrupt mode or DMA mode. 


                ##### I2C State Monitoring Functions #####
 ===============================================================================   
    [..]This I2C driver provides three different ways for I2C state monitoring
        depending on the application requirements and constraints:
         
   
     ***. Basic state monitoring (Using I2C_CheckEvent() function) ***
     -----------------------------------------------------------------
    [..]It compares the status registers (SR1 and SR2) content to a given event
        (can be the combination of one or more flags).
        It returns SUCCESS if the current status includes the given flags 
        and returns ERROR if one or more flags are missing in the current status.

    (+) When to use
        (++) This function is suitable for most applications as well as for 
             startup activity since the events are fully described in the product 
             reference manual (RM0038).
        (++) It is also suitable for users who need to define their own events.
    (+) Limitations
        (++) If an error occurs (ie. error flags are set besides to the monitored 
             flags), the I2C_CheckEvent() function may return SUCCESS despite 
             the communication hold or corrupted real state. 
             In this case, it is advised to use error interrupts to monitor 
             the error events and handle them in the interrupt IRQ handler.
        -@@- For error management, it is advised to use the following functions:
             (+@@) I2C_ITConfig() to configure and enable the error interrupts 
                   (I2C_IT_ERR).
             (+@@) I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
                   Where x is the peripheral instance (I2C1, I2C2 ...).
             (+@@) I2C_GetFlagStatus() or I2C_GetITStatus()  to be called into the
                   I2Cx_ER_IRQHandler() function in order to determine which error occurred.
             (+@@) I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
                   and/or I2C_GenerateStop() in order to clear the error flag and source
                   and return to correct  communication status.

     *** Advanced state monitoring (Using the function I2C_GetLastEvent()) ***
     ------------------------------------------------------------------------- 
    [..] Using the function I2C_GetLastEvent() which returns the image of both status 
        registers in a single word (uint32_t) (Status Register 2 value is shifted left 
        by 16 bits and concatenated to Status Register 1).

    (+) When to use
       (++) This function is suitable for the same applications above but it 
            allows to overcome the mentioned limitation of I2C_GetFlagStatus() 
            function.
       (++) The returned value could be compared to events already defined in 
            the library (stm32l1xx_i2c.h) or to custom values defined by user.
            This function is suitable when multiple flags are monitored at the 
            same time.
       (++) At the opposite of I2C_CheckEvent() function, this function allows 
            user to choose when an event is accepted (when all events flags are 
            set and no other flags are set or just when the needed flags are set 
            like I2C_CheckEvent() function.

     (+) Limitations
         (++) User may need to define his own events.
         (++) Same remark concerning the error management is applicable for this 
              function if user decides to check only regular communication flags 
              (and ignores error flags).
      
 
    *** Flag-based state monitoring (Using the function I2C_GetFlagStatus()) ***
    ----------------------------------------------------------------------------
    [..] Using the function I2C_GetFlagStatus() which simply returns the status of 
         one single flag (ie. I2C_FLAG_RXNE ...).
         (+) When to use
             (++) This function could be used for specific applications or in debug 
                  phase.
             (++) It is suitable when only one flag checking is needed (most I2C 
                  events are monitored through multiple flags).
         (+) Limitations: 
             (++) When calling this function, the Status register is accessed. 
                  Some flags are cleared when the status register is accessed. 
                  So checking the status of one Flag, may clear other ones.
             (++) Function may need to be called twice or more in order to monitor 
                  one single event.
 
    [..] For detailed description of Events, please refer to section I2C_Events in 
         stm32l1xx_i2c.h file.

@endverbatim
  * @{
  */
   
/**
  * @brief  Reads the specified I2C register and returns its value.
  * @param  I2C_Register: specifies the register to read.
  *   This parameter can be one of the following values:
  *     @arg I2C_Register_CR1:  CR1 register.
  *     @arg I2C_Register_CR2:   CR2 register.
  *     @arg I2C_Register_OAR1:  OAR1 register.
  *     @arg I2C_Register_OAR2:  OAR2 register.
  *     @arg I2C_Register_DR:    DR register.
  *     @arg I2C_Register_SR1:   SR1 register.
  *     @arg I2C_Register_SR2:   SR2 register.
  *     @arg I2C_Register_CCR:   CCR register.
  *     @arg I2C_Register_TRISE: TRISE register.
  * @retval The value of the read register.
  */
uint16_t I2C_ReadRegister(I2C_TypeDef* I2Cx, uint8_t I2C_Register)
{
  __IO uint32_t tmp = 0;

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

  tmp = (uint32_t) I2Cx;
  tmp += I2C_Register;

  /* Return the selected register value */
  return (*(__IO uint16_t *) tmp);
}

/**
  * @brief  Enables or disables the specified I2C interrupts.
  * @param  I2Cx: where x can be 1 or 2 to select the I2C peripheral.
  * @param  I2C_IT: specifies the I2C interrupts sources to be enabled or disabled. 
  *   This parameter can be any combination of the following values:
  *     @arg I2C_IT_BUF: Buffer interrupt mask
  *     @arg I2C_IT_EVT: Event interrupt mask
  *     @arg I2C_IT_ERR: Error interrupt mask
  * @param  NewState: new state of the specified I2C interrupts.
  *   This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void I2C_ITConfig(I2C_TypeDef* I2Cx, uint16_t 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 &= (uint16_t)~I2C_IT;
  }
}

/*
 ===============================================================================
                          1. Basic state monitoring                     
 ===============================================================================
 */

/**

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品无圣光一区二区| 日韩欧美亚洲国产精品字幕久久久 | 亚洲精品免费电影| 国产精品高潮久久久久无| 国产精品女主播av| 国产精品久久久久久久久搜平片| 久久精品一区二区三区四区| 国产农村妇女毛片精品久久麻豆 | 国产一区福利在线| 国产精品77777| 国产超碰在线一区| 色狠狠色噜噜噜综合网| 在线观看一区日韩| 久久综合资源网| 久久精品无码一区二区三区| 国产精品国产a级| 亚洲欧美一区二区三区极速播放 | 欧美日韩www| 日韩一区二区三区视频| 久久久国产一区二区三区四区小说| 久久麻豆一区二区| 亚洲欧美日韩在线| 麻豆一区二区99久久久久| 国产69精品久久久久777| 91麻豆精东视频| 欧美一区二区三区色| 国产精品免费免费| 午夜欧美一区二区三区在线播放| 精品一区二区三区香蕉蜜桃| 成人免费视频app| 欧美喷水一区二区| 国产精品私人影院| 五月婷婷激情综合网| 国产成人av电影免费在线观看| 色av成人天堂桃色av| 精品久久五月天| 亚洲综合丝袜美腿| 成人免费视频网站在线观看| 欧美久久久影院| 国产精品福利一区二区三区| 蜜臀国产一区二区三区在线播放| 成人自拍视频在线| 日韩免费在线观看| 亚洲欧美一区二区不卡| 韩国成人精品a∨在线观看| 色婷婷精品大在线视频| 国产三级一区二区三区| 人人精品人人爱| 色乱码一区二区三区88| 久久精品免费在线观看| 日韩精品91亚洲二区在线观看| av日韩在线网站| 国产亚洲女人久久久久毛片| 日本成人在线网站| 欧美曰成人黄网| 中文字幕亚洲区| 国产精品资源网| 日韩一级二级三级精品视频| 亚洲国产一区在线观看| 91在线小视频| 国产精品久久一级| 成人丝袜高跟foot| 国产日产欧美一区二区三区| 精品在线观看免费| 日韩精品一区二区三区老鸭窝| 亚洲成av人在线观看| 日本久久一区二区三区| 中文字幕亚洲一区二区va在线| 国产白丝网站精品污在线入口| 欧美电影免费观看完整版| 石原莉奈一区二区三区在线观看| 欧美影片第一页| 亚洲最新在线观看| 欧美三级韩国三级日本一级| 亚洲自拍偷拍欧美| 欧美三级日韩三级| 午夜精品福利一区二区三区蜜桃| 在线观看视频一区| 图片区小说区国产精品视频| 欧美日韩国产另类不卡| 久久精品国产99久久6| 欧美r级电影在线观看| 国产在线视频一区二区| 久久精品一区二区三区av| 国产成人精品亚洲777人妖| 中文字幕免费不卡| 色呦呦网站一区| 午夜久久久久久电影| 欧美二区三区的天堂| 美女爽到高潮91| 久久久综合九色合综国产精品| 国产精品资源在线看| 中文字幕欧美一区| 欧美日韩中文国产| 毛片av一区二区| 国产精品久久久久四虎| 在线视频欧美区| 久久国产福利国产秒拍| 中文字幕在线视频一区| 精品视频在线免费观看| 另类小说视频一区二区| 日本一二三不卡| 欧美日韩成人综合天天影院| 久久国产精品72免费观看| 久久综合精品国产一区二区三区| 成人福利视频网站| 青椒成人免费视频| 国产精品成人免费| 欧美一区二区三区视频在线| 高清国产一区二区三区| 亚洲成av人片一区二区| 中文字幕电影一区| 91精品国产91久久久久久一区二区| 国产成人福利片| 天使萌一区二区三区免费观看| 国产精品午夜久久| 7777精品伊人久久久大香线蕉超级流畅 | 视频一区中文字幕| 国产精品天干天干在线综合| 8v天堂国产在线一区二区| caoporm超碰国产精品| 午夜av电影一区| 亚洲色图丝袜美腿| 久久久欧美精品sm网站| 欧美日韩黄色一区二区| 99精品热视频| 丁香激情综合国产| 久久91精品国产91久久小草| 亚洲一区二区在线观看视频| 国产精品美女久久久久久久久| 日韩精品一区二区三区三区免费| 欧洲一区二区三区在线| 成人黄色片在线观看| 黄页网站大全一区二区| 日韩av网站免费在线| 亚洲大片精品永久免费| 中文字幕乱码日本亚洲一区二区| 日韩欧美国产三级| 欧美一卡二卡在线观看| 欧美亚洲一区二区在线观看| 91在线你懂得| 99精品视频在线免费观看| 不卡av电影在线播放| eeuss鲁片一区二区三区| 成人av在线一区二区三区| 成人性生交大片免费看中文| 国产成人免费xxxxxxxx| 国产风韵犹存在线视精品| 国产一区日韩二区欧美三区| 韩国一区二区三区| 国产精品亚洲а∨天堂免在线| 国产在线播精品第三| 国产成人综合亚洲91猫咪| 国产乱国产乱300精品| 国产传媒欧美日韩成人| 99久久久无码国产精品| 91美女视频网站| 欧美日韩一区精品| 欧美精品在线观看一区二区| 6080亚洲精品一区二区| 日韩欧美亚洲另类制服综合在线| 精品国产91乱码一区二区三区| 精品国产乱码久久久久久久久| 久久你懂得1024| 国产精品久久三| 一区二区三区在线高清| 亚洲高清免费一级二级三级| 日韩成人一级大片| 国产福利一区二区三区视频在线| 丁香六月综合激情| 欧美日韩免费一区二区三区视频 | 国产成人精品免费| 91美女在线看| 欧美一区二区三区视频在线观看 | 久久久综合精品| 亚洲精品免费播放| 久久99久久99小草精品免视看| 精品一区二区久久久| 国产99久久久精品| 欧美午夜影院一区| www国产成人免费观看视频 深夜成人网| 久久久久久久综合| 亚洲综合久久久| 国产一区二区三区视频在线播放| yourporn久久国产精品| 欧洲一区在线电影| 久久久久久**毛片大全| 亚洲一区二区av在线| 日韩精品乱码av一区二区| 精品一区二区精品| 91成人免费网站| 久久久久国产一区二区三区四区| 一区二区欧美视频| 国产精品亚洲人在线观看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 日韩欧美色综合| 亚洲另类在线制服丝袜| 国产精品一区久久久久| 欧美电影在哪看比较好| 亚洲免费伊人电影|