STM32L443xx HAL User Manual
stm32l4xx_ll_i2c.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_ll_i2c.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of I2C LL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32L4xx_LL_I2C_H
00021 #define STM32L4xx_LL_I2C_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32l4xx.h"
00029 
00030 /** @addtogroup STM32L4xx_LL_Driver
00031   * @{
00032   */
00033 
00034 #if defined (I2C1) || defined (I2C2) || defined (I2C3) || defined (I2C4)
00035 
00036 /** @defgroup I2C_LL I2C
00037   * @{
00038   */
00039 
00040 /* Private types -------------------------------------------------------------*/
00041 /* Private variables ---------------------------------------------------------*/
00042 
00043 /* Private constants ---------------------------------------------------------*/
00044 /** @defgroup I2C_LL_Private_Constants I2C Private Constants
00045   * @{
00046   */
00047 /**
00048   * @}
00049   */
00050 
00051 /* Private macros ------------------------------------------------------------*/
00052 #if defined(USE_FULL_LL_DRIVER)
00053 /** @defgroup I2C_LL_Private_Macros I2C Private Macros
00054   * @{
00055   */
00056 /**
00057   * @}
00058   */
00059 #endif /*USE_FULL_LL_DRIVER*/
00060 
00061 /* Exported types ------------------------------------------------------------*/
00062 #if defined(USE_FULL_LL_DRIVER)
00063 /** @defgroup I2C_LL_ES_INIT I2C Exported Init structure
00064   * @{
00065   */
00066 typedef struct
00067 {
00068   uint32_t PeripheralMode;      /*!< Specifies the peripheral mode.
00069                                      This parameter can be a value of @ref I2C_LL_EC_PERIPHERAL_MODE.
00070 
00071                                      This feature can be modified afterwards using unitary function
00072                                      @ref LL_I2C_SetMode(). */
00073 
00074   uint32_t Timing;              /*!< Specifies the SDA setup, hold time and the SCL high, low period values.
00075                                      This parameter must be set by referring to the STM32CubeMX Tool and
00076                                      the helper macro @ref __LL_I2C_CONVERT_TIMINGS().
00077 
00078                                      This feature can be modified afterwards using unitary function
00079                                      @ref LL_I2C_SetTiming(). */
00080 
00081   uint32_t AnalogFilter;        /*!< Enables or disables analog noise filter.
00082                                      This parameter can be a value of @ref I2C_LL_EC_ANALOGFILTER_SELECTION.
00083 
00084                                      This feature can be modified afterwards using unitary functions
00085                                      @ref LL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter(). */
00086 
00087   uint32_t DigitalFilter;       /*!< Configures the digital noise filter.
00088                                      This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F.
00089 
00090                                      This feature can be modified afterwards using unitary function
00091                                      @ref LL_I2C_SetDigitalFilter(). */
00092 
00093   uint32_t OwnAddress1;         /*!< Specifies the device own address 1.
00094                                      This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF.
00095 
00096                                      This feature can be modified afterwards using unitary function
00097                                      @ref LL_I2C_SetOwnAddress1(). */
00098 
00099   uint32_t TypeAcknowledge;     /*!< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive
00100                                      match code or next received byte.
00101                                      This parameter can be a value of @ref I2C_LL_EC_I2C_ACKNOWLEDGE.
00102 
00103                                      This feature can be modified afterwards using unitary function
00104                                      @ref LL_I2C_AcknowledgeNextData(). */
00105 
00106   uint32_t OwnAddrSize;         /*!< Specifies the device own address 1 size (7-bit or 10-bit).
00107                                      This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1.
00108 
00109                                      This feature can be modified afterwards using unitary function
00110                                      @ref LL_I2C_SetOwnAddress1(). */
00111 } LL_I2C_InitTypeDef;
00112 /**
00113   * @}
00114   */
00115 #endif /*USE_FULL_LL_DRIVER*/
00116 
00117 /* Exported constants --------------------------------------------------------*/
00118 /** @defgroup I2C_LL_Exported_Constants I2C Exported Constants
00119   * @{
00120   */
00121 
00122 /** @defgroup I2C_LL_EC_CLEAR_FLAG Clear Flags Defines
00123   * @brief    Flags defines which can be used with LL_I2C_WriteReg function
00124   * @{
00125   */
00126 #define LL_I2C_ICR_ADDRCF                   I2C_ICR_ADDRCF          /*!< Address Matched flag   */
00127 #define LL_I2C_ICR_NACKCF                   I2C_ICR_NACKCF          /*!< Not Acknowledge flag   */
00128 #define LL_I2C_ICR_STOPCF                   I2C_ICR_STOPCF          /*!< Stop detection flag    */
00129 #define LL_I2C_ICR_BERRCF                   I2C_ICR_BERRCF          /*!< Bus error flag         */
00130 #define LL_I2C_ICR_ARLOCF                   I2C_ICR_ARLOCF          /*!< Arbitration Lost flag  */
00131 #define LL_I2C_ICR_OVRCF                    I2C_ICR_OVRCF           /*!< Overrun/Underrun flag  */
00132 #define LL_I2C_ICR_PECCF                    I2C_ICR_PECCF           /*!< PEC error flag         */
00133 #define LL_I2C_ICR_TIMOUTCF                 I2C_ICR_TIMOUTCF        /*!< Timeout detection flag */
00134 #define LL_I2C_ICR_ALERTCF                  I2C_ICR_ALERTCF         /*!< Alert flag             */
00135 /**
00136   * @}
00137   */
00138 
00139 /** @defgroup I2C_LL_EC_GET_FLAG Get Flags Defines
00140   * @brief    Flags defines which can be used with LL_I2C_ReadReg function
00141   * @{
00142   */
00143 #define LL_I2C_ISR_TXE                      I2C_ISR_TXE             /*!< Transmit data register empty        */
00144 #define LL_I2C_ISR_TXIS                     I2C_ISR_TXIS            /*!< Transmit interrupt status           */
00145 #define LL_I2C_ISR_RXNE                     I2C_ISR_RXNE            /*!< Receive data register not empty     */
00146 #define LL_I2C_ISR_ADDR                     I2C_ISR_ADDR            /*!< Address matched (slave mode)        */
00147 #define LL_I2C_ISR_NACKF                    I2C_ISR_NACKF           /*!< Not Acknowledge received flag       */
00148 #define LL_I2C_ISR_STOPF                    I2C_ISR_STOPF           /*!< Stop detection flag                 */
00149 #define LL_I2C_ISR_TC                       I2C_ISR_TC              /*!< Transfer Complete (master mode)     */
00150 #define LL_I2C_ISR_TCR                      I2C_ISR_TCR             /*!< Transfer Complete Reload            */
00151 #define LL_I2C_ISR_BERR                     I2C_ISR_BERR            /*!< Bus error                           */
00152 #define LL_I2C_ISR_ARLO                     I2C_ISR_ARLO            /*!< Arbitration lost                    */
00153 #define LL_I2C_ISR_OVR                      I2C_ISR_OVR             /*!< Overrun/Underrun (slave mode)       */
00154 #define LL_I2C_ISR_PECERR                   I2C_ISR_PECERR          /*!< PEC Error in reception (SMBus mode) */
00155 #define LL_I2C_ISR_TIMEOUT                  I2C_ISR_TIMEOUT         /*!< Timeout detection flag (SMBus mode) */
00156 #define LL_I2C_ISR_ALERT                    I2C_ISR_ALERT           /*!< SMBus alert (SMBus mode)            */
00157 #define LL_I2C_ISR_BUSY                     I2C_ISR_BUSY            /*!< Bus busy                            */
00158 /**
00159   * @}
00160   */
00161 
00162 /** @defgroup I2C_LL_EC_IT IT Defines
00163   * @brief    IT defines which can be used with LL_I2C_ReadReg and  LL_I2C_WriteReg functions
00164   * @{
00165   */
00166 #define LL_I2C_CR1_TXIE                     I2C_CR1_TXIE            /*!< TX Interrupt enable                         */
00167 #define LL_I2C_CR1_RXIE                     I2C_CR1_RXIE            /*!< RX Interrupt enable                         */
00168 #define LL_I2C_CR1_ADDRIE                   I2C_CR1_ADDRIE          /*!< Address match Interrupt enable (slave only) */
00169 #define LL_I2C_CR1_NACKIE                   I2C_CR1_NACKIE          /*!< Not acknowledge received Interrupt enable   */
00170 #define LL_I2C_CR1_STOPIE                   I2C_CR1_STOPIE          /*!< STOP detection Interrupt enable             */
00171 #define LL_I2C_CR1_TCIE                     I2C_CR1_TCIE            /*!< Transfer Complete interrupt enable          */
00172 #define LL_I2C_CR1_ERRIE                    I2C_CR1_ERRIE           /*!< Error interrupts enable                     */
00173 /**
00174   * @}
00175   */
00176 
00177 /** @defgroup I2C_LL_EC_PERIPHERAL_MODE Peripheral Mode
00178   * @{
00179   */
00180 #define LL_I2C_MODE_I2C                    0x00000000U              /*!< I2C Master or Slave mode                 */
00181 #define LL_I2C_MODE_SMBUS_HOST             I2C_CR1_SMBHEN           /*!< SMBus Host address acknowledge           */
00182 #define LL_I2C_MODE_SMBUS_DEVICE           0x00000000U              /*!< SMBus Device default mode
00183                                                                          (Default address not acknowledge)        */
00184 #define LL_I2C_MODE_SMBUS_DEVICE_ARP       I2C_CR1_SMBDEN           /*!< SMBus Device Default address acknowledge */
00185 /**
00186   * @}
00187   */
00188 
00189 /** @defgroup I2C_LL_EC_ANALOGFILTER_SELECTION Analog Filter Selection
00190   * @{
00191   */
00192 #define LL_I2C_ANALOGFILTER_ENABLE          0x00000000U             /*!< Analog filter is enabled.  */
00193 #define LL_I2C_ANALOGFILTER_DISABLE         I2C_CR1_ANFOFF          /*!< Analog filter is disabled. */
00194 /**
00195   * @}
00196   */
00197 
00198 /** @defgroup I2C_LL_EC_ADDRESSING_MODE Master Addressing Mode
00199   * @{
00200   */
00201 #define LL_I2C_ADDRESSING_MODE_7BIT         0x00000000U              /*!< Master operates in 7-bit addressing mode. */
00202 #define LL_I2C_ADDRESSING_MODE_10BIT        I2C_CR2_ADD10            /*!< Master operates in 10-bit addressing mode.*/
00203 /**
00204   * @}
00205   */
00206 
00207 /** @defgroup I2C_LL_EC_OWNADDRESS1 Own Address 1 Length
00208   * @{
00209   */
00210 #define LL_I2C_OWNADDRESS1_7BIT             0x00000000U             /*!< Own address 1 is a 7-bit address. */
00211 #define LL_I2C_OWNADDRESS1_10BIT            I2C_OAR1_OA1MODE        /*!< Own address 1 is a 10-bit address.*/
00212 /**
00213   * @}
00214   */
00215 
00216 /** @defgroup I2C_LL_EC_OWNADDRESS2 Own Address 2 Masks
00217   * @{
00218   */
00219 #define LL_I2C_OWNADDRESS2_NOMASK           I2C_OAR2_OA2NOMASK      /*!< Own Address2 No mask.                 */
00220 #define LL_I2C_OWNADDRESS2_MASK01           I2C_OAR2_OA2MASK01      /*!< Only Address2 bits[7:2] are compared. */
00221 #define LL_I2C_OWNADDRESS2_MASK02           I2C_OAR2_OA2MASK02      /*!< Only Address2 bits[7:3] are compared. */
00222 #define LL_I2C_OWNADDRESS2_MASK03           I2C_OAR2_OA2MASK03      /*!< Only Address2 bits[7:4] are compared. */
00223 #define LL_I2C_OWNADDRESS2_MASK04           I2C_OAR2_OA2MASK04      /*!< Only Address2 bits[7:5] are compared. */
00224 #define LL_I2C_OWNADDRESS2_MASK05           I2C_OAR2_OA2MASK05      /*!< Only Address2 bits[7:6] are compared. */
00225 #define LL_I2C_OWNADDRESS2_MASK06           I2C_OAR2_OA2MASK06      /*!< Only Address2 bits[7] are compared.   */
00226 #define LL_I2C_OWNADDRESS2_MASK07           I2C_OAR2_OA2MASK07      /*!< No comparison is done.
00227                                                                          All Address2 are acknowledged.        */
00228 /**
00229   * @}
00230   */
00231 
00232 /** @defgroup I2C_LL_EC_I2C_ACKNOWLEDGE Acknowledge Generation
00233   * @{
00234   */
00235 #define LL_I2C_ACK                          0x00000000U              /*!< ACK is sent after current received byte. */
00236 #define LL_I2C_NACK                         I2C_CR2_NACK             /*!< NACK is sent after current received byte.*/
00237 /**
00238   * @}
00239   */
00240 
00241 /** @defgroup I2C_LL_EC_ADDRSLAVE Slave Address Length
00242   * @{
00243   */
00244 #define LL_I2C_ADDRSLAVE_7BIT               0x00000000U              /*!< Slave Address in 7-bit. */
00245 #define LL_I2C_ADDRSLAVE_10BIT              I2C_CR2_ADD10            /*!< Slave Address in 10-bit.*/
00246 /**
00247   * @}
00248   */
00249 
00250 /** @defgroup I2C_LL_EC_REQUEST Transfer Request Direction
00251   * @{
00252   */
00253 #define LL_I2C_REQUEST_WRITE                0x00000000U              /*!< Master request a write transfer. */
00254 #define LL_I2C_REQUEST_READ                 I2C_CR2_RD_WRN           /*!< Master request a read transfer.  */
00255 /**
00256   * @}
00257   */
00258 
00259 /** @defgroup I2C_LL_EC_MODE Transfer End Mode
00260   * @{
00261   */
00262 #define LL_I2C_MODE_RELOAD                  I2C_CR2_RELOAD           /*!< Enable I2C Reload mode.     */
00263 #define LL_I2C_MODE_AUTOEND                 I2C_CR2_AUTOEND          /*!< Enable I2C Automatic end mode
00264                                                                           with no HW PEC comparison.  */
00265 #define LL_I2C_MODE_SOFTEND                 0x00000000U              /*!< Enable I2C Software end mode
00266                                                                           with no HW PEC comparison.  */
00267 #define LL_I2C_MODE_SMBUS_RELOAD            LL_I2C_MODE_RELOAD       /*!< Enable SMBUS Automatic end mode
00268                                                                           with HW PEC comparison.     */
00269 #define LL_I2C_MODE_SMBUS_AUTOEND_NO_PEC    LL_I2C_MODE_AUTOEND      /*!< Enable SMBUS Automatic end mode
00270                                                                           with HW PEC comparison.     */
00271 #define LL_I2C_MODE_SMBUS_SOFTEND_NO_PEC    LL_I2C_MODE_SOFTEND      /*!< Enable SMBUS Software end mode
00272                                                                           with HW PEC comparison.     */
00273 #define LL_I2C_MODE_SMBUS_AUTOEND_WITH_PEC  (uint32_t)(LL_I2C_MODE_AUTOEND | I2C_CR2_PECBYTE)
00274 /*!< Enable SMBUS Automatic end mode with HW PEC comparison.   */
00275 #define LL_I2C_MODE_SMBUS_SOFTEND_WITH_PEC  (uint32_t)(LL_I2C_MODE_SOFTEND | I2C_CR2_PECBYTE)
00276 /*!< Enable SMBUS Software end mode with HW PEC comparison.    */
00277 /**
00278   * @}
00279   */
00280 
00281 /** @defgroup I2C_LL_EC_GENERATE Start And Stop Generation
00282   * @{
00283   */
00284 #define LL_I2C_GENERATE_NOSTARTSTOP         0x00000000U
00285 /*!< Don't Generate Stop and Start condition. */
00286 #define LL_I2C_GENERATE_STOP                (uint32_t)(0x80000000U | I2C_CR2_STOP)
00287 /*!< Generate Stop condition (Size should be set to 0).      */
00288 #define LL_I2C_GENERATE_START_READ          (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN)
00289 /*!< Generate Start for read request. */
00290 #define LL_I2C_GENERATE_START_WRITE         (uint32_t)(0x80000000U | I2C_CR2_START)
00291 /*!< Generate Start for write request. */
00292 #define LL_I2C_GENERATE_RESTART_7BIT_READ   (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN)
00293 /*!< Generate Restart for read request, slave 7Bit address.  */
00294 #define LL_I2C_GENERATE_RESTART_7BIT_WRITE  (uint32_t)(0x80000000U | I2C_CR2_START)
00295 /*!< Generate Restart for write request, slave 7Bit address. */
00296 #define LL_I2C_GENERATE_RESTART_10BIT_READ  (uint32_t)(0x80000000U | I2C_CR2_START | \
00297                                                        I2C_CR2_RD_WRN | I2C_CR2_HEAD10R)
00298 /*!< Generate Restart for read request, slave 10Bit address. */
00299 #define LL_I2C_GENERATE_RESTART_10BIT_WRITE (uint32_t)(0x80000000U | I2C_CR2_START)
00300 /*!< Generate Restart for write request, slave 10Bit address.*/
00301 /**
00302   * @}
00303   */
00304 
00305 /** @defgroup I2C_LL_EC_DIRECTION Read Write Direction
00306   * @{
00307   */
00308 #define LL_I2C_DIRECTION_WRITE              0x00000000U              /*!< Write transfer request by master,
00309                                                                           slave enters receiver mode.  */
00310 #define LL_I2C_DIRECTION_READ               I2C_ISR_DIR              /*!< Read transfer request by master,
00311                                                                           slave enters transmitter mode.*/
00312 /**
00313   * @}
00314   */
00315 
00316 /** @defgroup I2C_LL_EC_DMA_REG_DATA DMA Register Data
00317   * @{
00318   */
00319 #define LL_I2C_DMA_REG_DATA_TRANSMIT        0x00000000U              /*!< Get address of data register used for
00320                                                                           transmission */
00321 #define LL_I2C_DMA_REG_DATA_RECEIVE         0x00000001U              /*!< Get address of data register used for
00322                                                                           reception */
00323 /**
00324   * @}
00325   */
00326 
00327 /** @defgroup I2C_LL_EC_SMBUS_TIMEOUTA_MODE SMBus TimeoutA Mode SCL SDA Timeout
00328   * @{
00329   */
00330 #define LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW      0x00000000U          /*!< TimeoutA is used to detect
00331                                                                           SCL low level timeout.              */
00332 #define LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH I2C_TIMEOUTR_TIDLE   /*!< TimeoutA is used to detect
00333                                                                           both SCL and SDA high level timeout.*/
00334 /**
00335   * @}
00336   */
00337 
00338 /** @defgroup I2C_LL_EC_SMBUS_TIMEOUT_SELECTION SMBus Timeout Selection
00339   * @{
00340   */
00341 #define LL_I2C_SMBUS_TIMEOUTA               I2C_TIMEOUTR_TIMOUTEN                 /*!< TimeoutA enable bit          */
00342 #define LL_I2C_SMBUS_TIMEOUTB               I2C_TIMEOUTR_TEXTEN                   /*!< TimeoutB (extended clock)
00343                                                                                        enable bit                   */
00344 #define LL_I2C_SMBUS_ALL_TIMEOUT            (uint32_t)(I2C_TIMEOUTR_TIMOUTEN | \
00345                                                        I2C_TIMEOUTR_TEXTEN)       /*!< TimeoutA and TimeoutB
00346 (extended clock) enable bits */
00347 /**
00348   * @}
00349   */
00350 
00351 /**
00352   * @}
00353   */
00354 
00355 /* Exported macro ------------------------------------------------------------*/
00356 /** @defgroup I2C_LL_Exported_Macros I2C Exported Macros
00357   * @{
00358   */
00359 
00360 /** @defgroup I2C_LL_EM_WRITE_READ Common Write and read registers Macros
00361   * @{
00362   */
00363 
00364 /**
00365   * @brief  Write a value in I2C register
00366   * @param  __INSTANCE__ I2C Instance
00367   * @param  __REG__ Register to be written
00368   * @param  __VALUE__ Value to be written in the register
00369   * @retval None
00370   */
00371 #define LL_I2C_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
00372 
00373 /**
00374   * @brief  Read a value in I2C register
00375   * @param  __INSTANCE__ I2C Instance
00376   * @param  __REG__ Register to be read
00377   * @retval Register value
00378   */
00379 #define LL_I2C_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
00380 /**
00381   * @}
00382   */
00383 
00384 /** @defgroup I2C_LL_EM_CONVERT_TIMINGS Convert SDA SCL timings
00385   * @{
00386   */
00387 /**
00388   * @brief  Configure the SDA setup, hold time and the SCL high, low period.
00389   * @param  __PRESCALER__ This parameter must be a value between  Min_Data=0 and Max_Data=0xF.
00390   * @param  __SETUP_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF.
00391                            (tscldel = (SCLDEL+1)xtpresc)
00392   * @param  __HOLD_TIME__  This parameter must be a value between Min_Data=0 and Max_Data=0xF.
00393                            (tsdadel = SDADELxtpresc)
00394   * @param  __SCLH_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF.
00395                             (tsclh = (SCLH+1)xtpresc)
00396   * @param  __SCLL_PERIOD__ This parameter must be a value between  Min_Data=0 and Max_Data=0xFF.
00397                             (tscll = (SCLL+1)xtpresc)
00398   * @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF
00399   */
00400 #define __LL_I2C_CONVERT_TIMINGS(__PRESCALER__, __SETUP_TIME__, __HOLD_TIME__, __SCLH_PERIOD__, __SCLL_PERIOD__) \
00401   ((((uint32_t)(__PRESCALER__)    << I2C_TIMINGR_PRESC_Pos)  & I2C_TIMINGR_PRESC)   | \
00402    (((uint32_t)(__SETUP_TIME__)   << I2C_TIMINGR_SCLDEL_Pos) & I2C_TIMINGR_SCLDEL)  | \
00403    (((uint32_t)(__HOLD_TIME__)    << I2C_TIMINGR_SDADEL_Pos) & I2C_TIMINGR_SDADEL)  | \
00404    (((uint32_t)(__SCLH_PERIOD__)  << I2C_TIMINGR_SCLH_Pos)   & I2C_TIMINGR_SCLH)    | \
00405    (((uint32_t)(__SCLL_PERIOD__)  << I2C_TIMINGR_SCLL_Pos)   & I2C_TIMINGR_SCLL))
00406 /**
00407   * @}
00408   */
00409 
00410 /**
00411   * @}
00412   */
00413 
00414 /* Exported functions --------------------------------------------------------*/
00415 /** @defgroup I2C_LL_Exported_Functions I2C Exported Functions
00416   * @{
00417   */
00418 
00419 /** @defgroup I2C_LL_EF_Configuration Configuration
00420   * @{
00421   */
00422 
00423 /**
00424   * @brief  Enable I2C peripheral (PE = 1).
00425   * @rmtoll CR1          PE            LL_I2C_Enable
00426   * @param  I2Cx I2C Instance.
00427   * @retval None
00428   */
00429 __STATIC_INLINE void LL_I2C_Enable(I2C_TypeDef *I2Cx)
00430 {
00431   SET_BIT(I2Cx->CR1, I2C_CR1_PE);
00432 }
00433 
00434 /**
00435   * @brief  Disable I2C peripheral (PE = 0).
00436   * @note   When PE = 0, the I2C SCL and SDA lines are released.
00437   *         Internal state machines and status bits are put back to their reset value.
00438   *         When cleared, PE must be kept low for at least 3 APB clock cycles.
00439   * @rmtoll CR1          PE            LL_I2C_Disable
00440   * @param  I2Cx I2C Instance.
00441   * @retval None
00442   */
00443 __STATIC_INLINE void LL_I2C_Disable(I2C_TypeDef *I2Cx)
00444 {
00445   CLEAR_BIT(I2Cx->CR1, I2C_CR1_PE);
00446 }
00447 
00448 /**
00449   * @brief  Check if the I2C peripheral is enabled or disabled.
00450   * @rmtoll CR1          PE            LL_I2C_IsEnabled
00451   * @param  I2Cx I2C Instance.
00452   * @retval State of bit (1 or 0).
00453   */
00454 __STATIC_INLINE uint32_t LL_I2C_IsEnabled(I2C_TypeDef *I2Cx)
00455 {
00456   return ((READ_BIT(I2Cx->CR1, I2C_CR1_PE) == (I2C_CR1_PE)) ? 1UL : 0UL);
00457 }
00458 
00459 /**
00460   * @brief  Configure Noise Filters (Analog and Digital).
00461   * @note   If the analog filter is also enabled, the digital filter is added to analog filter.
00462   *         The filters can only be programmed when the I2C is disabled (PE = 0).
00463   * @rmtoll CR1          ANFOFF        LL_I2C_ConfigFilters\n
00464   *         CR1          DNF           LL_I2C_ConfigFilters
00465   * @param  I2Cx I2C Instance.
00466   * @param  AnalogFilter This parameter can be one of the following values:
00467   *         @arg @ref LL_I2C_ANALOGFILTER_ENABLE
00468   *         @arg @ref LL_I2C_ANALOGFILTER_DISABLE
00469   * @param  DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled)
00470                           and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk).
00471   *         This parameter is used to configure the digital noise filter on SDA and SCL input.
00472   *         The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk.
00473   * @retval None
00474   */
00475 __STATIC_INLINE void LL_I2C_ConfigFilters(I2C_TypeDef *I2Cx, uint32_t AnalogFilter, uint32_t DigitalFilter)
00476 {
00477   MODIFY_REG(I2Cx->CR1, I2C_CR1_ANFOFF | I2C_CR1_DNF, AnalogFilter | (DigitalFilter << I2C_CR1_DNF_Pos));
00478 }
00479 
00480 /**
00481   * @brief  Configure Digital Noise Filter.
00482   * @note   If the analog filter is also enabled, the digital filter is added to analog filter.
00483   *         This filter can only be programmed when the I2C is disabled (PE = 0).
00484   * @rmtoll CR1          DNF           LL_I2C_SetDigitalFilter
00485   * @param  I2Cx I2C Instance.
00486   * @param  DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled)
00487                           and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk).
00488   *         This parameter is used to configure the digital noise filter on SDA and SCL input.
00489   *         The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk.
00490   * @retval None
00491   */
00492 __STATIC_INLINE void LL_I2C_SetDigitalFilter(I2C_TypeDef *I2Cx, uint32_t DigitalFilter)
00493 {
00494   MODIFY_REG(I2Cx->CR1, I2C_CR1_DNF, DigitalFilter << I2C_CR1_DNF_Pos);
00495 }
00496 
00497 /**
00498   * @brief  Get the current Digital Noise Filter configuration.
00499   * @rmtoll CR1          DNF           LL_I2C_GetDigitalFilter
00500   * @param  I2Cx I2C Instance.
00501   * @retval Value between Min_Data=0x0 and Max_Data=0xF
00502   */
00503 __STATIC_INLINE uint32_t LL_I2C_GetDigitalFilter(I2C_TypeDef *I2Cx)
00504 {
00505   return (uint32_t)(READ_BIT(I2Cx->CR1, I2C_CR1_DNF) >> I2C_CR1_DNF_Pos);
00506 }
00507 
00508 /**
00509   * @brief  Enable Analog Noise Filter.
00510   * @note   This filter can only be programmed when the I2C is disabled (PE = 0).
00511   * @rmtoll CR1          ANFOFF        LL_I2C_EnableAnalogFilter
00512   * @param  I2Cx I2C Instance.
00513   * @retval None
00514   */
00515 __STATIC_INLINE void LL_I2C_EnableAnalogFilter(I2C_TypeDef *I2Cx)
00516 {
00517   CLEAR_BIT(I2Cx->CR1, I2C_CR1_ANFOFF);
00518 }
00519 
00520 /**
00521   * @brief  Disable Analog Noise Filter.
00522   * @note   This filter can only be programmed when the I2C is disabled (PE = 0).
00523   * @rmtoll CR1          ANFOFF        LL_I2C_DisableAnalogFilter
00524   * @param  I2Cx I2C Instance.
00525   * @retval None
00526   */
00527 __STATIC_INLINE void LL_I2C_DisableAnalogFilter(I2C_TypeDef *I2Cx)
00528 {
00529   SET_BIT(I2Cx->CR1, I2C_CR1_ANFOFF);
00530 }
00531 
00532 /**
00533   * @brief  Check if Analog Noise Filter is enabled or disabled.
00534   * @rmtoll CR1          ANFOFF        LL_I2C_IsEnabledAnalogFilter
00535   * @param  I2Cx I2C Instance.
00536   * @retval State of bit (1 or 0).
00537   */
00538 __STATIC_INLINE uint32_t LL_I2C_IsEnabledAnalogFilter(I2C_TypeDef *I2Cx)
00539 {
00540   return ((READ_BIT(I2Cx->CR1, I2C_CR1_ANFOFF) != (I2C_CR1_ANFOFF)) ? 1UL : 0UL);
00541 }
00542 
00543 /**
00544   * @brief  Enable DMA transmission requests.
00545   * @rmtoll CR1          TXDMAEN       LL_I2C_EnableDMAReq_TX
00546   * @param  I2Cx I2C Instance.
00547   * @retval None
00548   */
00549 __STATIC_INLINE void LL_I2C_EnableDMAReq_TX(I2C_TypeDef *I2Cx)
00550 {
00551   SET_BIT(I2Cx->CR1, I2C_CR1_TXDMAEN);
00552 }
00553 
00554 /**
00555   * @brief  Disable DMA transmission requests.
00556   * @rmtoll CR1          TXDMAEN       LL_I2C_DisableDMAReq_TX
00557   * @param  I2Cx I2C Instance.
00558   * @retval None
00559   */
00560 __STATIC_INLINE void LL_I2C_DisableDMAReq_TX(I2C_TypeDef *I2Cx)
00561 {
00562   CLEAR_BIT(I2Cx->CR1, I2C_CR1_TXDMAEN);
00563 }
00564 
00565 /**
00566   * @brief  Check if DMA transmission requests are enabled or disabled.
00567   * @rmtoll CR1          TXDMAEN       LL_I2C_IsEnabledDMAReq_TX
00568   * @param  I2Cx I2C Instance.
00569   * @retval State of bit (1 or 0).
00570   */
00571 __STATIC_INLINE uint32_t LL_I2C_IsEnabledDMAReq_TX(I2C_TypeDef *I2Cx)
00572 {
00573   return ((READ_BIT(I2Cx->CR1, I2C_CR1_TXDMAEN) == (I2C_CR1_TXDMAEN)) ? 1UL : 0UL);
00574 }
00575 
00576 /**
00577   * @brief  Enable DMA reception requests.
00578   * @rmtoll CR1          RXDMAEN       LL_I2C_EnableDMAReq_RX
00579   * @param  I2Cx I2C Instance.
00580   * @retval None
00581   */
00582 __STATIC_INLINE void LL_I2C_EnableDMAReq_RX(I2C_TypeDef *I2Cx)
00583 {
00584   SET_BIT(I2Cx->CR1, I2C_CR1_RXDMAEN);
00585 }
00586 
00587 /**
00588   * @brief  Disable DMA reception requests.
00589   * @rmtoll CR1          RXDMAEN       LL_I2C_DisableDMAReq_RX
00590   * @param  I2Cx I2C Instance.
00591   * @retval None
00592   */
00593 __STATIC_INLINE void LL_I2C_DisableDMAReq_RX(I2C_TypeDef *I2Cx)
00594 {
00595   CLEAR_BIT(I2Cx->CR1, I2C_CR1_RXDMAEN);
00596 }
00597 
00598 /**
00599   * @brief  Check if DMA reception requests are enabled or disabled.
00600   * @rmtoll CR1          RXDMAEN       LL_I2C_IsEnabledDMAReq_RX
00601   * @param  I2Cx I2C Instance.
00602   * @retval State of bit (1 or 0).
00603   */
00604 __STATIC_INLINE uint32_t LL_I2C_IsEnabledDMAReq_RX(I2C_TypeDef *I2Cx)
00605 {
00606   return ((READ_BIT(I2Cx->CR1, I2C_CR1_RXDMAEN) == (I2C_CR1_RXDMAEN)) ? 1UL : 0UL);
00607 }
00608 
00609 /**
00610   * @brief  Get the data register address used for DMA transfer
00611   * @rmtoll TXDR         TXDATA        LL_I2C_DMA_GetRegAddr\n
00612   *         RXDR         RXDATA        LL_I2C_DMA_GetRegAddr
00613   * @param  I2Cx I2C Instance
00614   * @param  Direction This parameter can be one of the following values:
00615   *         @arg @ref LL_I2C_DMA_REG_DATA_TRANSMIT
00616   *         @arg @ref LL_I2C_DMA_REG_DATA_RECEIVE
00617   * @retval Address of data register
00618   */
00619 __STATIC_INLINE uint32_t LL_I2C_DMA_GetRegAddr(I2C_TypeDef *I2Cx, uint32_t Direction)
00620 {
00621   uint32_t data_reg_addr;
00622 
00623   if (Direction == LL_I2C_DMA_REG_DATA_TRANSMIT)
00624   {
00625     /* return address of TXDR register */
00626     data_reg_addr = (uint32_t) &(I2Cx->TXDR);
00627   }
00628   else
00629   {
00630     /* return address of RXDR register */
00631     data_reg_addr = (uint32_t) &(I2Cx->RXDR);
00632   }
00633 
00634   return data_reg_addr;
00635 }
00636 
00637 /**
00638   * @brief  Enable Clock stretching.
00639   * @note   This bit can only be programmed when the I2C is disabled (PE = 0).
00640   * @rmtoll CR1          NOSTRETCH     LL_I2C_EnableClockStretching
00641   * @param  I2Cx I2C Instance.
00642   * @retval None
00643   */
00644 __STATIC_INLINE void LL_I2C_EnableClockStretching(I2C_TypeDef *I2Cx)
00645 {
00646   CLEAR_BIT(I2Cx->CR1, I2C_CR1_NOSTRETCH);
00647 }
00648 
00649 /**
00650   * @brief  Disable Clock stretching.
00651   * @note   This bit can only be programmed when the I2C is disabled (PE = 0).
00652   * @rmtoll CR1          NOSTRETCH     LL_I2C_DisableClockStretching
00653   * @param  I2Cx I2C Instance.
00654   * @retval None
00655   */
00656 __STATIC_INLINE void LL_I2C_DisableClockStretching(I2C_TypeDef *I2Cx)
00657 {
00658   SET_BIT(I2Cx->CR1, I2C_CR1_NOSTRETCH);
00659 }
00660 
00661 /**
00662   * @brief  Check if Clock stretching is enabled or disabled.
00663   * @rmtoll CR1          NOSTRETCH     LL_I2C_IsEnabledClockStretching
00664   * @param  I2Cx I2C Instance.
00665   * @retval State of bit (1 or 0).
00666   */
00667 __STATIC_INLINE uint32_t LL_I2C_IsEnabledClockStretching(I2C_TypeDef *I2Cx)
00668 {
00669   return ((READ_BIT(I2Cx->CR1, I2C_CR1_NOSTRETCH) != (I2C_CR1_NOSTRETCH)) ? 1UL : 0UL);
00670 }
00671 
00672 /**
00673   * @brief  Enable hardware byte control in slave mode.
00674   * @rmtoll CR1          SBC           LL_I2C_EnableSlaveByteControl
00675   * @param  I2Cx I2C Instance.
00676   * @retval None
00677   */
00678 __STATIC_INLINE void LL_I2C_EnableSlaveByteControl(I2C_TypeDef *I2Cx)
00679 {
00680   SET_BIT(I2Cx->CR1, I2C_CR1_SBC);
00681 }
00682 
00683 /**
00684   * @brief  Disable hardware byte control in slave mode.
00685   * @rmtoll CR1          SBC           LL_I2C_DisableSlaveByteControl
00686   * @param  I2Cx I2C Instance.
00687   * @retval None
00688   */
00689 __STATIC_INLINE void LL_I2C_DisableSlaveByteControl(I2C_TypeDef *I2Cx)
00690 {
00691   CLEAR_BIT(I2Cx->CR1, I2C_CR1_SBC);
00692 }
00693 
00694 /**
00695   * @brief  Check if hardware byte control in slave mode is enabled or disabled.
00696   * @rmtoll CR1          SBC           LL_I2C_IsEnabledSlaveByteControl
00697   * @param  I2Cx I2C Instance.
00698   * @retval State of bit (1 or 0).
00699   */
00700 __STATIC_INLINE uint32_t LL_I2C_IsEnabledSlaveByteControl(I2C_TypeDef *I2Cx)
00701 {
00702   return ((READ_BIT(I2Cx->CR1, I2C_CR1_SBC) == (I2C_CR1_SBC)) ? 1UL : 0UL);
00703 }
00704 
00705 /**
00706   * @brief  Enable Wakeup from STOP.
00707   * @note   The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not
00708   *         WakeUpFromStop feature is supported by the I2Cx Instance.
00709   * @note   This bit can only be programmed when Digital Filter is disabled.
00710   * @rmtoll CR1          WUPEN         LL_I2C_EnableWakeUpFromStop
00711   * @param  I2Cx I2C Instance.
00712   * @retval None
00713   */
00714 __STATIC_INLINE void LL_I2C_EnableWakeUpFromStop(I2C_TypeDef *I2Cx)
00715 {
00716   SET_BIT(I2Cx->CR1, I2C_CR1_WUPEN);
00717 }
00718 
00719 /**
00720   * @brief  Disable Wakeup from STOP.
00721   * @note   The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not
00722   *         WakeUpFromStop feature is supported by the I2Cx Instance.
00723   * @rmtoll CR1          WUPEN         LL_I2C_DisableWakeUpFromStop
00724   * @param  I2Cx I2C Instance.
00725   * @retval None
00726   */
00727 __STATIC_INLINE void LL_I2C_DisableWakeUpFromStop(I2C_TypeDef *I2Cx)
00728 {
00729   CLEAR_BIT(I2Cx->CR1, I2C_CR1_WUPEN);
00730 }
00731 
00732 /**
00733   * @brief  Check if Wakeup from STOP is enabled or disabled.
00734   * @note   The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not
00735   *         WakeUpFromStop feature is supported by the I2Cx Instance.
00736   * @rmtoll CR1          WUPEN         LL_I2C_IsEnabledWakeUpFromStop
00737   * @param  I2Cx I2C Instance.
00738   * @retval State of bit (1 or 0).
00739   */
00740 __STATIC_INLINE uint32_t LL_I2C_IsEnabledWakeUpFromStop(I2C_TypeDef *I2Cx)
00741 {
00742   return ((READ_BIT(I2Cx->CR1, I2C_CR1_WUPEN) == (I2C_CR1_WUPEN)) ? 1UL : 0UL);
00743 }
00744 
00745 /**
00746   * @brief  Enable General Call.
00747   * @note   When enabled the Address 0x00 is ACKed.
00748   * @rmtoll CR1          GCEN          LL_I2C_EnableGeneralCall
00749   * @param  I2Cx I2C Instance.
00750   * @retval None
00751   */
00752 __STATIC_INLINE void LL_I2C_EnableGeneralCall(I2C_TypeDef *I2Cx)
00753 {
00754   SET_BIT(I2Cx->CR1, I2C_CR1_GCEN);
00755 }
00756 
00757 /**
00758   * @brief  Disable General Call.
00759   * @note   When disabled the Address 0x00 is NACKed.
00760   * @rmtoll CR1          GCEN          LL_I2C_DisableGeneralCall
00761   * @param  I2Cx I2C Instance.
00762   * @retval None
00763   */
00764 __STATIC_INLINE void LL_I2C_DisableGeneralCall(I2C_TypeDef *I2Cx)
00765 {
00766   CLEAR_BIT(I2Cx->CR1, I2C_CR1_GCEN);
00767 }
00768 
00769 /**
00770   * @brief  Check if General Call is enabled or disabled.
00771   * @rmtoll CR1          GCEN          LL_I2C_IsEnabledGeneralCall
00772   * @param  I2Cx I2C Instance.
00773   * @retval State of bit (1 or 0).
00774   */
00775 __STATIC_INLINE uint32_t LL_I2C_IsEnabledGeneralCall(I2C_TypeDef *I2Cx)
00776 {
00777   return ((READ_BIT(I2Cx->CR1, I2C_CR1_GCEN) == (I2C_CR1_GCEN)) ? 1UL : 0UL);
00778 }
00779 
00780 /**
00781   * @brief  Configure the Master to operate in 7-bit or 10-bit addressing mode.
00782   * @note   Changing this bit is not allowed, when the START bit is set.
00783   * @rmtoll CR2          ADD10         LL_I2C_SetMasterAddressingMode
00784   * @param  I2Cx I2C Instance.
00785   * @param  AddressingMode This parameter can be one of the following values:
00786   *         @arg @ref LL_I2C_ADDRESSING_MODE_7BIT
00787   *         @arg @ref LL_I2C_ADDRESSING_MODE_10BIT
00788   * @retval None
00789   */
00790 __STATIC_INLINE void LL_I2C_SetMasterAddressingMode(I2C_TypeDef *I2Cx, uint32_t AddressingMode)
00791 {
00792   MODIFY_REG(I2Cx->CR2, I2C_CR2_ADD10, AddressingMode);
00793 }
00794 
00795 /**
00796   * @brief  Get the Master addressing mode.
00797   * @rmtoll CR2          ADD10         LL_I2C_GetMasterAddressingMode
00798   * @param  I2Cx I2C Instance.
00799   * @retval Returned value can be one of the following values:
00800   *         @arg @ref LL_I2C_ADDRESSING_MODE_7BIT
00801   *         @arg @ref LL_I2C_ADDRESSING_MODE_10BIT
00802   */
00803 __STATIC_INLINE uint32_t LL_I2C_GetMasterAddressingMode(I2C_TypeDef *I2Cx)
00804 {
00805   return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_ADD10));
00806 }
00807 
00808 /**
00809   * @brief  Set the Own Address1.
00810   * @rmtoll OAR1         OA1           LL_I2C_SetOwnAddress1\n
00811   *         OAR1         OA1MODE       LL_I2C_SetOwnAddress1
00812   * @param  I2Cx I2C Instance.
00813   * @param  OwnAddress1 This parameter must be a value between Min_Data=0 and Max_Data=0x3FF.
00814   * @param  OwnAddrSize This parameter can be one of the following values:
00815   *         @arg @ref LL_I2C_OWNADDRESS1_7BIT
00816   *         @arg @ref LL_I2C_OWNADDRESS1_10BIT
00817   * @retval None
00818   */
00819 __STATIC_INLINE void LL_I2C_SetOwnAddress1(I2C_TypeDef *I2Cx, uint32_t OwnAddress1, uint32_t OwnAddrSize)
00820 {
00821   MODIFY_REG(I2Cx->OAR1, I2C_OAR1_OA1 | I2C_OAR1_OA1MODE, OwnAddress1 | OwnAddrSize);
00822 }
00823 
00824 /**
00825   * @brief  Enable acknowledge on Own Address1 match address.
00826   * @rmtoll OAR1         OA1EN         LL_I2C_EnableOwnAddress1
00827   * @param  I2Cx I2C Instance.
00828   * @retval None
00829   */
00830 __STATIC_INLINE void LL_I2C_EnableOwnAddress1(I2C_TypeDef *I2Cx)
00831 {
00832   SET_BIT(I2Cx->OAR1, I2C_OAR1_OA1EN);
00833 }
00834 
00835 /**
00836   * @brief  Disable acknowledge on Own Address1 match address.
00837   * @rmtoll OAR1         OA1EN         LL_I2C_DisableOwnAddress1
00838   * @param  I2Cx I2C Instance.
00839   * @retval None
00840   */
00841 __STATIC_INLINE void LL_I2C_DisableOwnAddress1(I2C_TypeDef *I2Cx)
00842 {
00843   CLEAR_BIT(I2Cx->OAR1, I2C_OAR1_OA1EN);
00844 }
00845 
00846 /**
00847   * @brief  Check if Own Address1 acknowledge is enabled or disabled.
00848   * @rmtoll OAR1         OA1EN         LL_I2C_IsEnabledOwnAddress1
00849   * @param  I2Cx I2C Instance.
00850   * @retval State of bit (1 or 0).
00851   */
00852 __STATIC_INLINE uint32_t LL_I2C_IsEnabledOwnAddress1(I2C_TypeDef *I2Cx)
00853 {
00854   return ((READ_BIT(I2Cx->OAR1, I2C_OAR1_OA1EN) == (I2C_OAR1_OA1EN)) ? 1UL : 0UL);
00855 }
00856 
00857 /**
00858   * @brief  Set the 7bits Own Address2.
00859   * @note   This action has no effect if own address2 is enabled.
00860   * @rmtoll OAR2         OA2           LL_I2C_SetOwnAddress2\n
00861   *         OAR2         OA2MSK        LL_I2C_SetOwnAddress2
00862   * @param  I2Cx I2C Instance.
00863   * @param  OwnAddress2 Value between Min_Data=0 and Max_Data=0x7F.
00864   * @param  OwnAddrMask This parameter can be one of the following values:
00865   *         @arg @ref LL_I2C_OWNADDRESS2_NOMASK
00866   *         @arg @ref LL_I2C_OWNADDRESS2_MASK01
00867   *         @arg @ref LL_I2C_OWNADDRESS2_MASK02
00868   *         @arg @ref LL_I2C_OWNADDRESS2_MASK03
00869   *         @arg @ref LL_I2C_OWNADDRESS2_MASK04
00870   *         @arg @ref LL_I2C_OWNADDRESS2_MASK05
00871   *         @arg @ref LL_I2C_OWNADDRESS2_MASK06
00872   *         @arg @ref LL_I2C_OWNADDRESS2_MASK07
00873   * @retval None
00874   */
00875 __STATIC_INLINE void LL_I2C_SetOwnAddress2(I2C_TypeDef *I2Cx, uint32_t OwnAddress2, uint32_t OwnAddrMask)
00876 {
00877   MODIFY_REG(I2Cx->OAR2, I2C_OAR2_OA2 | I2C_OAR2_OA2MSK, OwnAddress2 | OwnAddrMask);
00878 }
00879 
00880 /**
00881   * @brief  Enable acknowledge on Own Address2 match address.
00882   * @rmtoll OAR2         OA2EN         LL_I2C_EnableOwnAddress2
00883   * @param  I2Cx I2C Instance.
00884   * @retval None
00885   */
00886 __STATIC_INLINE void LL_I2C_EnableOwnAddress2(I2C_TypeDef *I2Cx)
00887 {
00888   SET_BIT(I2Cx->OAR2, I2C_OAR2_OA2EN);
00889 }
00890 
00891 /**
00892   * @brief  Disable  acknowledge on Own Address2 match address.
00893   * @rmtoll OAR2         OA2EN         LL_I2C_DisableOwnAddress2
00894   * @param  I2Cx I2C Instance.
00895   * @retval None
00896   */
00897 __STATIC_INLINE void LL_I2C_DisableOwnAddress2(I2C_TypeDef *I2Cx)
00898 {
00899   CLEAR_BIT(I2Cx->OAR2, I2C_OAR2_OA2EN);
00900 }
00901 
00902 /**
00903   * @brief  Check if Own Address1 acknowledge is enabled or disabled.
00904   * @rmtoll OAR2         OA2EN         LL_I2C_IsEnabledOwnAddress2
00905   * @param  I2Cx I2C Instance.
00906   * @retval State of bit (1 or 0).
00907   */
00908 __STATIC_INLINE uint32_t LL_I2C_IsEnabledOwnAddress2(I2C_TypeDef *I2Cx)
00909 {
00910   return ((READ_BIT(I2Cx->OAR2, I2C_OAR2_OA2EN) == (I2C_OAR2_OA2EN)) ? 1UL : 0UL);
00911 }
00912 
00913 /**
00914   * @brief  Configure the SDA setup, hold time and the SCL high, low period.
00915   * @note   This bit can only be programmed when the I2C is disabled (PE = 0).
00916   * @rmtoll TIMINGR      TIMINGR       LL_I2C_SetTiming
00917   * @param  I2Cx I2C Instance.
00918   * @param  Timing This parameter must be a value between Min_Data=0 and Max_Data=0xFFFFFFFF.
00919   * @note   This parameter is computed with the STM32CubeMX Tool.
00920   * @retval None
00921   */
00922 __STATIC_INLINE void LL_I2C_SetTiming(I2C_TypeDef *I2Cx, uint32_t Timing)
00923 {
00924   WRITE_REG(I2Cx->TIMINGR, Timing);
00925 }
00926 
00927 /**
00928   * @brief  Get the Timing Prescaler setting.
00929   * @rmtoll TIMINGR      PRESC         LL_I2C_GetTimingPrescaler
00930   * @param  I2Cx I2C Instance.
00931   * @retval Value between Min_Data=0x0 and Max_Data=0xF
00932   */
00933 __STATIC_INLINE uint32_t LL_I2C_GetTimingPrescaler(I2C_TypeDef *I2Cx)
00934 {
00935   return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_PRESC) >> I2C_TIMINGR_PRESC_Pos);
00936 }
00937 
00938 /**
00939   * @brief  Get the SCL low period setting.
00940   * @rmtoll TIMINGR      SCLL          LL_I2C_GetClockLowPeriod
00941   * @param  I2Cx I2C Instance.
00942   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
00943   */
00944 __STATIC_INLINE uint32_t LL_I2C_GetClockLowPeriod(I2C_TypeDef *I2Cx)
00945 {
00946   return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLL) >> I2C_TIMINGR_SCLL_Pos);
00947 }
00948 
00949 /**
00950   * @brief  Get the SCL high period setting.
00951   * @rmtoll TIMINGR      SCLH          LL_I2C_GetClockHighPeriod
00952   * @param  I2Cx I2C Instance.
00953   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
00954   */
00955 __STATIC_INLINE uint32_t LL_I2C_GetClockHighPeriod(I2C_TypeDef *I2Cx)
00956 {
00957   return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLH) >> I2C_TIMINGR_SCLH_Pos);
00958 }
00959 
00960 /**
00961   * @brief  Get the SDA hold time.
00962   * @rmtoll TIMINGR      SDADEL        LL_I2C_GetDataHoldTime
00963   * @param  I2Cx I2C Instance.
00964   * @retval Value between Min_Data=0x0 and Max_Data=0xF
00965   */
00966 __STATIC_INLINE uint32_t LL_I2C_GetDataHoldTime(I2C_TypeDef *I2Cx)
00967 {
00968   return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SDADEL) >> I2C_TIMINGR_SDADEL_Pos);
00969 }
00970 
00971 /**
00972   * @brief  Get the SDA setup time.
00973   * @rmtoll TIMINGR      SCLDEL        LL_I2C_GetDataSetupTime
00974   * @param  I2Cx I2C Instance.
00975   * @retval Value between Min_Data=0x0 and Max_Data=0xF
00976   */
00977 __STATIC_INLINE uint32_t LL_I2C_GetDataSetupTime(I2C_TypeDef *I2Cx)
00978 {
00979   return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLDEL) >> I2C_TIMINGR_SCLDEL_Pos);
00980 }
00981 
00982 /**
00983   * @brief  Configure peripheral mode.
00984   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
00985   *         SMBus feature is supported by the I2Cx Instance.
00986   * @rmtoll CR1          SMBHEN        LL_I2C_SetMode\n
00987   *         CR1          SMBDEN        LL_I2C_SetMode
00988   * @param  I2Cx I2C Instance.
00989   * @param  PeripheralMode This parameter can be one of the following values:
00990   *         @arg @ref LL_I2C_MODE_I2C
00991   *         @arg @ref LL_I2C_MODE_SMBUS_HOST
00992   *         @arg @ref LL_I2C_MODE_SMBUS_DEVICE
00993   *         @arg @ref LL_I2C_MODE_SMBUS_DEVICE_ARP
00994   * @retval None
00995   */
00996 __STATIC_INLINE void LL_I2C_SetMode(I2C_TypeDef *I2Cx, uint32_t PeripheralMode)
00997 {
00998   MODIFY_REG(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN, PeripheralMode);
00999 }
01000 
01001 /**
01002   * @brief  Get peripheral mode.
01003   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01004   *         SMBus feature is supported by the I2Cx Instance.
01005   * @rmtoll CR1          SMBHEN        LL_I2C_GetMode\n
01006   *         CR1          SMBDEN        LL_I2C_GetMode
01007   * @param  I2Cx I2C Instance.
01008   * @retval Returned value can be one of the following values:
01009   *         @arg @ref LL_I2C_MODE_I2C
01010   *         @arg @ref LL_I2C_MODE_SMBUS_HOST
01011   *         @arg @ref LL_I2C_MODE_SMBUS_DEVICE
01012   *         @arg @ref LL_I2C_MODE_SMBUS_DEVICE_ARP
01013   */
01014 __STATIC_INLINE uint32_t LL_I2C_GetMode(I2C_TypeDef *I2Cx)
01015 {
01016   return (uint32_t)(READ_BIT(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN));
01017 }
01018 
01019 /**
01020   * @brief  Enable SMBus alert (Host or Device mode)
01021   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01022   *         SMBus feature is supported by the I2Cx Instance.
01023   * @note   SMBus Device mode:
01024   *         - SMBus Alert pin is drived low and
01025   *           Alert Response Address Header acknowledge is enabled.
01026   *         SMBus Host mode:
01027   *         - SMBus Alert pin management is supported.
01028   * @rmtoll CR1          ALERTEN       LL_I2C_EnableSMBusAlert
01029   * @param  I2Cx I2C Instance.
01030   * @retval None
01031   */
01032 __STATIC_INLINE void LL_I2C_EnableSMBusAlert(I2C_TypeDef *I2Cx)
01033 {
01034   SET_BIT(I2Cx->CR1, I2C_CR1_ALERTEN);
01035 }
01036 
01037 /**
01038   * @brief  Disable SMBus alert (Host or Device mode)
01039   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01040   *         SMBus feature is supported by the I2Cx Instance.
01041   * @note   SMBus Device mode:
01042   *         - SMBus Alert pin is not drived (can be used as a standard GPIO) and
01043   *           Alert Response Address Header acknowledge is disabled.
01044   *         SMBus Host mode:
01045   *         - SMBus Alert pin management is not supported.
01046   * @rmtoll CR1          ALERTEN       LL_I2C_DisableSMBusAlert
01047   * @param  I2Cx I2C Instance.
01048   * @retval None
01049   */
01050 __STATIC_INLINE void LL_I2C_DisableSMBusAlert(I2C_TypeDef *I2Cx)
01051 {
01052   CLEAR_BIT(I2Cx->CR1, I2C_CR1_ALERTEN);
01053 }
01054 
01055 /**
01056   * @brief  Check if SMBus alert (Host or Device mode) is enabled or disabled.
01057   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01058   *         SMBus feature is supported by the I2Cx Instance.
01059   * @rmtoll CR1          ALERTEN       LL_I2C_IsEnabledSMBusAlert
01060   * @param  I2Cx I2C Instance.
01061   * @retval State of bit (1 or 0).
01062   */
01063 __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusAlert(I2C_TypeDef *I2Cx)
01064 {
01065   return ((READ_BIT(I2Cx->CR1, I2C_CR1_ALERTEN) == (I2C_CR1_ALERTEN)) ? 1UL : 0UL);
01066 }
01067 
01068 /**
01069   * @brief  Enable SMBus Packet Error Calculation (PEC).
01070   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01071   *         SMBus feature is supported by the I2Cx Instance.
01072   * @rmtoll CR1          PECEN         LL_I2C_EnableSMBusPEC
01073   * @param  I2Cx I2C Instance.
01074   * @retval None
01075   */
01076 __STATIC_INLINE void LL_I2C_EnableSMBusPEC(I2C_TypeDef *I2Cx)
01077 {
01078   SET_BIT(I2Cx->CR1, I2C_CR1_PECEN);
01079 }
01080 
01081 /**
01082   * @brief  Disable SMBus Packet Error Calculation (PEC).
01083   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01084   *         SMBus feature is supported by the I2Cx Instance.
01085   * @rmtoll CR1          PECEN         LL_I2C_DisableSMBusPEC
01086   * @param  I2Cx I2C Instance.
01087   * @retval None
01088   */
01089 __STATIC_INLINE void LL_I2C_DisableSMBusPEC(I2C_TypeDef *I2Cx)
01090 {
01091   CLEAR_BIT(I2Cx->CR1, I2C_CR1_PECEN);
01092 }
01093 
01094 /**
01095   * @brief  Check if SMBus Packet Error Calculation (PEC) is enabled or disabled.
01096   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01097   *         SMBus feature is supported by the I2Cx Instance.
01098   * @rmtoll CR1          PECEN         LL_I2C_IsEnabledSMBusPEC
01099   * @param  I2Cx I2C Instance.
01100   * @retval State of bit (1 or 0).
01101   */
01102 __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPEC(I2C_TypeDef *I2Cx)
01103 {
01104   return ((READ_BIT(I2Cx->CR1, I2C_CR1_PECEN) == (I2C_CR1_PECEN)) ? 1UL : 0UL);
01105 }
01106 
01107 /**
01108   * @brief  Configure the SMBus Clock Timeout.
01109   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01110   *         SMBus feature is supported by the I2Cx Instance.
01111   * @note   This configuration can only be programmed when associated Timeout is disabled (TimeoutA and/orTimeoutB).
01112   * @rmtoll TIMEOUTR     TIMEOUTA      LL_I2C_ConfigSMBusTimeout\n
01113   *         TIMEOUTR     TIDLE         LL_I2C_ConfigSMBusTimeout\n
01114   *         TIMEOUTR     TIMEOUTB      LL_I2C_ConfigSMBusTimeout
01115   * @param  I2Cx I2C Instance.
01116   * @param  TimeoutA This parameter must be a value between  Min_Data=0 and Max_Data=0xFFF.
01117   * @param  TimeoutAMode This parameter can be one of the following values:
01118   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW
01119   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH
01120   * @param  TimeoutB
01121   * @retval None
01122   */
01123 __STATIC_INLINE void LL_I2C_ConfigSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t TimeoutA, uint32_t TimeoutAMode,
01124                                                uint32_t TimeoutB)
01125 {
01126   MODIFY_REG(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA | I2C_TIMEOUTR_TIDLE | I2C_TIMEOUTR_TIMEOUTB,
01127              TimeoutA | TimeoutAMode | (TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos));
01128 }
01129 
01130 /**
01131   * @brief  Configure the SMBus Clock TimeoutA (SCL low timeout or SCL and SDA high timeout depends on TimeoutA mode).
01132   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01133   *         SMBus feature is supported by the I2Cx Instance.
01134   * @note   These bits can only be programmed when TimeoutA is disabled.
01135   * @rmtoll TIMEOUTR     TIMEOUTA      LL_I2C_SetSMBusTimeoutA
01136   * @param  I2Cx I2C Instance.
01137   * @param  TimeoutA This parameter must be a value between  Min_Data=0 and Max_Data=0xFFF.
01138   * @retval None
01139   */
01140 __STATIC_INLINE void LL_I2C_SetSMBusTimeoutA(I2C_TypeDef *I2Cx, uint32_t TimeoutA)
01141 {
01142   WRITE_REG(I2Cx->TIMEOUTR, TimeoutA);
01143 }
01144 
01145 /**
01146   * @brief  Get the SMBus Clock TimeoutA setting.
01147   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01148   *         SMBus feature is supported by the I2Cx Instance.
01149   * @rmtoll TIMEOUTR     TIMEOUTA      LL_I2C_GetSMBusTimeoutA
01150   * @param  I2Cx I2C Instance.
01151   * @retval Value between Min_Data=0 and Max_Data=0xFFF
01152   */
01153 __STATIC_INLINE uint32_t LL_I2C_GetSMBusTimeoutA(I2C_TypeDef *I2Cx)
01154 {
01155   return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA));
01156 }
01157 
01158 /**
01159   * @brief  Set the SMBus Clock TimeoutA mode.
01160   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01161   *         SMBus feature is supported by the I2Cx Instance.
01162   * @note   This bit can only be programmed when TimeoutA is disabled.
01163   * @rmtoll TIMEOUTR     TIDLE         LL_I2C_SetSMBusTimeoutAMode
01164   * @param  I2Cx I2C Instance.
01165   * @param  TimeoutAMode This parameter can be one of the following values:
01166   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW
01167   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH
01168   * @retval None
01169   */
01170 __STATIC_INLINE void LL_I2C_SetSMBusTimeoutAMode(I2C_TypeDef *I2Cx, uint32_t TimeoutAMode)
01171 {
01172   WRITE_REG(I2Cx->TIMEOUTR, TimeoutAMode);
01173 }
01174 
01175 /**
01176   * @brief  Get the SMBus Clock TimeoutA mode.
01177   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01178   *         SMBus feature is supported by the I2Cx Instance.
01179   * @rmtoll TIMEOUTR     TIDLE         LL_I2C_GetSMBusTimeoutAMode
01180   * @param  I2Cx I2C Instance.
01181   * @retval Returned value can be one of the following values:
01182   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW
01183   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH
01184   */
01185 __STATIC_INLINE uint32_t LL_I2C_GetSMBusTimeoutAMode(I2C_TypeDef *I2Cx)
01186 {
01187   return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIDLE));
01188 }
01189 
01190 /**
01191   * @brief  Configure the SMBus Extended Cumulative Clock TimeoutB (Master or Slave mode).
01192   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01193   *         SMBus feature is supported by the I2Cx Instance.
01194   * @note   These bits can only be programmed when TimeoutB is disabled.
01195   * @rmtoll TIMEOUTR     TIMEOUTB      LL_I2C_SetSMBusTimeoutB
01196   * @param  I2Cx I2C Instance.
01197   * @param  TimeoutB This parameter must be a value between  Min_Data=0 and Max_Data=0xFFF.
01198   * @retval None
01199   */
01200 __STATIC_INLINE void LL_I2C_SetSMBusTimeoutB(I2C_TypeDef *I2Cx, uint32_t TimeoutB)
01201 {
01202   WRITE_REG(I2Cx->TIMEOUTR, TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos);
01203 }
01204 
01205 /**
01206   * @brief  Get the SMBus Extended Cumulative Clock TimeoutB setting.
01207   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01208   *         SMBus feature is supported by the I2Cx Instance.
01209   * @rmtoll TIMEOUTR     TIMEOUTB      LL_I2C_GetSMBusTimeoutB
01210   * @param  I2Cx I2C Instance.
01211   * @retval Value between Min_Data=0 and Max_Data=0xFFF
01212   */
01213 __STATIC_INLINE uint32_t LL_I2C_GetSMBusTimeoutB(I2C_TypeDef *I2Cx)
01214 {
01215   return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTB) >> I2C_TIMEOUTR_TIMEOUTB_Pos);
01216 }
01217 
01218 /**
01219   * @brief  Enable the SMBus Clock Timeout.
01220   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01221   *         SMBus feature is supported by the I2Cx Instance.
01222   * @rmtoll TIMEOUTR     TIMOUTEN      LL_I2C_EnableSMBusTimeout\n
01223   *         TIMEOUTR     TEXTEN        LL_I2C_EnableSMBusTimeout
01224   * @param  I2Cx I2C Instance.
01225   * @param  ClockTimeout This parameter can be one of the following values:
01226   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA
01227   *         @arg @ref LL_I2C_SMBUS_TIMEOUTB
01228   *         @arg @ref LL_I2C_SMBUS_ALL_TIMEOUT
01229   * @retval None
01230   */
01231 __STATIC_INLINE void LL_I2C_EnableSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t ClockTimeout)
01232 {
01233   SET_BIT(I2Cx->TIMEOUTR, ClockTimeout);
01234 }
01235 
01236 /**
01237   * @brief  Disable the SMBus Clock Timeout.
01238   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01239   *         SMBus feature is supported by the I2Cx Instance.
01240   * @rmtoll TIMEOUTR     TIMOUTEN      LL_I2C_DisableSMBusTimeout\n
01241   *         TIMEOUTR     TEXTEN        LL_I2C_DisableSMBusTimeout
01242   * @param  I2Cx I2C Instance.
01243   * @param  ClockTimeout This parameter can be one of the following values:
01244   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA
01245   *         @arg @ref LL_I2C_SMBUS_TIMEOUTB
01246   *         @arg @ref LL_I2C_SMBUS_ALL_TIMEOUT
01247   * @retval None
01248   */
01249 __STATIC_INLINE void LL_I2C_DisableSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t ClockTimeout)
01250 {
01251   CLEAR_BIT(I2Cx->TIMEOUTR, ClockTimeout);
01252 }
01253 
01254 /**
01255   * @brief  Check if the SMBus Clock Timeout is enabled or disabled.
01256   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01257   *         SMBus feature is supported by the I2Cx Instance.
01258   * @rmtoll TIMEOUTR     TIMOUTEN      LL_I2C_IsEnabledSMBusTimeout\n
01259   *         TIMEOUTR     TEXTEN        LL_I2C_IsEnabledSMBusTimeout
01260   * @param  I2Cx I2C Instance.
01261   * @param  ClockTimeout This parameter can be one of the following values:
01262   *         @arg @ref LL_I2C_SMBUS_TIMEOUTA
01263   *         @arg @ref LL_I2C_SMBUS_TIMEOUTB
01264   *         @arg @ref LL_I2C_SMBUS_ALL_TIMEOUT
01265   * @retval State of bit (1 or 0).
01266   */
01267 __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t ClockTimeout)
01268 {
01269   return ((READ_BIT(I2Cx->TIMEOUTR, (I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN)) == \
01270            (ClockTimeout)) ? 1UL : 0UL);
01271 }
01272 
01273 /**
01274   * @}
01275   */
01276 
01277 /** @defgroup I2C_LL_EF_IT_Management IT_Management
01278   * @{
01279   */
01280 
01281 /**
01282   * @brief  Enable TXIS interrupt.
01283   * @rmtoll CR1          TXIE          LL_I2C_EnableIT_TX
01284   * @param  I2Cx I2C Instance.
01285   * @retval None
01286   */
01287 __STATIC_INLINE void LL_I2C_EnableIT_TX(I2C_TypeDef *I2Cx)
01288 {
01289   SET_BIT(I2Cx->CR1, I2C_CR1_TXIE);
01290 }
01291 
01292 /**
01293   * @brief  Disable TXIS interrupt.
01294   * @rmtoll CR1          TXIE          LL_I2C_DisableIT_TX
01295   * @param  I2Cx I2C Instance.
01296   * @retval None
01297   */
01298 __STATIC_INLINE void LL_I2C_DisableIT_TX(I2C_TypeDef *I2Cx)
01299 {
01300   CLEAR_BIT(I2Cx->CR1, I2C_CR1_TXIE);
01301 }
01302 
01303 /**
01304   * @brief  Check if the TXIS Interrupt is enabled or disabled.
01305   * @rmtoll CR1          TXIE          LL_I2C_IsEnabledIT_TX
01306   * @param  I2Cx I2C Instance.
01307   * @retval State of bit (1 or 0).
01308   */
01309 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_TX(I2C_TypeDef *I2Cx)
01310 {
01311   return ((READ_BIT(I2Cx->CR1, I2C_CR1_TXIE) == (I2C_CR1_TXIE)) ? 1UL : 0UL);
01312 }
01313 
01314 /**
01315   * @brief  Enable RXNE interrupt.
01316   * @rmtoll CR1          RXIE          LL_I2C_EnableIT_RX
01317   * @param  I2Cx I2C Instance.
01318   * @retval None
01319   */
01320 __STATIC_INLINE void LL_I2C_EnableIT_RX(I2C_TypeDef *I2Cx)
01321 {
01322   SET_BIT(I2Cx->CR1, I2C_CR1_RXIE);
01323 }
01324 
01325 /**
01326   * @brief  Disable RXNE interrupt.
01327   * @rmtoll CR1          RXIE          LL_I2C_DisableIT_RX
01328   * @param  I2Cx I2C Instance.
01329   * @retval None
01330   */
01331 __STATIC_INLINE void LL_I2C_DisableIT_RX(I2C_TypeDef *I2Cx)
01332 {
01333   CLEAR_BIT(I2Cx->CR1, I2C_CR1_RXIE);
01334 }
01335 
01336 /**
01337   * @brief  Check if the RXNE Interrupt is enabled or disabled.
01338   * @rmtoll CR1          RXIE          LL_I2C_IsEnabledIT_RX
01339   * @param  I2Cx I2C Instance.
01340   * @retval State of bit (1 or 0).
01341   */
01342 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_RX(I2C_TypeDef *I2Cx)
01343 {
01344   return ((READ_BIT(I2Cx->CR1, I2C_CR1_RXIE) == (I2C_CR1_RXIE)) ? 1UL : 0UL);
01345 }
01346 
01347 /**
01348   * @brief  Enable Address match interrupt (slave mode only).
01349   * @rmtoll CR1          ADDRIE        LL_I2C_EnableIT_ADDR
01350   * @param  I2Cx I2C Instance.
01351   * @retval None
01352   */
01353 __STATIC_INLINE void LL_I2C_EnableIT_ADDR(I2C_TypeDef *I2Cx)
01354 {
01355   SET_BIT(I2Cx->CR1, I2C_CR1_ADDRIE);
01356 }
01357 
01358 /**
01359   * @brief  Disable Address match interrupt (slave mode only).
01360   * @rmtoll CR1          ADDRIE        LL_I2C_DisableIT_ADDR
01361   * @param  I2Cx I2C Instance.
01362   * @retval None
01363   */
01364 __STATIC_INLINE void LL_I2C_DisableIT_ADDR(I2C_TypeDef *I2Cx)
01365 {
01366   CLEAR_BIT(I2Cx->CR1, I2C_CR1_ADDRIE);
01367 }
01368 
01369 /**
01370   * @brief  Check if Address match interrupt is enabled or disabled.
01371   * @rmtoll CR1          ADDRIE        LL_I2C_IsEnabledIT_ADDR
01372   * @param  I2Cx I2C Instance.
01373   * @retval State of bit (1 or 0).
01374   */
01375 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_ADDR(I2C_TypeDef *I2Cx)
01376 {
01377   return ((READ_BIT(I2Cx->CR1, I2C_CR1_ADDRIE) == (I2C_CR1_ADDRIE)) ? 1UL : 0UL);
01378 }
01379 
01380 /**
01381   * @brief  Enable Not acknowledge received interrupt.
01382   * @rmtoll CR1          NACKIE        LL_I2C_EnableIT_NACK
01383   * @param  I2Cx I2C Instance.
01384   * @retval None
01385   */
01386 __STATIC_INLINE void LL_I2C_EnableIT_NACK(I2C_TypeDef *I2Cx)
01387 {
01388   SET_BIT(I2Cx->CR1, I2C_CR1_NACKIE);
01389 }
01390 
01391 /**
01392   * @brief  Disable Not acknowledge received interrupt.
01393   * @rmtoll CR1          NACKIE        LL_I2C_DisableIT_NACK
01394   * @param  I2Cx I2C Instance.
01395   * @retval None
01396   */
01397 __STATIC_INLINE void LL_I2C_DisableIT_NACK(I2C_TypeDef *I2Cx)
01398 {
01399   CLEAR_BIT(I2Cx->CR1, I2C_CR1_NACKIE);
01400 }
01401 
01402 /**
01403   * @brief  Check if Not acknowledge received interrupt is enabled or disabled.
01404   * @rmtoll CR1          NACKIE        LL_I2C_IsEnabledIT_NACK
01405   * @param  I2Cx I2C Instance.
01406   * @retval State of bit (1 or 0).
01407   */
01408 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_NACK(I2C_TypeDef *I2Cx)
01409 {
01410   return ((READ_BIT(I2Cx->CR1, I2C_CR1_NACKIE) == (I2C_CR1_NACKIE)) ? 1UL : 0UL);
01411 }
01412 
01413 /**
01414   * @brief  Enable STOP detection interrupt.
01415   * @rmtoll CR1          STOPIE        LL_I2C_EnableIT_STOP
01416   * @param  I2Cx I2C Instance.
01417   * @retval None
01418   */
01419 __STATIC_INLINE void LL_I2C_EnableIT_STOP(I2C_TypeDef *I2Cx)
01420 {
01421   SET_BIT(I2Cx->CR1, I2C_CR1_STOPIE);
01422 }
01423 
01424 /**
01425   * @brief  Disable STOP detection interrupt.
01426   * @rmtoll CR1          STOPIE        LL_I2C_DisableIT_STOP
01427   * @param  I2Cx I2C Instance.
01428   * @retval None
01429   */
01430 __STATIC_INLINE void LL_I2C_DisableIT_STOP(I2C_TypeDef *I2Cx)
01431 {
01432   CLEAR_BIT(I2Cx->CR1, I2C_CR1_STOPIE);
01433 }
01434 
01435 /**
01436   * @brief  Check if STOP detection interrupt is enabled or disabled.
01437   * @rmtoll CR1          STOPIE        LL_I2C_IsEnabledIT_STOP
01438   * @param  I2Cx I2C Instance.
01439   * @retval State of bit (1 or 0).
01440   */
01441 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_STOP(I2C_TypeDef *I2Cx)
01442 {
01443   return ((READ_BIT(I2Cx->CR1, I2C_CR1_STOPIE) == (I2C_CR1_STOPIE)) ? 1UL : 0UL);
01444 }
01445 
01446 /**
01447   * @brief  Enable Transfer Complete interrupt.
01448   * @note   Any of these events will generate interrupt :
01449   *         Transfer Complete (TC)
01450   *         Transfer Complete Reload (TCR)
01451   * @rmtoll CR1          TCIE          LL_I2C_EnableIT_TC
01452   * @param  I2Cx I2C Instance.
01453   * @retval None
01454   */
01455 __STATIC_INLINE void LL_I2C_EnableIT_TC(I2C_TypeDef *I2Cx)
01456 {
01457   SET_BIT(I2Cx->CR1, I2C_CR1_TCIE);
01458 }
01459 
01460 /**
01461   * @brief  Disable Transfer Complete interrupt.
01462   * @note   Any of these events will generate interrupt :
01463   *         Transfer Complete (TC)
01464   *         Transfer Complete Reload (TCR)
01465   * @rmtoll CR1          TCIE          LL_I2C_DisableIT_TC
01466   * @param  I2Cx I2C Instance.
01467   * @retval None
01468   */
01469 __STATIC_INLINE void LL_I2C_DisableIT_TC(I2C_TypeDef *I2Cx)
01470 {
01471   CLEAR_BIT(I2Cx->CR1, I2C_CR1_TCIE);
01472 }
01473 
01474 /**
01475   * @brief  Check if Transfer Complete interrupt is enabled or disabled.
01476   * @rmtoll CR1          TCIE          LL_I2C_IsEnabledIT_TC
01477   * @param  I2Cx I2C Instance.
01478   * @retval State of bit (1 or 0).
01479   */
01480 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_TC(I2C_TypeDef *I2Cx)
01481 {
01482   return ((READ_BIT(I2Cx->CR1, I2C_CR1_TCIE) == (I2C_CR1_TCIE)) ? 1UL : 0UL);
01483 }
01484 
01485 /**
01486   * @brief  Enable Error interrupts.
01487   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01488   *         SMBus feature is supported by the I2Cx Instance.
01489   * @note   Any of these errors will generate interrupt :
01490   *         Arbitration Loss (ARLO)
01491   *         Bus Error detection (BERR)
01492   *         Overrun/Underrun (OVR)
01493   *         SMBus Timeout detection (TIMEOUT)
01494   *         SMBus PEC error detection (PECERR)
01495   *         SMBus Alert pin event detection (ALERT)
01496   * @rmtoll CR1          ERRIE         LL_I2C_EnableIT_ERR
01497   * @param  I2Cx I2C Instance.
01498   * @retval None
01499   */
01500 __STATIC_INLINE void LL_I2C_EnableIT_ERR(I2C_TypeDef *I2Cx)
01501 {
01502   SET_BIT(I2Cx->CR1, I2C_CR1_ERRIE);
01503 }
01504 
01505 /**
01506   * @brief  Disable Error interrupts.
01507   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01508   *         SMBus feature is supported by the I2Cx Instance.
01509   * @note   Any of these errors will generate interrupt :
01510   *         Arbitration Loss (ARLO)
01511   *         Bus Error detection (BERR)
01512   *         Overrun/Underrun (OVR)
01513   *         SMBus Timeout detection (TIMEOUT)
01514   *         SMBus PEC error detection (PECERR)
01515   *         SMBus Alert pin event detection (ALERT)
01516   * @rmtoll CR1          ERRIE         LL_I2C_DisableIT_ERR
01517   * @param  I2Cx I2C Instance.
01518   * @retval None
01519   */
01520 __STATIC_INLINE void LL_I2C_DisableIT_ERR(I2C_TypeDef *I2Cx)
01521 {
01522   CLEAR_BIT(I2Cx->CR1, I2C_CR1_ERRIE);
01523 }
01524 
01525 /**
01526   * @brief  Check if Error interrupts are enabled or disabled.
01527   * @rmtoll CR1          ERRIE         LL_I2C_IsEnabledIT_ERR
01528   * @param  I2Cx I2C Instance.
01529   * @retval State of bit (1 or 0).
01530   */
01531 __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_ERR(I2C_TypeDef *I2Cx)
01532 {
01533   return ((READ_BIT(I2Cx->CR1, I2C_CR1_ERRIE) == (I2C_CR1_ERRIE)) ? 1UL : 0UL);
01534 }
01535 
01536 /**
01537   * @}
01538   */
01539 
01540 /** @defgroup I2C_LL_EF_FLAG_management FLAG_management
01541   * @{
01542   */
01543 
01544 /**
01545   * @brief  Indicate the status of Transmit data register empty flag.
01546   * @note   RESET: When next data is written in Transmit data register.
01547   *         SET: When Transmit data register is empty.
01548   * @rmtoll ISR          TXE           LL_I2C_IsActiveFlag_TXE
01549   * @param  I2Cx I2C Instance.
01550   * @retval State of bit (1 or 0).
01551   */
01552 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_TXE(I2C_TypeDef *I2Cx)
01553 {
01554   return ((READ_BIT(I2Cx->ISR, I2C_ISR_TXE) == (I2C_ISR_TXE)) ? 1UL : 0UL);
01555 }
01556 
01557 /**
01558   * @brief  Indicate the status of Transmit interrupt flag.
01559   * @note   RESET: When next data is written in Transmit data register.
01560   *         SET: When Transmit data register is empty.
01561   * @rmtoll ISR          TXIS          LL_I2C_IsActiveFlag_TXIS
01562   * @param  I2Cx I2C Instance.
01563   * @retval State of bit (1 or 0).
01564   */
01565 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_TXIS(I2C_TypeDef *I2Cx)
01566 {
01567   return ((READ_BIT(I2Cx->ISR, I2C_ISR_TXIS) == (I2C_ISR_TXIS)) ? 1UL : 0UL);
01568 }
01569 
01570 /**
01571   * @brief  Indicate the status of Receive data register not empty flag.
01572   * @note   RESET: When Receive data register is read.
01573   *         SET: When the received data is copied in Receive data register.
01574   * @rmtoll ISR          RXNE          LL_I2C_IsActiveFlag_RXNE
01575   * @param  I2Cx I2C Instance.
01576   * @retval State of bit (1 or 0).
01577   */
01578 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_RXNE(I2C_TypeDef *I2Cx)
01579 {
01580   return ((READ_BIT(I2Cx->ISR, I2C_ISR_RXNE) == (I2C_ISR_RXNE)) ? 1UL : 0UL);
01581 }
01582 
01583 /**
01584   * @brief  Indicate the status of Address matched flag (slave mode).
01585   * @note   RESET: Clear default value.
01586   *         SET: When the received slave address matched with one of the enabled slave address.
01587   * @rmtoll ISR          ADDR          LL_I2C_IsActiveFlag_ADDR
01588   * @param  I2Cx I2C Instance.
01589   * @retval State of bit (1 or 0).
01590   */
01591 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_ADDR(I2C_TypeDef *I2Cx)
01592 {
01593   return ((READ_BIT(I2Cx->ISR, I2C_ISR_ADDR) == (I2C_ISR_ADDR)) ? 1UL : 0UL);
01594 }
01595 
01596 /**
01597   * @brief  Indicate the status of Not Acknowledge received flag.
01598   * @note   RESET: Clear default value.
01599   *         SET: When a NACK is received after a byte transmission.
01600   * @rmtoll ISR          NACKF         LL_I2C_IsActiveFlag_NACK
01601   * @param  I2Cx I2C Instance.
01602   * @retval State of bit (1 or 0).
01603   */
01604 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_NACK(I2C_TypeDef *I2Cx)
01605 {
01606   return ((READ_BIT(I2Cx->ISR, I2C_ISR_NACKF) == (I2C_ISR_NACKF)) ? 1UL : 0UL);
01607 }
01608 
01609 /**
01610   * @brief  Indicate the status of Stop detection flag.
01611   * @note   RESET: Clear default value.
01612   *         SET: When a Stop condition is detected.
01613   * @rmtoll ISR          STOPF         LL_I2C_IsActiveFlag_STOP
01614   * @param  I2Cx I2C Instance.
01615   * @retval State of bit (1 or 0).
01616   */
01617 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_STOP(I2C_TypeDef *I2Cx)
01618 {
01619   return ((READ_BIT(I2Cx->ISR, I2C_ISR_STOPF) == (I2C_ISR_STOPF)) ? 1UL : 0UL);
01620 }
01621 
01622 /**
01623   * @brief  Indicate the status of Transfer complete flag (master mode).
01624   * @note   RESET: Clear default value.
01625   *         SET: When RELOAD=0, AUTOEND=0 and NBYTES date have been transferred.
01626   * @rmtoll ISR          TC            LL_I2C_IsActiveFlag_TC
01627   * @param  I2Cx I2C Instance.
01628   * @retval State of bit (1 or 0).
01629   */
01630 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_TC(I2C_TypeDef *I2Cx)
01631 {
01632   return ((READ_BIT(I2Cx->ISR, I2C_ISR_TC) == (I2C_ISR_TC)) ? 1UL : 0UL);
01633 }
01634 
01635 /**
01636   * @brief  Indicate the status of Transfer complete flag (master mode).
01637   * @note   RESET: Clear default value.
01638   *         SET: When RELOAD=1 and NBYTES date have been transferred.
01639   * @rmtoll ISR          TCR           LL_I2C_IsActiveFlag_TCR
01640   * @param  I2Cx I2C Instance.
01641   * @retval State of bit (1 or 0).
01642   */
01643 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_TCR(I2C_TypeDef *I2Cx)
01644 {
01645   return ((READ_BIT(I2Cx->ISR, I2C_ISR_TCR) == (I2C_ISR_TCR)) ? 1UL : 0UL);
01646 }
01647 
01648 /**
01649   * @brief  Indicate the status of Bus error flag.
01650   * @note   RESET: Clear default value.
01651   *         SET: When a misplaced Start or Stop condition is detected.
01652   * @rmtoll ISR          BERR          LL_I2C_IsActiveFlag_BERR
01653   * @param  I2Cx I2C Instance.
01654   * @retval State of bit (1 or 0).
01655   */
01656 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_BERR(I2C_TypeDef *I2Cx)
01657 {
01658   return ((READ_BIT(I2Cx->ISR, I2C_ISR_BERR) == (I2C_ISR_BERR)) ? 1UL : 0UL);
01659 }
01660 
01661 /**
01662   * @brief  Indicate the status of Arbitration lost flag.
01663   * @note   RESET: Clear default value.
01664   *         SET: When arbitration lost.
01665   * @rmtoll ISR          ARLO          LL_I2C_IsActiveFlag_ARLO
01666   * @param  I2Cx I2C Instance.
01667   * @retval State of bit (1 or 0).
01668   */
01669 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_ARLO(I2C_TypeDef *I2Cx)
01670 {
01671   return ((READ_BIT(I2Cx->ISR, I2C_ISR_ARLO) == (I2C_ISR_ARLO)) ? 1UL : 0UL);
01672 }
01673 
01674 /**
01675   * @brief  Indicate the status of Overrun/Underrun flag (slave mode).
01676   * @note   RESET: Clear default value.
01677   *         SET: When an overrun/underrun error occurs (Clock Stretching Disabled).
01678   * @rmtoll ISR          OVR           LL_I2C_IsActiveFlag_OVR
01679   * @param  I2Cx I2C Instance.
01680   * @retval State of bit (1 or 0).
01681   */
01682 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_OVR(I2C_TypeDef *I2Cx)
01683 {
01684   return ((READ_BIT(I2Cx->ISR, I2C_ISR_OVR) == (I2C_ISR_OVR)) ? 1UL : 0UL);
01685 }
01686 
01687 /**
01688   * @brief  Indicate the status of SMBus PEC error flag in reception.
01689   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01690   *         SMBus feature is supported by the I2Cx Instance.
01691   * @note   RESET: Clear default value.
01692   *         SET: When the received PEC does not match with the PEC register content.
01693   * @rmtoll ISR          PECERR        LL_I2C_IsActiveSMBusFlag_PECERR
01694   * @param  I2Cx I2C Instance.
01695   * @retval State of bit (1 or 0).
01696   */
01697 __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_PECERR(I2C_TypeDef *I2Cx)
01698 {
01699   return ((READ_BIT(I2Cx->ISR, I2C_ISR_PECERR) == (I2C_ISR_PECERR)) ? 1UL : 0UL);
01700 }
01701 
01702 /**
01703   * @brief  Indicate the status of SMBus Timeout detection flag.
01704   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01705   *         SMBus feature is supported by the I2Cx Instance.
01706   * @note   RESET: Clear default value.
01707   *         SET: When a timeout or extended clock timeout occurs.
01708   * @rmtoll ISR          TIMEOUT       LL_I2C_IsActiveSMBusFlag_TIMEOUT
01709   * @param  I2Cx I2C Instance.
01710   * @retval State of bit (1 or 0).
01711   */
01712 __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_TIMEOUT(I2C_TypeDef *I2Cx)
01713 {
01714   return ((READ_BIT(I2Cx->ISR, I2C_ISR_TIMEOUT) == (I2C_ISR_TIMEOUT)) ? 1UL : 0UL);
01715 }
01716 
01717 /**
01718   * @brief  Indicate the status of SMBus alert flag.
01719   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01720   *         SMBus feature is supported by the I2Cx Instance.
01721   * @note   RESET: Clear default value.
01722   *         SET: When SMBus host configuration, SMBus alert enabled and
01723   *              a falling edge event occurs on SMBA pin.
01724   * @rmtoll ISR          ALERT         LL_I2C_IsActiveSMBusFlag_ALERT
01725   * @param  I2Cx I2C Instance.
01726   * @retval State of bit (1 or 0).
01727   */
01728 __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_ALERT(I2C_TypeDef *I2Cx)
01729 {
01730   return ((READ_BIT(I2Cx->ISR, I2C_ISR_ALERT) == (I2C_ISR_ALERT)) ? 1UL : 0UL);
01731 }
01732 
01733 /**
01734   * @brief  Indicate the status of Bus Busy flag.
01735   * @note   RESET: Clear default value.
01736   *         SET: When a Start condition is detected.
01737   * @rmtoll ISR          BUSY          LL_I2C_IsActiveFlag_BUSY
01738   * @param  I2Cx I2C Instance.
01739   * @retval State of bit (1 or 0).
01740   */
01741 __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_BUSY(I2C_TypeDef *I2Cx)
01742 {
01743   return ((READ_BIT(I2Cx->ISR, I2C_ISR_BUSY) == (I2C_ISR_BUSY)) ? 1UL : 0UL);
01744 }
01745 
01746 /**
01747   * @brief  Clear Address Matched flag.
01748   * @rmtoll ICR          ADDRCF        LL_I2C_ClearFlag_ADDR
01749   * @param  I2Cx I2C Instance.
01750   * @retval None
01751   */
01752 __STATIC_INLINE void LL_I2C_ClearFlag_ADDR(I2C_TypeDef *I2Cx)
01753 {
01754   SET_BIT(I2Cx->ICR, I2C_ICR_ADDRCF);
01755 }
01756 
01757 /**
01758   * @brief  Clear Not Acknowledge flag.
01759   * @rmtoll ICR          NACKCF        LL_I2C_ClearFlag_NACK
01760   * @param  I2Cx I2C Instance.
01761   * @retval None
01762   */
01763 __STATIC_INLINE void LL_I2C_ClearFlag_NACK(I2C_TypeDef *I2Cx)
01764 {
01765   SET_BIT(I2Cx->ICR, I2C_ICR_NACKCF);
01766 }
01767 
01768 /**
01769   * @brief  Clear Stop detection flag.
01770   * @rmtoll ICR          STOPCF        LL_I2C_ClearFlag_STOP
01771   * @param  I2Cx I2C Instance.
01772   * @retval None
01773   */
01774 __STATIC_INLINE void LL_I2C_ClearFlag_STOP(I2C_TypeDef *I2Cx)
01775 {
01776   SET_BIT(I2Cx->ICR, I2C_ICR_STOPCF);
01777 }
01778 
01779 /**
01780   * @brief  Clear Transmit data register empty flag (TXE).
01781   * @note   This bit can be clear by software in order to flush the transmit data register (TXDR).
01782   * @rmtoll ISR          TXE           LL_I2C_ClearFlag_TXE
01783   * @param  I2Cx I2C Instance.
01784   * @retval None
01785   */
01786 __STATIC_INLINE void LL_I2C_ClearFlag_TXE(I2C_TypeDef *I2Cx)
01787 {
01788   WRITE_REG(I2Cx->ISR, I2C_ISR_TXE);
01789 }
01790 
01791 /**
01792   * @brief  Clear Bus error flag.
01793   * @rmtoll ICR          BERRCF        LL_I2C_ClearFlag_BERR
01794   * @param  I2Cx I2C Instance.
01795   * @retval None
01796   */
01797 __STATIC_INLINE void LL_I2C_ClearFlag_BERR(I2C_TypeDef *I2Cx)
01798 {
01799   SET_BIT(I2Cx->ICR, I2C_ICR_BERRCF);
01800 }
01801 
01802 /**
01803   * @brief  Clear Arbitration lost flag.
01804   * @rmtoll ICR          ARLOCF        LL_I2C_ClearFlag_ARLO
01805   * @param  I2Cx I2C Instance.
01806   * @retval None
01807   */
01808 __STATIC_INLINE void LL_I2C_ClearFlag_ARLO(I2C_TypeDef *I2Cx)
01809 {
01810   SET_BIT(I2Cx->ICR, I2C_ICR_ARLOCF);
01811 }
01812 
01813 /**
01814   * @brief  Clear Overrun/Underrun flag.
01815   * @rmtoll ICR          OVRCF         LL_I2C_ClearFlag_OVR
01816   * @param  I2Cx I2C Instance.
01817   * @retval None
01818   */
01819 __STATIC_INLINE void LL_I2C_ClearFlag_OVR(I2C_TypeDef *I2Cx)
01820 {
01821   SET_BIT(I2Cx->ICR, I2C_ICR_OVRCF);
01822 }
01823 
01824 /**
01825   * @brief  Clear SMBus PEC error flag.
01826   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01827   *         SMBus feature is supported by the I2Cx Instance.
01828   * @rmtoll ICR          PECCF         LL_I2C_ClearSMBusFlag_PECERR
01829   * @param  I2Cx I2C Instance.
01830   * @retval None
01831   */
01832 __STATIC_INLINE void LL_I2C_ClearSMBusFlag_PECERR(I2C_TypeDef *I2Cx)
01833 {
01834   SET_BIT(I2Cx->ICR, I2C_ICR_PECCF);
01835 }
01836 
01837 /**
01838   * @brief  Clear SMBus Timeout detection flag.
01839   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01840   *         SMBus feature is supported by the I2Cx Instance.
01841   * @rmtoll ICR          TIMOUTCF      LL_I2C_ClearSMBusFlag_TIMEOUT
01842   * @param  I2Cx I2C Instance.
01843   * @retval None
01844   */
01845 __STATIC_INLINE void LL_I2C_ClearSMBusFlag_TIMEOUT(I2C_TypeDef *I2Cx)
01846 {
01847   SET_BIT(I2Cx->ICR, I2C_ICR_TIMOUTCF);
01848 }
01849 
01850 /**
01851   * @brief  Clear SMBus Alert flag.
01852   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
01853   *         SMBus feature is supported by the I2Cx Instance.
01854   * @rmtoll ICR          ALERTCF       LL_I2C_ClearSMBusFlag_ALERT
01855   * @param  I2Cx I2C Instance.
01856   * @retval None
01857   */
01858 __STATIC_INLINE void LL_I2C_ClearSMBusFlag_ALERT(I2C_TypeDef *I2Cx)
01859 {
01860   SET_BIT(I2Cx->ICR, I2C_ICR_ALERTCF);
01861 }
01862 
01863 /**
01864   * @}
01865   */
01866 
01867 /** @defgroup I2C_LL_EF_Data_Management Data_Management
01868   * @{
01869   */
01870 
01871 /**
01872   * @brief  Enable automatic STOP condition generation (master mode).
01873   * @note   Automatic end mode : a STOP condition is automatically sent when NBYTES data are transferred.
01874   *         This bit has no effect in slave mode or when RELOAD bit is set.
01875   * @rmtoll CR2          AUTOEND       LL_I2C_EnableAutoEndMode
01876   * @param  I2Cx I2C Instance.
01877   * @retval None
01878   */
01879 __STATIC_INLINE void LL_I2C_EnableAutoEndMode(I2C_TypeDef *I2Cx)
01880 {
01881   SET_BIT(I2Cx->CR2, I2C_CR2_AUTOEND);
01882 }
01883 
01884 /**
01885   * @brief  Disable automatic STOP condition generation (master mode).
01886   * @note   Software end mode : TC flag is set when NBYTES data are transferre, stretching SCL low.
01887   * @rmtoll CR2          AUTOEND       LL_I2C_DisableAutoEndMode
01888   * @param  I2Cx I2C Instance.
01889   * @retval None
01890   */
01891 __STATIC_INLINE void LL_I2C_DisableAutoEndMode(I2C_TypeDef *I2Cx)
01892 {
01893   CLEAR_BIT(I2Cx->CR2, I2C_CR2_AUTOEND);
01894 }
01895 
01896 /**
01897   * @brief  Check if automatic STOP condition is enabled or disabled.
01898   * @rmtoll CR2          AUTOEND       LL_I2C_IsEnabledAutoEndMode
01899   * @param  I2Cx I2C Instance.
01900   * @retval State of bit (1 or 0).
01901   */
01902 __STATIC_INLINE uint32_t LL_I2C_IsEnabledAutoEndMode(I2C_TypeDef *I2Cx)
01903 {
01904   return ((READ_BIT(I2Cx->CR2, I2C_CR2_AUTOEND) == (I2C_CR2_AUTOEND)) ? 1UL : 0UL);
01905 }
01906 
01907 /**
01908   * @brief  Enable reload mode (master mode).
01909   * @note   The transfer is not completed after the NBYTES data transfer, NBYTES will be reloaded when TCR flag is set.
01910   * @rmtoll CR2          RELOAD       LL_I2C_EnableReloadMode
01911   * @param  I2Cx I2C Instance.
01912   * @retval None
01913   */
01914 __STATIC_INLINE void LL_I2C_EnableReloadMode(I2C_TypeDef *I2Cx)
01915 {
01916   SET_BIT(I2Cx->CR2, I2C_CR2_RELOAD);
01917 }
01918 
01919 /**
01920   * @brief  Disable reload mode (master mode).
01921   * @note   The transfer is completed after the NBYTES data transfer(STOP or RESTART will follow).
01922   * @rmtoll CR2          RELOAD       LL_I2C_DisableReloadMode
01923   * @param  I2Cx I2C Instance.
01924   * @retval None
01925   */
01926 __STATIC_INLINE void LL_I2C_DisableReloadMode(I2C_TypeDef *I2Cx)
01927 {
01928   CLEAR_BIT(I2Cx->CR2, I2C_CR2_RELOAD);
01929 }
01930 
01931 /**
01932   * @brief  Check if reload mode is enabled or disabled.
01933   * @rmtoll CR2          RELOAD       LL_I2C_IsEnabledReloadMode
01934   * @param  I2Cx I2C Instance.
01935   * @retval State of bit (1 or 0).
01936   */
01937 __STATIC_INLINE uint32_t LL_I2C_IsEnabledReloadMode(I2C_TypeDef *I2Cx)
01938 {
01939   return ((READ_BIT(I2Cx->CR2, I2C_CR2_RELOAD) == (I2C_CR2_RELOAD)) ? 1UL : 0UL);
01940 }
01941 
01942 /**
01943   * @brief  Configure the number of bytes for transfer.
01944   * @note   Changing these bits when START bit is set is not allowed.
01945   * @rmtoll CR2          NBYTES           LL_I2C_SetTransferSize
01946   * @param  I2Cx I2C Instance.
01947   * @param  TransferSize This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
01948   * @retval None
01949   */
01950 __STATIC_INLINE void LL_I2C_SetTransferSize(I2C_TypeDef *I2Cx, uint32_t TransferSize)
01951 {
01952   MODIFY_REG(I2Cx->CR2, I2C_CR2_NBYTES, TransferSize << I2C_CR2_NBYTES_Pos);
01953 }
01954 
01955 /**
01956   * @brief  Get the number of bytes configured for transfer.
01957   * @rmtoll CR2          NBYTES           LL_I2C_GetTransferSize
01958   * @param  I2Cx I2C Instance.
01959   * @retval Value between Min_Data=0x0 and Max_Data=0xFF
01960   */
01961 __STATIC_INLINE uint32_t LL_I2C_GetTransferSize(I2C_TypeDef *I2Cx)
01962 {
01963   return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_NBYTES) >> I2C_CR2_NBYTES_Pos);
01964 }
01965 
01966 /**
01967   * @brief  Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code
01968             or next received byte.
01969   * @note   Usage in Slave mode only.
01970   * @rmtoll CR2          NACK          LL_I2C_AcknowledgeNextData
01971   * @param  I2Cx I2C Instance.
01972   * @param  TypeAcknowledge This parameter can be one of the following values:
01973   *         @arg @ref LL_I2C_ACK
01974   *         @arg @ref LL_I2C_NACK
01975   * @retval None
01976   */
01977 __STATIC_INLINE void LL_I2C_AcknowledgeNextData(I2C_TypeDef *I2Cx, uint32_t TypeAcknowledge)
01978 {
01979   MODIFY_REG(I2Cx->CR2, I2C_CR2_NACK, TypeAcknowledge);
01980 }
01981 
01982 /**
01983   * @brief  Generate a START or RESTART condition
01984   * @note   The START bit can be set even if bus is BUSY or I2C is in slave mode.
01985   *         This action has no effect when RELOAD is set.
01986   * @rmtoll CR2          START           LL_I2C_GenerateStartCondition
01987   * @param  I2Cx I2C Instance.
01988   * @retval None
01989   */
01990 __STATIC_INLINE void LL_I2C_GenerateStartCondition(I2C_TypeDef *I2Cx)
01991 {
01992   SET_BIT(I2Cx->CR2, I2C_CR2_START);
01993 }
01994 
01995 /**
01996   * @brief  Generate a STOP condition after the current byte transfer (master mode).
01997   * @rmtoll CR2          STOP          LL_I2C_GenerateStopCondition
01998   * @param  I2Cx I2C Instance.
01999   * @retval None
02000   */
02001 __STATIC_INLINE void LL_I2C_GenerateStopCondition(I2C_TypeDef *I2Cx)
02002 {
02003   SET_BIT(I2Cx->CR2, I2C_CR2_STOP);
02004 }
02005 
02006 /**
02007   * @brief  Enable automatic RESTART Read request condition for 10bit address header (master mode).
02008   * @note   The master sends the complete 10bit slave address read sequence :
02009   *         Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address
02010             in Read direction.
02011   * @rmtoll CR2          HEAD10R       LL_I2C_EnableAuto10BitRead
02012   * @param  I2Cx I2C Instance.
02013   * @retval None
02014   */
02015 __STATIC_INLINE void LL_I2C_EnableAuto10BitRead(I2C_TypeDef *I2Cx)
02016 {
02017   CLEAR_BIT(I2Cx->CR2, I2C_CR2_HEAD10R);
02018 }
02019 
02020 /**
02021   * @brief  Disable automatic RESTART Read request condition for 10bit address header (master mode).
02022   * @note   The master only sends the first 7 bits of 10bit address in Read direction.
02023   * @rmtoll CR2          HEAD10R       LL_I2C_DisableAuto10BitRead
02024   * @param  I2Cx I2C Instance.
02025   * @retval None
02026   */
02027 __STATIC_INLINE void LL_I2C_DisableAuto10BitRead(I2C_TypeDef *I2Cx)
02028 {
02029   SET_BIT(I2Cx->CR2, I2C_CR2_HEAD10R);
02030 }
02031 
02032 /**
02033   * @brief  Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled.
02034   * @rmtoll CR2          HEAD10R       LL_I2C_IsEnabledAuto10BitRead
02035   * @param  I2Cx I2C Instance.
02036   * @retval State of bit (1 or 0).
02037   */
02038 __STATIC_INLINE uint32_t LL_I2C_IsEnabledAuto10BitRead(I2C_TypeDef *I2Cx)
02039 {
02040   return ((READ_BIT(I2Cx->CR2, I2C_CR2_HEAD10R) != (I2C_CR2_HEAD10R)) ? 1UL : 0UL);
02041 }
02042 
02043 /**
02044   * @brief  Configure the transfer direction (master mode).
02045   * @note   Changing these bits when START bit is set is not allowed.
02046   * @rmtoll CR2          RD_WRN           LL_I2C_SetTransferRequest
02047   * @param  I2Cx I2C Instance.
02048   * @param  TransferRequest This parameter can be one of the following values:
02049   *         @arg @ref LL_I2C_REQUEST_WRITE
02050   *         @arg @ref LL_I2C_REQUEST_READ
02051   * @retval None
02052   */
02053 __STATIC_INLINE void LL_I2C_SetTransferRequest(I2C_TypeDef *I2Cx, uint32_t TransferRequest)
02054 {
02055   MODIFY_REG(I2Cx->CR2, I2C_CR2_RD_WRN, TransferRequest);
02056 }
02057 
02058 /**
02059   * @brief  Get the transfer direction requested (master mode).
02060   * @rmtoll CR2          RD_WRN           LL_I2C_GetTransferRequest
02061   * @param  I2Cx I2C Instance.
02062   * @retval Returned value can be one of the following values:
02063   *         @arg @ref LL_I2C_REQUEST_WRITE
02064   *         @arg @ref LL_I2C_REQUEST_READ
02065   */
02066 __STATIC_INLINE uint32_t LL_I2C_GetTransferRequest(I2C_TypeDef *I2Cx)
02067 {
02068   return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_RD_WRN));
02069 }
02070 
02071 /**
02072   * @brief  Configure the slave address for transfer (master mode).
02073   * @note   Changing these bits when START bit is set is not allowed.
02074   * @rmtoll CR2          SADD           LL_I2C_SetSlaveAddr
02075   * @param  I2Cx I2C Instance.
02076   * @param  SlaveAddr This parameter must be a value between Min_Data=0x00 and Max_Data=0x3F.
02077   * @retval None
02078   */
02079 __STATIC_INLINE void LL_I2C_SetSlaveAddr(I2C_TypeDef *I2Cx, uint32_t SlaveAddr)
02080 {
02081   MODIFY_REG(I2Cx->CR2, I2C_CR2_SADD, SlaveAddr);
02082 }
02083 
02084 /**
02085   * @brief  Get the slave address programmed for transfer.
02086   * @rmtoll CR2          SADD           LL_I2C_GetSlaveAddr
02087   * @param  I2Cx I2C Instance.
02088   * @retval Value between Min_Data=0x0 and Max_Data=0x3F
02089   */
02090 __STATIC_INLINE uint32_t LL_I2C_GetSlaveAddr(I2C_TypeDef *I2Cx)
02091 {
02092   return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_SADD));
02093 }
02094 
02095 /**
02096   * @brief  Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).
02097   * @rmtoll CR2          SADD          LL_I2C_HandleTransfer\n
02098   *         CR2          ADD10         LL_I2C_HandleTransfer\n
02099   *         CR2          RD_WRN        LL_I2C_HandleTransfer\n
02100   *         CR2          START         LL_I2C_HandleTransfer\n
02101   *         CR2          STOP          LL_I2C_HandleTransfer\n
02102   *         CR2          RELOAD        LL_I2C_HandleTransfer\n
02103   *         CR2          NBYTES        LL_I2C_HandleTransfer\n
02104   *         CR2          AUTOEND       LL_I2C_HandleTransfer\n
02105   *         CR2          HEAD10R       LL_I2C_HandleTransfer
02106   * @param  I2Cx I2C Instance.
02107   * @param  SlaveAddr Specifies the slave address to be programmed.
02108   * @param  SlaveAddrSize This parameter can be one of the following values:
02109   *         @arg @ref LL_I2C_ADDRSLAVE_7BIT
02110   *         @arg @ref LL_I2C_ADDRSLAVE_10BIT
02111   * @param  TransferSize Specifies the number of bytes to be programmed.
02112   *                       This parameter must be a value between Min_Data=0 and Max_Data=255.
02113   * @param  EndMode This parameter can be one of the following values:
02114   *         @arg @ref LL_I2C_MODE_RELOAD
02115   *         @arg @ref LL_I2C_MODE_AUTOEND
02116   *         @arg @ref LL_I2C_MODE_SOFTEND
02117   *         @arg @ref LL_I2C_MODE_SMBUS_RELOAD
02118   *         @arg @ref LL_I2C_MODE_SMBUS_AUTOEND_NO_PEC
02119   *         @arg @ref LL_I2C_MODE_SMBUS_SOFTEND_NO_PEC
02120   *         @arg @ref LL_I2C_MODE_SMBUS_AUTOEND_WITH_PEC
02121   *         @arg @ref LL_I2C_MODE_SMBUS_SOFTEND_WITH_PEC
02122   * @param  Request This parameter can be one of the following values:
02123   *         @arg @ref LL_I2C_GENERATE_NOSTARTSTOP
02124   *         @arg @ref LL_I2C_GENERATE_STOP
02125   *         @arg @ref LL_I2C_GENERATE_START_READ
02126   *         @arg @ref LL_I2C_GENERATE_START_WRITE
02127   *         @arg @ref LL_I2C_GENERATE_RESTART_7BIT_READ
02128   *         @arg @ref LL_I2C_GENERATE_RESTART_7BIT_WRITE
02129   *         @arg @ref LL_I2C_GENERATE_RESTART_10BIT_READ
02130   *         @arg @ref LL_I2C_GENERATE_RESTART_10BIT_WRITE
02131   * @retval None
02132   */
02133 __STATIC_INLINE void LL_I2C_HandleTransfer(I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize,
02134                                            uint32_t TransferSize, uint32_t EndMode, uint32_t Request)
02135 {
02136   MODIFY_REG(I2Cx->CR2, I2C_CR2_SADD | I2C_CR2_ADD10 |
02137              (I2C_CR2_RD_WRN & (uint32_t)(Request >> (31U - I2C_CR2_RD_WRN_Pos))) |
02138              I2C_CR2_START | I2C_CR2_STOP | I2C_CR2_RELOAD |
02139              I2C_CR2_NBYTES | I2C_CR2_AUTOEND | I2C_CR2_HEAD10R,
02140              SlaveAddr | SlaveAddrSize | (TransferSize << I2C_CR2_NBYTES_Pos) | EndMode | Request);
02141 }
02142 
02143 /**
02144   * @brief  Indicate the value of transfer direction (slave mode).
02145   * @note   RESET: Write transfer, Slave enters in receiver mode.
02146   *         SET: Read transfer, Slave enters in transmitter mode.
02147   * @rmtoll ISR          DIR           LL_I2C_GetTransferDirection
02148   * @param  I2Cx I2C Instance.
02149   * @retval Returned value can be one of the following values:
02150   *         @arg @ref LL_I2C_DIRECTION_WRITE
02151   *         @arg @ref LL_I2C_DIRECTION_READ
02152   */
02153 __STATIC_INLINE uint32_t LL_I2C_GetTransferDirection(I2C_TypeDef *I2Cx)
02154 {
02155   return (uint32_t)(READ_BIT(I2Cx->ISR, I2C_ISR_DIR));
02156 }
02157 
02158 /**
02159   * @brief  Return the slave matched address.
02160   * @rmtoll ISR          ADDCODE       LL_I2C_GetAddressMatchCode
02161   * @param  I2Cx I2C Instance.
02162   * @retval Value between Min_Data=0x00 and Max_Data=0x3F
02163   */
02164 __STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode(I2C_TypeDef *I2Cx)
02165 {
02166   return (uint32_t)(READ_BIT(I2Cx->ISR, I2C_ISR_ADDCODE) >> I2C_ISR_ADDCODE_Pos << 1);
02167 }
02168 
02169 /**
02170   * @brief  Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode).
02171   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
02172   *         SMBus feature is supported by the I2Cx Instance.
02173   * @note   This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition
02174             or an Address Matched is received.
02175   *         This bit has no effect when RELOAD bit is set.
02176   *         This bit has no effect in device mode when SBC bit is not set.
02177   * @rmtoll CR2          PECBYTE       LL_I2C_EnableSMBusPECCompare
02178   * @param  I2Cx I2C Instance.
02179   * @retval None
02180   */
02181 __STATIC_INLINE void LL_I2C_EnableSMBusPECCompare(I2C_TypeDef *I2Cx)
02182 {
02183   SET_BIT(I2Cx->CR2, I2C_CR2_PECBYTE);
02184 }
02185 
02186 /**
02187   * @brief  Check if the SMBus Packet Error byte internal comparison is requested or not.
02188   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
02189   *         SMBus feature is supported by the I2Cx Instance.
02190   * @rmtoll CR2          PECBYTE       LL_I2C_IsEnabledSMBusPECCompare
02191   * @param  I2Cx I2C Instance.
02192   * @retval State of bit (1 or 0).
02193   */
02194 __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare(I2C_TypeDef *I2Cx)
02195 {
02196   return ((READ_BIT(I2Cx->CR2, I2C_CR2_PECBYTE) == (I2C_CR2_PECBYTE)) ? 1UL : 0UL);
02197 }
02198 
02199 /**
02200   * @brief  Get the SMBus Packet Error byte calculated.
02201   * @note   The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not
02202   *         SMBus feature is supported by the I2Cx Instance.
02203   * @rmtoll PECR         PEC           LL_I2C_GetSMBusPEC
02204   * @param  I2Cx I2C Instance.
02205   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
02206   */
02207 __STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC(I2C_TypeDef *I2Cx)
02208 {
02209   return (uint32_t)(READ_BIT(I2Cx->PECR, I2C_PECR_PEC));
02210 }
02211 
02212 /**
02213   * @brief  Read Receive Data register.
02214   * @rmtoll RXDR         RXDATA        LL_I2C_ReceiveData8
02215   * @param  I2Cx I2C Instance.
02216   * @retval Value between Min_Data=0x00 and Max_Data=0xFF
02217   */
02218 __STATIC_INLINE uint8_t LL_I2C_ReceiveData8(I2C_TypeDef *I2Cx)
02219 {
02220   return (uint8_t)(READ_BIT(I2Cx->RXDR, I2C_RXDR_RXDATA));
02221 }
02222 
02223 /**
02224   * @brief  Write in Transmit Data Register .
02225   * @rmtoll TXDR         TXDATA        LL_I2C_TransmitData8
02226   * @param  I2Cx I2C Instance.
02227   * @param  Data Value between Min_Data=0x00 and Max_Data=0xFF
02228   * @retval None
02229   */
02230 __STATIC_INLINE void LL_I2C_TransmitData8(I2C_TypeDef *I2Cx, uint8_t Data)
02231 {
02232   WRITE_REG(I2Cx->TXDR, Data);
02233 }
02234 
02235 /**
02236   * @}
02237   */
02238 
02239 #if defined(USE_FULL_LL_DRIVER)
02240 /** @defgroup I2C_LL_EF_Init Initialization and de-initialization functions
02241   * @{
02242   */
02243 
02244 ErrorStatus LL_I2C_Init(I2C_TypeDef *I2Cx, LL_I2C_InitTypeDef *I2C_InitStruct);
02245 ErrorStatus LL_I2C_DeInit(I2C_TypeDef *I2Cx);
02246 void LL_I2C_StructInit(LL_I2C_InitTypeDef *I2C_InitStruct);
02247 
02248 
02249 /**
02250   * @}
02251   */
02252 #endif /* USE_FULL_LL_DRIVER */
02253 
02254 /**
02255   * @}
02256   */
02257 
02258 /**
02259   * @}
02260   */
02261 
02262 #endif /* I2C1 || I2C2 || I2C3 || I2C4 */
02263 
02264 /**
02265   * @}
02266   */
02267 
02268 #ifdef __cplusplus
02269 }
02270 #endif
02271 
02272 #endif /* STM32L4xx_LL_I2C_H */