STM32F479xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_ll_fmpi2c.h 00004 * @author MCD Application Team 00005 * @brief Header file of FMPI2C LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© Copyright (c) 2016 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Define to prevent recursive inclusion -------------------------------------*/ 00021 #ifndef STM32F4xx_LL_FMPI2C_H 00022 #define STM32F4xx_LL_FMPI2C_H 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 #if defined(FMPI2C_CR1_PE) 00029 /* Includes ------------------------------------------------------------------*/ 00030 #include "stm32f4xx.h" 00031 00032 /** @addtogroup STM32F4xx_LL_Driver 00033 * @{ 00034 */ 00035 00036 #if defined (FMPI2C1) 00037 00038 /** @defgroup FMPI2C_LL FMPI2C 00039 * @{ 00040 */ 00041 00042 /* Private types -------------------------------------------------------------*/ 00043 /* Private variables ---------------------------------------------------------*/ 00044 00045 /* Private constants ---------------------------------------------------------*/ 00046 /** @defgroup FMPI2C_LL_Private_Constants FMPI2C Private Constants 00047 * @{ 00048 */ 00049 /** 00050 * @} 00051 */ 00052 00053 /* Private macros ------------------------------------------------------------*/ 00054 #if defined(USE_FULL_LL_DRIVER) 00055 /** @defgroup FMPI2C_LL_Private_Macros FMPI2C Private Macros 00056 * @{ 00057 */ 00058 /** 00059 * @} 00060 */ 00061 #endif /*USE_FULL_LL_DRIVER*/ 00062 00063 /* Exported types ------------------------------------------------------------*/ 00064 #if defined(USE_FULL_LL_DRIVER) 00065 /** @defgroup FMPI2C_LL_ES_INIT FMPI2C Exported Init structure 00066 * @{ 00067 */ 00068 typedef struct 00069 { 00070 uint32_t PeripheralMode; /*!< Specifies the peripheral mode. 00071 This parameter can be a value of @ref FMPI2C_LL_EC_PERIPHERAL_MODE. 00072 00073 This feature can be modified afterwards using unitary function 00074 @ref LL_FMPI2C_SetMode(). */ 00075 00076 uint32_t Timing; /*!< Specifies the SDA setup, hold time and the SCL high, low period values. 00077 This parameter must be set by referring to the STM32CubeMX Tool and 00078 the helper macro @ref __LL_FMPI2C_CONVERT_TIMINGS(). 00079 00080 This feature can be modified afterwards using unitary function 00081 @ref LL_FMPI2C_SetTiming(). */ 00082 00083 uint32_t AnalogFilter; /*!< Enables or disables analog noise filter. 00084 This parameter can be a value of @ref FMPI2C_LL_EC_ANALOGFILTER_SELECTION. 00085 00086 This feature can be modified afterwards using unitary functions 00087 @ref LL_FMPI2C_EnableAnalogFilter() or LL_FMPI2C_DisableAnalogFilter(). */ 00088 00089 uint32_t DigitalFilter; /*!< Configures the digital noise filter. 00090 This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F. 00091 00092 This feature can be modified afterwards using unitary function 00093 @ref LL_FMPI2C_SetDigitalFilter(). */ 00094 00095 uint32_t OwnAddress1; /*!< Specifies the device own address 1. 00096 This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF. 00097 00098 This feature can be modified afterwards using unitary function 00099 @ref LL_FMPI2C_SetOwnAddress1(). */ 00100 00101 uint32_t TypeAcknowledge; /*!< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive 00102 match code or next received byte. 00103 This parameter can be a value of @ref FMPI2C_LL_EC_I2C_ACKNOWLEDGE. 00104 00105 This feature can be modified afterwards using unitary function 00106 @ref LL_FMPI2C_AcknowledgeNextData(). */ 00107 00108 uint32_t OwnAddrSize; /*!< Specifies the device own address 1 size (7-bit or 10-bit). 00109 This parameter can be a value of @ref FMPI2C_LL_EC_OWNADDRESS1. 00110 00111 This feature can be modified afterwards using unitary function 00112 @ref LL_FMPI2C_SetOwnAddress1(). */ 00113 } LL_FMPI2C_InitTypeDef; 00114 /** 00115 * @} 00116 */ 00117 #endif /*USE_FULL_LL_DRIVER*/ 00118 00119 /* Exported constants --------------------------------------------------------*/ 00120 /** @defgroup FMPI2C_LL_Exported_Constants FMPI2C Exported Constants 00121 * @{ 00122 */ 00123 00124 /** @defgroup FMPI2C_LL_EC_CLEAR_FLAG Clear Flags Defines 00125 * @brief Flags defines which can be used with LL_FMPI2C_WriteReg function 00126 * @{ 00127 */ 00128 #define LL_FMPI2C_ICR_ADDRCF FMPI2C_ICR_ADDRCF /*!< Address Matched flag */ 00129 #define LL_FMPI2C_ICR_NACKCF FMPI2C_ICR_NACKCF /*!< Not Acknowledge flag */ 00130 #define LL_FMPI2C_ICR_STOPCF FMPI2C_ICR_STOPCF /*!< Stop detection flag */ 00131 #define LL_FMPI2C_ICR_BERRCF FMPI2C_ICR_BERRCF /*!< Bus error flag */ 00132 #define LL_FMPI2C_ICR_ARLOCF FMPI2C_ICR_ARLOCF /*!< Arbitration Lost flag */ 00133 #define LL_FMPI2C_ICR_OVRCF FMPI2C_ICR_OVRCF /*!< Overrun/Underrun flag */ 00134 #define LL_FMPI2C_ICR_PECCF FMPI2C_ICR_PECCF /*!< PEC error flag */ 00135 #define LL_FMPI2C_ICR_TIMOUTCF FMPI2C_ICR_TIMOUTCF /*!< Timeout detection flag */ 00136 #define LL_FMPI2C_ICR_ALERTCF FMPI2C_ICR_ALERTCF /*!< Alert flag */ 00137 /** 00138 * @} 00139 */ 00140 00141 /** @defgroup FMPI2C_LL_EC_GET_FLAG Get Flags Defines 00142 * @brief Flags defines which can be used with LL_FMPI2C_ReadReg function 00143 * @{ 00144 */ 00145 #define LL_FMPI2C_ISR_TXE FMPI2C_ISR_TXE /*!< Transmit data register empty */ 00146 #define LL_FMPI2C_ISR_TXIS FMPI2C_ISR_TXIS /*!< Transmit interrupt status */ 00147 #define LL_FMPI2C_ISR_RXNE FMPI2C_ISR_RXNE /*!< Receive data register not empty */ 00148 #define LL_FMPI2C_ISR_ADDR FMPI2C_ISR_ADDR /*!< Address matched (slave mode) */ 00149 #define LL_FMPI2C_ISR_NACKF FMPI2C_ISR_NACKF /*!< Not Acknowledge received flag */ 00150 #define LL_FMPI2C_ISR_STOPF FMPI2C_ISR_STOPF /*!< Stop detection flag */ 00151 #define LL_FMPI2C_ISR_TC FMPI2C_ISR_TC /*!< Transfer Complete (master mode) */ 00152 #define LL_FMPI2C_ISR_TCR FMPI2C_ISR_TCR /*!< Transfer Complete Reload */ 00153 #define LL_FMPI2C_ISR_BERR FMPI2C_ISR_BERR /*!< Bus error */ 00154 #define LL_FMPI2C_ISR_ARLO FMPI2C_ISR_ARLO /*!< Arbitration lost */ 00155 #define LL_FMPI2C_ISR_OVR FMPI2C_ISR_OVR /*!< Overrun/Underrun (slave mode) */ 00156 #define LL_FMPI2C_ISR_PECERR FMPI2C_ISR_PECERR /*!< PEC Error in reception (SMBus mode) */ 00157 #define LL_FMPI2C_ISR_TIMEOUT FMPI2C_ISR_TIMEOUT /*!< Timeout detection flag (SMBus mode) */ 00158 #define LL_FMPI2C_ISR_ALERT FMPI2C_ISR_ALERT /*!< SMBus alert (SMBus mode) */ 00159 #define LL_FMPI2C_ISR_BUSY FMPI2C_ISR_BUSY /*!< Bus busy */ 00160 /** 00161 * @} 00162 */ 00163 00164 /** @defgroup FMPI2C_LL_EC_IT IT Defines 00165 * @brief IT defines which can be used with LL_FMPI2C_ReadReg and LL_FMPI2C_WriteReg functions 00166 * @{ 00167 */ 00168 #define LL_FMPI2C_CR1_TXIE FMPI2C_CR1_TXIE /*!< TX Interrupt enable */ 00169 #define LL_FMPI2C_CR1_RXIE FMPI2C_CR1_RXIE /*!< RX Interrupt enable */ 00170 #define LL_FMPI2C_CR1_ADDRIE FMPI2C_CR1_ADDRIE /*!< Address match Interrupt enable (slave only) */ 00171 #define LL_FMPI2C_CR1_NACKIE FMPI2C_CR1_NACKIE /*!< Not acknowledge received Interrupt enable */ 00172 #define LL_FMPI2C_CR1_STOPIE FMPI2C_CR1_STOPIE /*!< STOP detection Interrupt enable */ 00173 #define LL_FMPI2C_CR1_TCIE FMPI2C_CR1_TCIE /*!< Transfer Complete interrupt enable */ 00174 #define LL_FMPI2C_CR1_ERRIE FMPI2C_CR1_ERRIE /*!< Error interrupts enable */ 00175 /** 00176 * @} 00177 */ 00178 00179 /** @defgroup FMPI2C_LL_EC_PERIPHERAL_MODE Peripheral Mode 00180 * @{ 00181 */ 00182 #define LL_FMPI2C_MODE_I2C 0x00000000U /*!< FMPI2C Master or Slave mode */ 00183 #define LL_FMPI2C_MODE_SMBUS_HOST FMPI2C_CR1_SMBHEN /*!< SMBus Host address acknowledge */ 00184 #define LL_FMPI2C_MODE_SMBUS_DEVICE 0x00000000U /*!< SMBus Device default mode 00185 (Default address not acknowledge) */ 00186 #define LL_FMPI2C_MODE_SMBUS_DEVICE_ARP FMPI2C_CR1_SMBDEN /*!< SMBus Device Default address acknowledge */ 00187 /** 00188 * @} 00189 */ 00190 00191 /** @defgroup FMPI2C_LL_EC_ANALOGFILTER_SELECTION Analog Filter Selection 00192 * @{ 00193 */ 00194 #define LL_FMPI2C_ANALOGFILTER_ENABLE 0x00000000U /*!< Analog filter is enabled. */ 00195 #define LL_FMPI2C_ANALOGFILTER_DISABLE FMPI2C_CR1_ANFOFF /*!< Analog filter is disabled. */ 00196 /** 00197 * @} 00198 */ 00199 00200 /** @defgroup FMPI2C_LL_EC_ADDRESSING_MODE Master Addressing Mode 00201 * @{ 00202 */ 00203 #define LL_FMPI2C_ADDRESSING_MODE_7BIT 0x00000000U /*!< Master operates in 7-bit addressing mode. */ 00204 #define LL_FMPI2C_ADDRESSING_MODE_10BIT FMPI2C_CR2_ADD10 /*!< Master operates in 10-bit addressing mode.*/ 00205 /** 00206 * @} 00207 */ 00208 00209 /** @defgroup FMPI2C_LL_EC_OWNADDRESS1 Own Address 1 Length 00210 * @{ 00211 */ 00212 #define LL_FMPI2C_OWNADDRESS1_7BIT 0x00000000U /*!< Own address 1 is a 7-bit address. */ 00213 #define LL_FMPI2C_OWNADDRESS1_10BIT FMPI2C_OAR1_OA1MODE /*!< Own address 1 is a 10-bit address.*/ 00214 /** 00215 * @} 00216 */ 00217 00218 /** @defgroup FMPI2C_LL_EC_OWNADDRESS2 Own Address 2 Masks 00219 * @{ 00220 */ 00221 #define LL_FMPI2C_OWNADDRESS2_NOMASK FMPI2C_OAR2_OA2NOMASK /*!< Own Address2 No mask. */ 00222 #define LL_FMPI2C_OWNADDRESS2_MASK01 FMPI2C_OAR2_OA2MASK01 /*!< Only Address2 bits[7:2] are compared. */ 00223 #define LL_FMPI2C_OWNADDRESS2_MASK02 FMPI2C_OAR2_OA2MASK02 /*!< Only Address2 bits[7:3] are compared. */ 00224 #define LL_FMPI2C_OWNADDRESS2_MASK03 FMPI2C_OAR2_OA2MASK03 /*!< Only Address2 bits[7:4] are compared. */ 00225 #define LL_FMPI2C_OWNADDRESS2_MASK04 FMPI2C_OAR2_OA2MASK04 /*!< Only Address2 bits[7:5] are compared. */ 00226 #define LL_FMPI2C_OWNADDRESS2_MASK05 FMPI2C_OAR2_OA2MASK05 /*!< Only Address2 bits[7:6] are compared. */ 00227 #define LL_FMPI2C_OWNADDRESS2_MASK06 FMPI2C_OAR2_OA2MASK06 /*!< Only Address2 bits[7] are compared. */ 00228 #define LL_FMPI2C_OWNADDRESS2_MASK07 FMPI2C_OAR2_OA2MASK07 /*!< No comparison is done. 00229 All Address2 are acknowledged. */ 00230 /** 00231 * @} 00232 */ 00233 00234 /** @defgroup FMPI2C_LL_EC_I2C_ACKNOWLEDGE Acknowledge Generation 00235 * @{ 00236 */ 00237 #define LL_FMPI2C_ACK 0x00000000U /*!< ACK is sent after current received byte. */ 00238 #define LL_FMPI2C_NACK FMPI2C_CR2_NACK /*!< NACK is sent after current received byte.*/ 00239 /** 00240 * @} 00241 */ 00242 00243 /** @defgroup FMPI2C_LL_EC_ADDRSLAVE Slave Address Length 00244 * @{ 00245 */ 00246 #define LL_FMPI2C_ADDRSLAVE_7BIT 0x00000000U /*!< Slave Address in 7-bit. */ 00247 #define LL_FMPI2C_ADDRSLAVE_10BIT FMPI2C_CR2_ADD10 /*!< Slave Address in 10-bit.*/ 00248 /** 00249 * @} 00250 */ 00251 00252 /** @defgroup FMPI2C_LL_EC_REQUEST Transfer Request Direction 00253 * @{ 00254 */ 00255 #define LL_FMPI2C_REQUEST_WRITE 0x00000000U /*!< Master request a write transfer. */ 00256 #define LL_FMPI2C_REQUEST_READ FMPI2C_CR2_RD_WRN /*!< Master request a read transfer. */ 00257 /** 00258 * @} 00259 */ 00260 00261 /** @defgroup FMPI2C_LL_EC_MODE Transfer End Mode 00262 * @{ 00263 */ 00264 #define LL_FMPI2C_MODE_RELOAD FMPI2C_CR2_RELOAD /*!< Enable FMPI2C Reload mode. */ 00265 #define LL_FMPI2C_MODE_AUTOEND FMPI2C_CR2_AUTOEND /*!< Enable FMPI2C Automatic end mode 00266 with no HW PEC comparison. */ 00267 #define LL_FMPI2C_MODE_SOFTEND 0x00000000U /*!< Enable FMPI2C Software end mode 00268 with no HW PEC comparison. */ 00269 #define LL_FMPI2C_MODE_SMBUS_RELOAD LL_FMPI2C_MODE_RELOAD /*!< Enable FMPSMBUS Automatic end mode 00270 with HW PEC comparison. */ 00271 #define LL_FMPI2C_MODE_SMBUS_AUTOEND_NO_PEC LL_FMPI2C_MODE_AUTOEND /*!< Enable FMPSMBUS Automatic end mode 00272 with HW PEC comparison. */ 00273 #define LL_FMPI2C_MODE_SMBUS_SOFTEND_NO_PEC LL_FMPI2C_MODE_SOFTEND /*!< Enable FMPSMBUS Software end mode 00274 with HW PEC comparison. */ 00275 #define LL_FMPI2C_MODE_SMBUS_AUTOEND_WITH_PEC (uint32_t)(LL_FMPI2C_MODE_AUTOEND | FMPI2C_CR2_PECBYTE) 00276 /*!< Enable FMPSMBUS Automatic end mode with HW PEC comparison. */ 00277 #define LL_FMPI2C_MODE_SMBUS_SOFTEND_WITH_PEC (uint32_t)(LL_FMPI2C_MODE_SOFTEND | FMPI2C_CR2_PECBYTE) 00278 /*!< Enable FMPSMBUS Software end mode with HW PEC comparison. */ 00279 /** 00280 * @} 00281 */ 00282 00283 /** @defgroup FMPI2C_LL_EC_GENERATE Start And Stop Generation 00284 * @{ 00285 */ 00286 #define LL_FMPI2C_GENERATE_NOSTARTSTOP 0x00000000U 00287 /*!< Don't Generate Stop and Start condition. */ 00288 #define LL_FMPI2C_GENERATE_STOP (uint32_t)(0x80000000U | FMPI2C_CR2_STOP) 00289 /*!< Generate Stop condition (Size should be set to 0). */ 00290 #define LL_FMPI2C_GENERATE_START_READ (uint32_t)(0x80000000U | FMPI2C_CR2_START | FMPI2C_CR2_RD_WRN) 00291 /*!< Generate Start for read request. */ 00292 #define LL_FMPI2C_GENERATE_START_WRITE (uint32_t)(0x80000000U | FMPI2C_CR2_START) 00293 /*!< Generate Start for write request. */ 00294 #define LL_FMPI2C_GENERATE_RESTART_7BIT_READ (uint32_t)(0x80000000U | FMPI2C_CR2_START | FMPI2C_CR2_RD_WRN) 00295 /*!< Generate Restart for read request, slave 7Bit address. */ 00296 #define LL_FMPI2C_GENERATE_RESTART_7BIT_WRITE (uint32_t)(0x80000000U | FMPI2C_CR2_START) 00297 /*!< Generate Restart for write request, slave 7Bit address. */ 00298 #define LL_FMPI2C_GENERATE_RESTART_10BIT_READ (uint32_t)(0x80000000U | FMPI2C_CR2_START | \ 00299 FMPI2C_CR2_RD_WRN | FMPI2C_CR2_HEAD10R) 00300 /*!< Generate Restart for read request, slave 10Bit address. */ 00301 #define LL_FMPI2C_GENERATE_RESTART_10BIT_WRITE (uint32_t)(0x80000000U | FMPI2C_CR2_START) 00302 /*!< Generate Restart for write request, slave 10Bit address.*/ 00303 /** 00304 * @} 00305 */ 00306 00307 /** @defgroup FMPI2C_LL_EC_DIRECTION Read Write Direction 00308 * @{ 00309 */ 00310 #define LL_FMPI2C_DIRECTION_WRITE 0x00000000U /*!< Write transfer request by master, 00311 slave enters receiver mode. */ 00312 #define LL_FMPI2C_DIRECTION_READ FMPI2C_ISR_DIR /*!< Read transfer request by master, 00313 slave enters transmitter mode.*/ 00314 /** 00315 * @} 00316 */ 00317 00318 /** @defgroup FMPI2C_LL_EC_DMA_REG_DATA DMA Register Data 00319 * @{ 00320 */ 00321 #define LL_FMPI2C_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for 00322 transmission */ 00323 #define LL_FMPI2C_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for 00324 reception */ 00325 /** 00326 * @} 00327 */ 00328 00329 /** @defgroup FMPI2C_LL_EC_SMBUS_TIMEOUTA_MODE SMBus TimeoutA Mode SCL SDA Timeout 00330 * @{ 00331 */ 00332 #define LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SCL_LOW 0x00000000U /*!< TimeoutA is used to detect 00333 SCL low level timeout. */ 00334 #define LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH FMPI2C_TIMEOUTR_TIDLE /*!< TimeoutA is used to detect 00335 both SCL and SDA high level timeout.*/ 00336 /** 00337 * @} 00338 */ 00339 00340 /** @defgroup FMPI2C_LL_EC_SMBUS_TIMEOUT_SELECTION SMBus Timeout Selection 00341 * @{ 00342 */ 00343 #define LL_FMPI2C_FMPSMBUS_TIMEOUTA FMPI2C_TIMEOUTR_TIMOUTEN /*!< TimeoutA enable bit */ 00344 #define LL_FMPI2C_FMPSMBUS_TIMEOUTB FMPI2C_TIMEOUTR_TEXTEN /*!< TimeoutB (extended clock) 00345 enable bit */ 00346 #define LL_FMPI2C_FMPSMBUS_ALL_TIMEOUT (uint32_t)(FMPI2C_TIMEOUTR_TIMOUTEN | \ 00347 FMPI2C_TIMEOUTR_TEXTEN) /*!< TimeoutA and TimeoutB 00348 (extended clock) enable bits */ 00349 /** 00350 * @} 00351 */ 00352 00353 /** 00354 * @} 00355 */ 00356 00357 /* Exported macro ------------------------------------------------------------*/ 00358 /** @defgroup FMPI2C_LL_Exported_Macros FMPI2C Exported Macros 00359 * @{ 00360 */ 00361 00362 /** @defgroup FMPI2C_LL_EM_WRITE_READ Common Write and read registers Macros 00363 * @{ 00364 */ 00365 00366 /** 00367 * @brief Write a value in FMPI2C register 00368 * @param __INSTANCE__ FMPI2C Instance 00369 * @param __REG__ Register to be written 00370 * @param __VALUE__ Value to be written in the register 00371 * @retval None 00372 */ 00373 #define LL_FMPI2C_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00374 00375 /** 00376 * @brief Read a value in FMPI2C register 00377 * @param __INSTANCE__ FMPI2C Instance 00378 * @param __REG__ Register to be read 00379 * @retval Register value 00380 */ 00381 #define LL_FMPI2C_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00382 /** 00383 * @} 00384 */ 00385 00386 /** @defgroup FMPI2C_LL_EM_CONVERT_TIMINGS Convert SDA SCL timings 00387 * @{ 00388 */ 00389 /** 00390 * @brief Configure the SDA setup, hold time and the SCL high, low period. 00391 * @param __PRESCALER__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. 00392 * @param __SETUP_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. 00393 (tscldel = (SCLDEL+1)xtpresc) 00394 * @param __HOLD_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. 00395 (tsdadel = SDADELxtpresc) 00396 * @param __SCLH_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. 00397 (tsclh = (SCLH+1)xtpresc) 00398 * @param __SCLL_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. 00399 (tscll = (SCLL+1)xtpresc) 00400 * @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF 00401 */ 00402 #define __LL_FMPI2C_CONVERT_TIMINGS(__PRESCALER__, __SETUP_TIME__, __HOLD_TIME__, __SCLH_PERIOD__, __SCLL_PERIOD__) \ 00403 ((((uint32_t)(__PRESCALER__) << FMPI2C_TIMINGR_PRESC_Pos) & FMPI2C_TIMINGR_PRESC) | \ 00404 (((uint32_t)(__SETUP_TIME__) << FMPI2C_TIMINGR_SCLDEL_Pos) & FMPI2C_TIMINGR_SCLDEL) | \ 00405 (((uint32_t)(__HOLD_TIME__) << FMPI2C_TIMINGR_SDADEL_Pos) & FMPI2C_TIMINGR_SDADEL) | \ 00406 (((uint32_t)(__SCLH_PERIOD__) << FMPI2C_TIMINGR_SCLH_Pos) & FMPI2C_TIMINGR_SCLH) | \ 00407 (((uint32_t)(__SCLL_PERIOD__) << FMPI2C_TIMINGR_SCLL_Pos) & FMPI2C_TIMINGR_SCLL)) 00408 /** 00409 * @} 00410 */ 00411 00412 /** 00413 * @} 00414 */ 00415 00416 /* Exported functions --------------------------------------------------------*/ 00417 /** @defgroup FMPI2C_LL_Exported_Functions FMPI2C Exported Functions 00418 * @{ 00419 */ 00420 00421 /** @defgroup FMPI2C_LL_EF_Configuration Configuration 00422 * @{ 00423 */ 00424 00425 /** 00426 * @brief Enable FMPI2C peripheral (PE = 1). 00427 * @rmtoll CR1 PE LL_FMPI2C_Enable 00428 * @param FMPI2Cx FMPI2C Instance. 00429 * @retval None 00430 */ 00431 __STATIC_INLINE void LL_FMPI2C_Enable(FMPI2C_TypeDef *FMPI2Cx) 00432 { 00433 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PE); 00434 } 00435 00436 /** 00437 * @brief Disable FMPI2C peripheral (PE = 0). 00438 * @note When PE = 0, the FMPI2C SCL and SDA lines are released. 00439 * Internal state machines and status bits are put back to their reset value. 00440 * When cleared, PE must be kept low for at least 3 APB clock cycles. 00441 * @rmtoll CR1 PE LL_FMPI2C_Disable 00442 * @param FMPI2Cx FMPI2C Instance. 00443 * @retval None 00444 */ 00445 __STATIC_INLINE void LL_FMPI2C_Disable(FMPI2C_TypeDef *FMPI2Cx) 00446 { 00447 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PE); 00448 } 00449 00450 /** 00451 * @brief Check if the FMPI2C peripheral is enabled or disabled. 00452 * @rmtoll CR1 PE LL_FMPI2C_IsEnabled 00453 * @param FMPI2Cx FMPI2C Instance. 00454 * @retval State of bit (1 or 0). 00455 */ 00456 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabled(FMPI2C_TypeDef *FMPI2Cx) 00457 { 00458 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PE) == (FMPI2C_CR1_PE)) ? 1UL : 0UL); 00459 } 00460 00461 /** 00462 * @brief Configure Noise Filters (Analog and Digital). 00463 * @note If the analog filter is also enabled, the digital filter is added to analog filter. 00464 * The filters can only be programmed when the FMPI2C is disabled (PE = 0). 00465 * @rmtoll CR1 ANFOFF LL_FMPI2C_ConfigFilters\n 00466 * CR1 DNF LL_FMPI2C_ConfigFilters 00467 * @param FMPI2Cx FMPI2C Instance. 00468 * @param AnalogFilter This parameter can be one of the following values: 00469 * @arg @ref LL_FMPI2C_ANALOGFILTER_ENABLE 00470 * @arg @ref LL_FMPI2C_ANALOGFILTER_DISABLE 00471 * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) 00472 and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*tfmpi2cclk). 00473 * This parameter is used to configure the digital noise filter on SDA and SCL input. 00474 * The digital filter will filter spikes with a length of up to DNF[3:0]*tfmpi2cclk. 00475 * @retval None 00476 */ 00477 __STATIC_INLINE void LL_FMPI2C_ConfigFilters(FMPI2C_TypeDef *FMPI2Cx, uint32_t AnalogFilter, uint32_t DigitalFilter) 00478 { 00479 MODIFY_REG(FMPI2Cx->CR1, FMPI2C_CR1_ANFOFF | FMPI2C_CR1_DNF, AnalogFilter | (DigitalFilter << FMPI2C_CR1_DNF_Pos)); 00480 } 00481 00482 /** 00483 * @brief Configure Digital Noise Filter. 00484 * @note If the analog filter is also enabled, the digital filter is added to analog filter. 00485 * This filter can only be programmed when the FMPI2C is disabled (PE = 0). 00486 * @rmtoll CR1 DNF LL_FMPI2C_SetDigitalFilter 00487 * @param FMPI2Cx FMPI2C Instance. 00488 * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) 00489 and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*tfmpi2cclk). 00490 * This parameter is used to configure the digital noise filter on SDA and SCL input. 00491 * The digital filter will filter spikes with a length of up to DNF[3:0]*tfmpi2cclk. 00492 * @retval None 00493 */ 00494 __STATIC_INLINE void LL_FMPI2C_SetDigitalFilter(FMPI2C_TypeDef *FMPI2Cx, uint32_t DigitalFilter) 00495 { 00496 MODIFY_REG(FMPI2Cx->CR1, FMPI2C_CR1_DNF, DigitalFilter << FMPI2C_CR1_DNF_Pos); 00497 } 00498 00499 /** 00500 * @brief Get the current Digital Noise Filter configuration. 00501 * @rmtoll CR1 DNF LL_FMPI2C_GetDigitalFilter 00502 * @param FMPI2Cx FMPI2C Instance. 00503 * @retval Value between Min_Data=0x0 and Max_Data=0xF 00504 */ 00505 __STATIC_INLINE uint32_t LL_FMPI2C_GetDigitalFilter(FMPI2C_TypeDef *FMPI2Cx) 00506 { 00507 return (uint32_t)(READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_DNF) >> FMPI2C_CR1_DNF_Pos); 00508 } 00509 00510 /** 00511 * @brief Enable Analog Noise Filter. 00512 * @note This filter can only be programmed when the FMPI2C is disabled (PE = 0). 00513 * @rmtoll CR1 ANFOFF LL_FMPI2C_EnableAnalogFilter 00514 * @param FMPI2Cx FMPI2C Instance. 00515 * @retval None 00516 */ 00517 __STATIC_INLINE void LL_FMPI2C_EnableAnalogFilter(FMPI2C_TypeDef *FMPI2Cx) 00518 { 00519 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ANFOFF); 00520 } 00521 00522 /** 00523 * @brief Disable Analog Noise Filter. 00524 * @note This filter can only be programmed when the FMPI2C is disabled (PE = 0). 00525 * @rmtoll CR1 ANFOFF LL_FMPI2C_DisableAnalogFilter 00526 * @param FMPI2Cx FMPI2C Instance. 00527 * @retval None 00528 */ 00529 __STATIC_INLINE void LL_FMPI2C_DisableAnalogFilter(FMPI2C_TypeDef *FMPI2Cx) 00530 { 00531 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ANFOFF); 00532 } 00533 00534 /** 00535 * @brief Check if Analog Noise Filter is enabled or disabled. 00536 * @rmtoll CR1 ANFOFF LL_FMPI2C_IsEnabledAnalogFilter 00537 * @param FMPI2Cx FMPI2C Instance. 00538 * @retval State of bit (1 or 0). 00539 */ 00540 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledAnalogFilter(FMPI2C_TypeDef *FMPI2Cx) 00541 { 00542 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ANFOFF) != (FMPI2C_CR1_ANFOFF)) ? 1UL : 0UL); 00543 } 00544 00545 /** 00546 * @brief Enable DMA transmission requests. 00547 * @rmtoll CR1 TXDMAEN LL_FMPI2C_EnableDMAReq_TX 00548 * @param FMPI2Cx FMPI2C Instance. 00549 * @retval None 00550 */ 00551 __STATIC_INLINE void LL_FMPI2C_EnableDMAReq_TX(FMPI2C_TypeDef *FMPI2Cx) 00552 { 00553 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXDMAEN); 00554 } 00555 00556 /** 00557 * @brief Disable DMA transmission requests. 00558 * @rmtoll CR1 TXDMAEN LL_FMPI2C_DisableDMAReq_TX 00559 * @param FMPI2Cx FMPI2C Instance. 00560 * @retval None 00561 */ 00562 __STATIC_INLINE void LL_FMPI2C_DisableDMAReq_TX(FMPI2C_TypeDef *FMPI2Cx) 00563 { 00564 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXDMAEN); 00565 } 00566 00567 /** 00568 * @brief Check if DMA transmission requests are enabled or disabled. 00569 * @rmtoll CR1 TXDMAEN LL_FMPI2C_IsEnabledDMAReq_TX 00570 * @param FMPI2Cx FMPI2C Instance. 00571 * @retval State of bit (1 or 0). 00572 */ 00573 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledDMAReq_TX(FMPI2C_TypeDef *FMPI2Cx) 00574 { 00575 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXDMAEN) == (FMPI2C_CR1_TXDMAEN)) ? 1UL : 0UL); 00576 } 00577 00578 /** 00579 * @brief Enable DMA reception requests. 00580 * @rmtoll CR1 RXDMAEN LL_FMPI2C_EnableDMAReq_RX 00581 * @param FMPI2Cx FMPI2C Instance. 00582 * @retval None 00583 */ 00584 __STATIC_INLINE void LL_FMPI2C_EnableDMAReq_RX(FMPI2C_TypeDef *FMPI2Cx) 00585 { 00586 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXDMAEN); 00587 } 00588 00589 /** 00590 * @brief Disable DMA reception requests. 00591 * @rmtoll CR1 RXDMAEN LL_FMPI2C_DisableDMAReq_RX 00592 * @param FMPI2Cx FMPI2C Instance. 00593 * @retval None 00594 */ 00595 __STATIC_INLINE void LL_FMPI2C_DisableDMAReq_RX(FMPI2C_TypeDef *FMPI2Cx) 00596 { 00597 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXDMAEN); 00598 } 00599 00600 /** 00601 * @brief Check if DMA reception requests are enabled or disabled. 00602 * @rmtoll CR1 RXDMAEN LL_FMPI2C_IsEnabledDMAReq_RX 00603 * @param FMPI2Cx FMPI2C Instance. 00604 * @retval State of bit (1 or 0). 00605 */ 00606 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledDMAReq_RX(FMPI2C_TypeDef *FMPI2Cx) 00607 { 00608 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXDMAEN) == (FMPI2C_CR1_RXDMAEN)) ? 1UL : 0UL); 00609 } 00610 00611 /** 00612 * @brief Get the data register address used for DMA transfer 00613 * @rmtoll TXDR TXDATA LL_FMPI2C_DMA_GetRegAddr\n 00614 * RXDR RXDATA LL_FMPI2C_DMA_GetRegAddr 00615 * @param FMPI2Cx FMPI2C Instance 00616 * @param Direction This parameter can be one of the following values: 00617 * @arg @ref LL_FMPI2C_DMA_REG_DATA_TRANSMIT 00618 * @arg @ref LL_FMPI2C_DMA_REG_DATA_RECEIVE 00619 * @retval Address of data register 00620 */ 00621 __STATIC_INLINE uint32_t LL_FMPI2C_DMA_GetRegAddr(FMPI2C_TypeDef *FMPI2Cx, uint32_t Direction) 00622 { 00623 uint32_t data_reg_addr; 00624 00625 if (Direction == LL_FMPI2C_DMA_REG_DATA_TRANSMIT) 00626 { 00627 /* return address of TXDR register */ 00628 data_reg_addr = (uint32_t) &(FMPI2Cx->TXDR); 00629 } 00630 else 00631 { 00632 /* return address of RXDR register */ 00633 data_reg_addr = (uint32_t) &(FMPI2Cx->RXDR); 00634 } 00635 00636 return data_reg_addr; 00637 } 00638 00639 /** 00640 * @brief Enable Clock stretching. 00641 * @note This bit can only be programmed when the FMPI2C is disabled (PE = 0). 00642 * @rmtoll CR1 NOSTRETCH LL_FMPI2C_EnableClockStretching 00643 * @param FMPI2Cx FMPI2C Instance. 00644 * @retval None 00645 */ 00646 __STATIC_INLINE void LL_FMPI2C_EnableClockStretching(FMPI2C_TypeDef *FMPI2Cx) 00647 { 00648 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NOSTRETCH); 00649 } 00650 00651 /** 00652 * @brief Disable Clock stretching. 00653 * @note This bit can only be programmed when the FMPI2C is disabled (PE = 0). 00654 * @rmtoll CR1 NOSTRETCH LL_FMPI2C_DisableClockStretching 00655 * @param FMPI2Cx FMPI2C Instance. 00656 * @retval None 00657 */ 00658 __STATIC_INLINE void LL_FMPI2C_DisableClockStretching(FMPI2C_TypeDef *FMPI2Cx) 00659 { 00660 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NOSTRETCH); 00661 } 00662 00663 /** 00664 * @brief Check if Clock stretching is enabled or disabled. 00665 * @rmtoll CR1 NOSTRETCH LL_FMPI2C_IsEnabledClockStretching 00666 * @param FMPI2Cx FMPI2C Instance. 00667 * @retval State of bit (1 or 0). 00668 */ 00669 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledClockStretching(FMPI2C_TypeDef *FMPI2Cx) 00670 { 00671 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NOSTRETCH) != (FMPI2C_CR1_NOSTRETCH)) ? 1UL : 0UL); 00672 } 00673 00674 /** 00675 * @brief Enable hardware byte control in slave mode. 00676 * @rmtoll CR1 SBC LL_FMPI2C_EnableSlaveByteControl 00677 * @param FMPI2Cx FMPI2C Instance. 00678 * @retval None 00679 */ 00680 __STATIC_INLINE void LL_FMPI2C_EnableSlaveByteControl(FMPI2C_TypeDef *FMPI2Cx) 00681 { 00682 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_SBC); 00683 } 00684 00685 /** 00686 * @brief Disable hardware byte control in slave mode. 00687 * @rmtoll CR1 SBC LL_FMPI2C_DisableSlaveByteControl 00688 * @param FMPI2Cx FMPI2C Instance. 00689 * @retval None 00690 */ 00691 __STATIC_INLINE void LL_FMPI2C_DisableSlaveByteControl(FMPI2C_TypeDef *FMPI2Cx) 00692 { 00693 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_SBC); 00694 } 00695 00696 /** 00697 * @brief Check if hardware byte control in slave mode is enabled or disabled. 00698 * @rmtoll CR1 SBC LL_FMPI2C_IsEnabledSlaveByteControl 00699 * @param FMPI2Cx FMPI2C Instance. 00700 * @retval State of bit (1 or 0). 00701 */ 00702 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledSlaveByteControl(FMPI2C_TypeDef *FMPI2Cx) 00703 { 00704 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_SBC) == (FMPI2C_CR1_SBC)) ? 1UL : 0UL); 00705 } 00706 00707 /** 00708 * @brief Enable General Call. 00709 * @note When enabled the Address 0x00 is ACKed. 00710 * @rmtoll CR1 GCEN LL_FMPI2C_EnableGeneralCall 00711 * @param FMPI2Cx FMPI2C Instance. 00712 * @retval None 00713 */ 00714 __STATIC_INLINE void LL_FMPI2C_EnableGeneralCall(FMPI2C_TypeDef *FMPI2Cx) 00715 { 00716 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_GCEN); 00717 } 00718 00719 /** 00720 * @brief Disable General Call. 00721 * @note When disabled the Address 0x00 is NACKed. 00722 * @rmtoll CR1 GCEN LL_FMPI2C_DisableGeneralCall 00723 * @param FMPI2Cx FMPI2C Instance. 00724 * @retval None 00725 */ 00726 __STATIC_INLINE void LL_FMPI2C_DisableGeneralCall(FMPI2C_TypeDef *FMPI2Cx) 00727 { 00728 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_GCEN); 00729 } 00730 00731 /** 00732 * @brief Check if General Call is enabled or disabled. 00733 * @rmtoll CR1 GCEN LL_FMPI2C_IsEnabledGeneralCall 00734 * @param FMPI2Cx FMPI2C Instance. 00735 * @retval State of bit (1 or 0). 00736 */ 00737 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledGeneralCall(FMPI2C_TypeDef *FMPI2Cx) 00738 { 00739 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_GCEN) == (FMPI2C_CR1_GCEN)) ? 1UL : 0UL); 00740 } 00741 00742 /** 00743 * @brief Configure the Master to operate in 7-bit or 10-bit addressing mode. 00744 * @note Changing this bit is not allowed, when the START bit is set. 00745 * @rmtoll CR2 ADD10 LL_FMPI2C_SetMasterAddressingMode 00746 * @param FMPI2Cx FMPI2C Instance. 00747 * @param AddressingMode This parameter can be one of the following values: 00748 * @arg @ref LL_FMPI2C_ADDRESSING_MODE_7BIT 00749 * @arg @ref LL_FMPI2C_ADDRESSING_MODE_10BIT 00750 * @retval None 00751 */ 00752 __STATIC_INLINE void LL_FMPI2C_SetMasterAddressingMode(FMPI2C_TypeDef *FMPI2Cx, uint32_t AddressingMode) 00753 { 00754 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_ADD10, AddressingMode); 00755 } 00756 00757 /** 00758 * @brief Get the Master addressing mode. 00759 * @rmtoll CR2 ADD10 LL_FMPI2C_GetMasterAddressingMode 00760 * @param FMPI2Cx FMPI2C Instance. 00761 * @retval Returned value can be one of the following values: 00762 * @arg @ref LL_FMPI2C_ADDRESSING_MODE_7BIT 00763 * @arg @ref LL_FMPI2C_ADDRESSING_MODE_10BIT 00764 */ 00765 __STATIC_INLINE uint32_t LL_FMPI2C_GetMasterAddressingMode(FMPI2C_TypeDef *FMPI2Cx) 00766 { 00767 return (uint32_t)(READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_ADD10)); 00768 } 00769 00770 /** 00771 * @brief Set the Own Address1. 00772 * @rmtoll OAR1 OA1 LL_FMPI2C_SetOwnAddress1\n 00773 * OAR1 OA1MODE LL_FMPI2C_SetOwnAddress1 00774 * @param FMPI2Cx FMPI2C Instance. 00775 * @param OwnAddress1 This parameter must be a value between Min_Data=0 and Max_Data=0x3FF. 00776 * @param OwnAddrSize This parameter can be one of the following values: 00777 * @arg @ref LL_FMPI2C_OWNADDRESS1_7BIT 00778 * @arg @ref LL_FMPI2C_OWNADDRESS1_10BIT 00779 * @retval None 00780 */ 00781 __STATIC_INLINE void LL_FMPI2C_SetOwnAddress1(FMPI2C_TypeDef *FMPI2Cx, uint32_t OwnAddress1, uint32_t OwnAddrSize) 00782 { 00783 MODIFY_REG(FMPI2Cx->OAR1, FMPI2C_OAR1_OA1 | FMPI2C_OAR1_OA1MODE, OwnAddress1 | OwnAddrSize); 00784 } 00785 00786 /** 00787 * @brief Enable acknowledge on Own Address1 match address. 00788 * @rmtoll OAR1 OA1EN LL_FMPI2C_EnableOwnAddress1 00789 * @param FMPI2Cx FMPI2C Instance. 00790 * @retval None 00791 */ 00792 __STATIC_INLINE void LL_FMPI2C_EnableOwnAddress1(FMPI2C_TypeDef *FMPI2Cx) 00793 { 00794 SET_BIT(FMPI2Cx->OAR1, FMPI2C_OAR1_OA1EN); 00795 } 00796 00797 /** 00798 * @brief Disable acknowledge on Own Address1 match address. 00799 * @rmtoll OAR1 OA1EN LL_FMPI2C_DisableOwnAddress1 00800 * @param FMPI2Cx FMPI2C Instance. 00801 * @retval None 00802 */ 00803 __STATIC_INLINE void LL_FMPI2C_DisableOwnAddress1(FMPI2C_TypeDef *FMPI2Cx) 00804 { 00805 CLEAR_BIT(FMPI2Cx->OAR1, FMPI2C_OAR1_OA1EN); 00806 } 00807 00808 /** 00809 * @brief Check if Own Address1 acknowledge is enabled or disabled. 00810 * @rmtoll OAR1 OA1EN LL_FMPI2C_IsEnabledOwnAddress1 00811 * @param FMPI2Cx FMPI2C Instance. 00812 * @retval State of bit (1 or 0). 00813 */ 00814 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledOwnAddress1(FMPI2C_TypeDef *FMPI2Cx) 00815 { 00816 return ((READ_BIT(FMPI2Cx->OAR1, FMPI2C_OAR1_OA1EN) == (FMPI2C_OAR1_OA1EN)) ? 1UL : 0UL); 00817 } 00818 00819 /** 00820 * @brief Set the 7bits Own Address2. 00821 * @note This action has no effect if own address2 is enabled. 00822 * @rmtoll OAR2 OA2 LL_FMPI2C_SetOwnAddress2\n 00823 * OAR2 OA2MSK LL_FMPI2C_SetOwnAddress2 00824 * @param FMPI2Cx FMPI2C Instance. 00825 * @param OwnAddress2 Value between Min_Data=0 and Max_Data=0x7F. 00826 * @param OwnAddrMask This parameter can be one of the following values: 00827 * @arg @ref LL_FMPI2C_OWNADDRESS2_NOMASK 00828 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK01 00829 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK02 00830 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK03 00831 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK04 00832 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK05 00833 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK06 00834 * @arg @ref LL_FMPI2C_OWNADDRESS2_MASK07 00835 * @retval None 00836 */ 00837 __STATIC_INLINE void LL_FMPI2C_SetOwnAddress2(FMPI2C_TypeDef *FMPI2Cx, uint32_t OwnAddress2, uint32_t OwnAddrMask) 00838 { 00839 MODIFY_REG(FMPI2Cx->OAR2, FMPI2C_OAR2_OA2 | FMPI2C_OAR2_OA2MSK, OwnAddress2 | OwnAddrMask); 00840 } 00841 00842 /** 00843 * @brief Enable acknowledge on Own Address2 match address. 00844 * @rmtoll OAR2 OA2EN LL_FMPI2C_EnableOwnAddress2 00845 * @param FMPI2Cx FMPI2C Instance. 00846 * @retval None 00847 */ 00848 __STATIC_INLINE void LL_FMPI2C_EnableOwnAddress2(FMPI2C_TypeDef *FMPI2Cx) 00849 { 00850 SET_BIT(FMPI2Cx->OAR2, FMPI2C_OAR2_OA2EN); 00851 } 00852 00853 /** 00854 * @brief Disable acknowledge on Own Address2 match address. 00855 * @rmtoll OAR2 OA2EN LL_FMPI2C_DisableOwnAddress2 00856 * @param FMPI2Cx FMPI2C Instance. 00857 * @retval None 00858 */ 00859 __STATIC_INLINE void LL_FMPI2C_DisableOwnAddress2(FMPI2C_TypeDef *FMPI2Cx) 00860 { 00861 CLEAR_BIT(FMPI2Cx->OAR2, FMPI2C_OAR2_OA2EN); 00862 } 00863 00864 /** 00865 * @brief Check if Own Address1 acknowledge is enabled or disabled. 00866 * @rmtoll OAR2 OA2EN LL_FMPI2C_IsEnabledOwnAddress2 00867 * @param FMPI2Cx FMPI2C Instance. 00868 * @retval State of bit (1 or 0). 00869 */ 00870 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledOwnAddress2(FMPI2C_TypeDef *FMPI2Cx) 00871 { 00872 return ((READ_BIT(FMPI2Cx->OAR2, FMPI2C_OAR2_OA2EN) == (FMPI2C_OAR2_OA2EN)) ? 1UL : 0UL); 00873 } 00874 00875 /** 00876 * @brief Configure the SDA setup, hold time and the SCL high, low period. 00877 * @note This bit can only be programmed when the FMPI2C is disabled (PE = 0). 00878 * @rmtoll TIMINGR TIMINGR LL_FMPI2C_SetTiming 00879 * @param FMPI2Cx FMPI2C Instance. 00880 * @param Timing This parameter must be a value between Min_Data=0 and Max_Data=0xFFFFFFFF. 00881 * @note This parameter is computed with the STM32CubeMX Tool. 00882 * @retval None 00883 */ 00884 __STATIC_INLINE void LL_FMPI2C_SetTiming(FMPI2C_TypeDef *FMPI2Cx, uint32_t Timing) 00885 { 00886 WRITE_REG(FMPI2Cx->TIMINGR, Timing); 00887 } 00888 00889 /** 00890 * @brief Get the Timing Prescaler setting. 00891 * @rmtoll TIMINGR PRESC LL_FMPI2C_GetTimingPrescaler 00892 * @param FMPI2Cx FMPI2C Instance. 00893 * @retval Value between Min_Data=0x0 and Max_Data=0xF 00894 */ 00895 __STATIC_INLINE uint32_t LL_FMPI2C_GetTimingPrescaler(FMPI2C_TypeDef *FMPI2Cx) 00896 { 00897 return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_PRESC) >> FMPI2C_TIMINGR_PRESC_Pos); 00898 } 00899 00900 /** 00901 * @brief Get the SCL low period setting. 00902 * @rmtoll TIMINGR SCLL LL_FMPI2C_GetClockLowPeriod 00903 * @param FMPI2Cx FMPI2C Instance. 00904 * @retval Value between Min_Data=0x00 and Max_Data=0xFF 00905 */ 00906 __STATIC_INLINE uint32_t LL_FMPI2C_GetClockLowPeriod(FMPI2C_TypeDef *FMPI2Cx) 00907 { 00908 return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SCLL) >> FMPI2C_TIMINGR_SCLL_Pos); 00909 } 00910 00911 /** 00912 * @brief Get the SCL high period setting. 00913 * @rmtoll TIMINGR SCLH LL_FMPI2C_GetClockHighPeriod 00914 * @param FMPI2Cx FMPI2C Instance. 00915 * @retval Value between Min_Data=0x00 and Max_Data=0xFF 00916 */ 00917 __STATIC_INLINE uint32_t LL_FMPI2C_GetClockHighPeriod(FMPI2C_TypeDef *FMPI2Cx) 00918 { 00919 return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SCLH) >> FMPI2C_TIMINGR_SCLH_Pos); 00920 } 00921 00922 /** 00923 * @brief Get the SDA hold time. 00924 * @rmtoll TIMINGR SDADEL LL_FMPI2C_GetDataHoldTime 00925 * @param FMPI2Cx FMPI2C Instance. 00926 * @retval Value between Min_Data=0x0 and Max_Data=0xF 00927 */ 00928 __STATIC_INLINE uint32_t LL_FMPI2C_GetDataHoldTime(FMPI2C_TypeDef *FMPI2Cx) 00929 { 00930 return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SDADEL) >> FMPI2C_TIMINGR_SDADEL_Pos); 00931 } 00932 00933 /** 00934 * @brief Get the SDA setup time. 00935 * @rmtoll TIMINGR SCLDEL LL_FMPI2C_GetDataSetupTime 00936 * @param FMPI2Cx FMPI2C Instance. 00937 * @retval Value between Min_Data=0x0 and Max_Data=0xF 00938 */ 00939 __STATIC_INLINE uint32_t LL_FMPI2C_GetDataSetupTime(FMPI2C_TypeDef *FMPI2Cx) 00940 { 00941 return (uint32_t)(READ_BIT(FMPI2Cx->TIMINGR, FMPI2C_TIMINGR_SCLDEL) >> FMPI2C_TIMINGR_SCLDEL_Pos); 00942 } 00943 00944 /** 00945 * @brief Configure peripheral mode. 00946 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 00947 * SMBus feature is supported by the FMPI2Cx Instance. 00948 * @rmtoll CR1 SMBHEN LL_FMPI2C_SetMode\n 00949 * CR1 SMBDEN LL_FMPI2C_SetMode 00950 * @param FMPI2Cx FMPI2C Instance. 00951 * @param PeripheralMode This parameter can be one of the following values: 00952 * @arg @ref LL_FMPI2C_MODE_I2C 00953 * @arg @ref LL_FMPI2C_MODE_SMBUS_HOST 00954 * @arg @ref LL_FMPI2C_MODE_SMBUS_DEVICE 00955 * @arg @ref LL_FMPI2C_MODE_SMBUS_DEVICE_ARP 00956 * @retval None 00957 */ 00958 __STATIC_INLINE void LL_FMPI2C_SetMode(FMPI2C_TypeDef *FMPI2Cx, uint32_t PeripheralMode) 00959 { 00960 MODIFY_REG(FMPI2Cx->CR1, FMPI2C_CR1_SMBHEN | FMPI2C_CR1_SMBDEN, PeripheralMode); 00961 } 00962 00963 /** 00964 * @brief Get peripheral mode. 00965 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 00966 * SMBus feature is supported by the FMPI2Cx Instance. 00967 * @rmtoll CR1 SMBHEN LL_FMPI2C_GetMode\n 00968 * CR1 SMBDEN LL_FMPI2C_GetMode 00969 * @param FMPI2Cx FMPI2C Instance. 00970 * @retval Returned value can be one of the following values: 00971 * @arg @ref LL_FMPI2C_MODE_I2C 00972 * @arg @ref LL_FMPI2C_MODE_SMBUS_HOST 00973 * @arg @ref LL_FMPI2C_MODE_SMBUS_DEVICE 00974 * @arg @ref LL_FMPI2C_MODE_SMBUS_DEVICE_ARP 00975 */ 00976 __STATIC_INLINE uint32_t LL_FMPI2C_GetMode(FMPI2C_TypeDef *FMPI2Cx) 00977 { 00978 return (uint32_t)(READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_SMBHEN | FMPI2C_CR1_SMBDEN)); 00979 } 00980 00981 /** 00982 * @brief Enable SMBus alert (Host or Device mode) 00983 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 00984 * SMBus feature is supported by the FMPI2Cx Instance. 00985 * @note SMBus Device mode: 00986 * - SMBus Alert pin is drived low and 00987 * Alert Response Address Header acknowledge is enabled. 00988 * SMBus Host mode: 00989 * - SMBus Alert pin management is supported. 00990 * @rmtoll CR1 ALERTEN LL_FMPI2C_EnableSMBusAlert 00991 * @param FMPI2Cx FMPI2C Instance. 00992 * @retval None 00993 */ 00994 __STATIC_INLINE void LL_FMPI2C_EnableSMBusAlert(FMPI2C_TypeDef *FMPI2Cx) 00995 { 00996 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ALERTEN); 00997 } 00998 00999 /** 01000 * @brief Disable SMBus alert (Host or Device mode) 01001 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01002 * SMBus feature is supported by the FMPI2Cx Instance. 01003 * @note SMBus Device mode: 01004 * - SMBus Alert pin is not drived (can be used as a standard GPIO) and 01005 * Alert Response Address Header acknowledge is disabled. 01006 * SMBus Host mode: 01007 * - SMBus Alert pin management is not supported. 01008 * @rmtoll CR1 ALERTEN LL_FMPI2C_DisableSMBusAlert 01009 * @param FMPI2Cx FMPI2C Instance. 01010 * @retval None 01011 */ 01012 __STATIC_INLINE void LL_FMPI2C_DisableSMBusAlert(FMPI2C_TypeDef *FMPI2Cx) 01013 { 01014 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ALERTEN); 01015 } 01016 01017 /** 01018 * @brief Check if SMBus alert (Host or Device mode) is enabled or disabled. 01019 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01020 * SMBus feature is supported by the FMPI2Cx Instance. 01021 * @rmtoll CR1 ALERTEN LL_FMPI2C_IsEnabledSMBusAlert 01022 * @param FMPI2Cx FMPI2C Instance. 01023 * @retval State of bit (1 or 0). 01024 */ 01025 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledSMBusAlert(FMPI2C_TypeDef *FMPI2Cx) 01026 { 01027 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ALERTEN) == (FMPI2C_CR1_ALERTEN)) ? 1UL : 0UL); 01028 } 01029 01030 /** 01031 * @brief Enable SMBus Packet Error Calculation (PEC). 01032 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01033 * SMBus feature is supported by the FMPI2Cx Instance. 01034 * @rmtoll CR1 PECEN LL_FMPI2C_EnableSMBusPEC 01035 * @param FMPI2Cx FMPI2C Instance. 01036 * @retval None 01037 */ 01038 __STATIC_INLINE void LL_FMPI2C_EnableSMBusPEC(FMPI2C_TypeDef *FMPI2Cx) 01039 { 01040 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PECEN); 01041 } 01042 01043 /** 01044 * @brief Disable SMBus Packet Error Calculation (PEC). 01045 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01046 * SMBus feature is supported by the FMPI2Cx Instance. 01047 * @rmtoll CR1 PECEN LL_FMPI2C_DisableSMBusPEC 01048 * @param FMPI2Cx FMPI2C Instance. 01049 * @retval None 01050 */ 01051 __STATIC_INLINE void LL_FMPI2C_DisableSMBusPEC(FMPI2C_TypeDef *FMPI2Cx) 01052 { 01053 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PECEN); 01054 } 01055 01056 /** 01057 * @brief Check if SMBus Packet Error Calculation (PEC) is enabled or disabled. 01058 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01059 * SMBus feature is supported by the FMPI2Cx Instance. 01060 * @rmtoll CR1 PECEN LL_FMPI2C_IsEnabledSMBusPEC 01061 * @param FMPI2Cx FMPI2C Instance. 01062 * @retval State of bit (1 or 0). 01063 */ 01064 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledSMBusPEC(FMPI2C_TypeDef *FMPI2Cx) 01065 { 01066 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_PECEN) == (FMPI2C_CR1_PECEN)) ? 1UL : 0UL); 01067 } 01068 01069 /** 01070 * @brief Configure the SMBus Clock Timeout. 01071 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01072 * SMBus feature is supported by the FMPI2Cx Instance. 01073 * @note This configuration can only be programmed when associated Timeout is disabled (TimeoutA and/orTimeoutB). 01074 * @rmtoll TIMEOUTR TIMEOUTA LL_FMPI2C_ConfigSMBusTimeout\n 01075 * TIMEOUTR TIDLE LL_FMPI2C_ConfigSMBusTimeout\n 01076 * TIMEOUTR TIMEOUTB LL_FMPI2C_ConfigSMBusTimeout 01077 * @param FMPI2Cx FMPI2C Instance. 01078 * @param TimeoutA This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. 01079 * @param TimeoutAMode This parameter can be one of the following values: 01080 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SCL_LOW 01081 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH 01082 * @param TimeoutB 01083 * @retval None 01084 */ 01085 __STATIC_INLINE void LL_FMPI2C_ConfigSMBusTimeout(FMPI2C_TypeDef *FMPI2Cx, uint32_t TimeoutA, uint32_t TimeoutAMode, 01086 uint32_t TimeoutB) 01087 { 01088 MODIFY_REG(FMPI2Cx->TIMEOUTR, FMPI2C_TIMEOUTR_TIMEOUTA | FMPI2C_TIMEOUTR_TIDLE | FMPI2C_TIMEOUTR_TIMEOUTB, 01089 TimeoutA | TimeoutAMode | (TimeoutB << FMPI2C_TIMEOUTR_TIMEOUTB_Pos)); 01090 } 01091 01092 /** 01093 * @brief Configure the SMBus Clock TimeoutA (SCL low timeout or SCL and SDA high timeout depends on TimeoutA mode). 01094 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01095 * SMBus feature is supported by the FMPI2Cx Instance. 01096 * @note These bits can only be programmed when TimeoutA is disabled. 01097 * @rmtoll TIMEOUTR TIMEOUTA LL_FMPI2C_SetSMBusTimeoutA 01098 * @param FMPI2Cx FMPI2C Instance. 01099 * @param TimeoutA This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. 01100 * @retval None 01101 */ 01102 __STATIC_INLINE void LL_FMPI2C_SetSMBusTimeoutA(FMPI2C_TypeDef *FMPI2Cx, uint32_t TimeoutA) 01103 { 01104 WRITE_REG(FMPI2Cx->TIMEOUTR, TimeoutA); 01105 } 01106 01107 /** 01108 * @brief Get the SMBus Clock TimeoutA setting. 01109 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01110 * SMBus feature is supported by the FMPI2Cx Instance. 01111 * @rmtoll TIMEOUTR TIMEOUTA LL_FMPI2C_GetSMBusTimeoutA 01112 * @param FMPI2Cx FMPI2C Instance. 01113 * @retval Value between Min_Data=0 and Max_Data=0xFFF 01114 */ 01115 __STATIC_INLINE uint32_t LL_FMPI2C_GetSMBusTimeoutA(FMPI2C_TypeDef *FMPI2Cx) 01116 { 01117 return (uint32_t)(READ_BIT(FMPI2Cx->TIMEOUTR, FMPI2C_TIMEOUTR_TIMEOUTA)); 01118 } 01119 01120 /** 01121 * @brief Set the SMBus Clock TimeoutA mode. 01122 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01123 * SMBus feature is supported by the FMPI2Cx Instance. 01124 * @note This bit can only be programmed when TimeoutA is disabled. 01125 * @rmtoll TIMEOUTR TIDLE LL_FMPI2C_SetSMBusTimeoutAMode 01126 * @param FMPI2Cx FMPI2C Instance. 01127 * @param TimeoutAMode This parameter can be one of the following values: 01128 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SCL_LOW 01129 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH 01130 * @retval None 01131 */ 01132 __STATIC_INLINE void LL_FMPI2C_SetSMBusTimeoutAMode(FMPI2C_TypeDef *FMPI2Cx, uint32_t TimeoutAMode) 01133 { 01134 WRITE_REG(FMPI2Cx->TIMEOUTR, TimeoutAMode); 01135 } 01136 01137 /** 01138 * @brief Get the SMBus Clock TimeoutA mode. 01139 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01140 * SMBus feature is supported by the FMPI2Cx Instance. 01141 * @rmtoll TIMEOUTR TIDLE LL_FMPI2C_GetSMBusTimeoutAMode 01142 * @param FMPI2Cx FMPI2C Instance. 01143 * @retval Returned value can be one of the following values: 01144 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SCL_LOW 01145 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH 01146 */ 01147 __STATIC_INLINE uint32_t LL_FMPI2C_GetSMBusTimeoutAMode(FMPI2C_TypeDef *FMPI2Cx) 01148 { 01149 return (uint32_t)(READ_BIT(FMPI2Cx->TIMEOUTR, FMPI2C_TIMEOUTR_TIDLE)); 01150 } 01151 01152 /** 01153 * @brief Configure the SMBus Extended Cumulative Clock TimeoutB (Master or Slave mode). 01154 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01155 * SMBus feature is supported by the FMPI2Cx Instance. 01156 * @note These bits can only be programmed when TimeoutB is disabled. 01157 * @rmtoll TIMEOUTR TIMEOUTB LL_FMPI2C_SetSMBusTimeoutB 01158 * @param FMPI2Cx FMPI2C Instance. 01159 * @param TimeoutB This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. 01160 * @retval None 01161 */ 01162 __STATIC_INLINE void LL_FMPI2C_SetSMBusTimeoutB(FMPI2C_TypeDef *FMPI2Cx, uint32_t TimeoutB) 01163 { 01164 WRITE_REG(FMPI2Cx->TIMEOUTR, TimeoutB << FMPI2C_TIMEOUTR_TIMEOUTB_Pos); 01165 } 01166 01167 /** 01168 * @brief Get the SMBus Extended Cumulative Clock TimeoutB setting. 01169 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01170 * SMBus feature is supported by the FMPI2Cx Instance. 01171 * @rmtoll TIMEOUTR TIMEOUTB LL_FMPI2C_GetSMBusTimeoutB 01172 * @param FMPI2Cx FMPI2C Instance. 01173 * @retval Value between Min_Data=0 and Max_Data=0xFFF 01174 */ 01175 __STATIC_INLINE uint32_t LL_FMPI2C_GetSMBusTimeoutB(FMPI2C_TypeDef *FMPI2Cx) 01176 { 01177 return (uint32_t)(READ_BIT(FMPI2Cx->TIMEOUTR, FMPI2C_TIMEOUTR_TIMEOUTB) >> FMPI2C_TIMEOUTR_TIMEOUTB_Pos); 01178 } 01179 01180 /** 01181 * @brief Enable the SMBus Clock Timeout. 01182 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01183 * SMBus feature is supported by the FMPI2Cx Instance. 01184 * @rmtoll TIMEOUTR TIMOUTEN LL_FMPI2C_EnableSMBusTimeout\n 01185 * TIMEOUTR TEXTEN LL_FMPI2C_EnableSMBusTimeout 01186 * @param FMPI2Cx FMPI2C Instance. 01187 * @param ClockTimeout This parameter can be one of the following values: 01188 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA 01189 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTB 01190 * @arg @ref LL_FMPI2C_FMPSMBUS_ALL_TIMEOUT 01191 * @retval None 01192 */ 01193 __STATIC_INLINE void LL_FMPI2C_EnableSMBusTimeout(FMPI2C_TypeDef *FMPI2Cx, uint32_t ClockTimeout) 01194 { 01195 SET_BIT(FMPI2Cx->TIMEOUTR, ClockTimeout); 01196 } 01197 01198 /** 01199 * @brief Disable the SMBus Clock Timeout. 01200 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01201 * SMBus feature is supported by the FMPI2Cx Instance. 01202 * @rmtoll TIMEOUTR TIMOUTEN LL_FMPI2C_DisableSMBusTimeout\n 01203 * TIMEOUTR TEXTEN LL_FMPI2C_DisableSMBusTimeout 01204 * @param FMPI2Cx FMPI2C Instance. 01205 * @param ClockTimeout This parameter can be one of the following values: 01206 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA 01207 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTB 01208 * @arg @ref LL_FMPI2C_FMPSMBUS_ALL_TIMEOUT 01209 * @retval None 01210 */ 01211 __STATIC_INLINE void LL_FMPI2C_DisableSMBusTimeout(FMPI2C_TypeDef *FMPI2Cx, uint32_t ClockTimeout) 01212 { 01213 CLEAR_BIT(FMPI2Cx->TIMEOUTR, ClockTimeout); 01214 } 01215 01216 /** 01217 * @brief Check if the SMBus Clock Timeout is enabled or disabled. 01218 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01219 * SMBus feature is supported by the FMPI2Cx Instance. 01220 * @rmtoll TIMEOUTR TIMOUTEN LL_FMPI2C_IsEnabledSMBusTimeout\n 01221 * TIMEOUTR TEXTEN LL_FMPI2C_IsEnabledSMBusTimeout 01222 * @param FMPI2Cx FMPI2C Instance. 01223 * @param ClockTimeout This parameter can be one of the following values: 01224 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTA 01225 * @arg @ref LL_FMPI2C_FMPSMBUS_TIMEOUTB 01226 * @arg @ref LL_FMPI2C_FMPSMBUS_ALL_TIMEOUT 01227 * @retval State of bit (1 or 0). 01228 */ 01229 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledSMBusTimeout(FMPI2C_TypeDef *FMPI2Cx, uint32_t ClockTimeout) 01230 { 01231 return ((READ_BIT(FMPI2Cx->TIMEOUTR, (FMPI2C_TIMEOUTR_TIMOUTEN | FMPI2C_TIMEOUTR_TEXTEN)) == \ 01232 (ClockTimeout)) ? 1UL : 0UL); 01233 } 01234 01235 /** 01236 * @} 01237 */ 01238 01239 /** @defgroup FMPI2C_LL_EF_IT_Management IT_Management 01240 * @{ 01241 */ 01242 01243 /** 01244 * @brief Enable TXIS interrupt. 01245 * @rmtoll CR1 TXIE LL_FMPI2C_EnableIT_TX 01246 * @param FMPI2Cx FMPI2C Instance. 01247 * @retval None 01248 */ 01249 __STATIC_INLINE void LL_FMPI2C_EnableIT_TX(FMPI2C_TypeDef *FMPI2Cx) 01250 { 01251 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXIE); 01252 } 01253 01254 /** 01255 * @brief Disable TXIS interrupt. 01256 * @rmtoll CR1 TXIE LL_FMPI2C_DisableIT_TX 01257 * @param FMPI2Cx FMPI2C Instance. 01258 * @retval None 01259 */ 01260 __STATIC_INLINE void LL_FMPI2C_DisableIT_TX(FMPI2C_TypeDef *FMPI2Cx) 01261 { 01262 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXIE); 01263 } 01264 01265 /** 01266 * @brief Check if the TXIS Interrupt is enabled or disabled. 01267 * @rmtoll CR1 TXIE LL_FMPI2C_IsEnabledIT_TX 01268 * @param FMPI2Cx FMPI2C Instance. 01269 * @retval State of bit (1 or 0). 01270 */ 01271 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_TX(FMPI2C_TypeDef *FMPI2Cx) 01272 { 01273 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TXIE) == (FMPI2C_CR1_TXIE)) ? 1UL : 0UL); 01274 } 01275 01276 /** 01277 * @brief Enable RXNE interrupt. 01278 * @rmtoll CR1 RXIE LL_FMPI2C_EnableIT_RX 01279 * @param FMPI2Cx FMPI2C Instance. 01280 * @retval None 01281 */ 01282 __STATIC_INLINE void LL_FMPI2C_EnableIT_RX(FMPI2C_TypeDef *FMPI2Cx) 01283 { 01284 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXIE); 01285 } 01286 01287 /** 01288 * @brief Disable RXNE interrupt. 01289 * @rmtoll CR1 RXIE LL_FMPI2C_DisableIT_RX 01290 * @param FMPI2Cx FMPI2C Instance. 01291 * @retval None 01292 */ 01293 __STATIC_INLINE void LL_FMPI2C_DisableIT_RX(FMPI2C_TypeDef *FMPI2Cx) 01294 { 01295 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXIE); 01296 } 01297 01298 /** 01299 * @brief Check if the RXNE Interrupt is enabled or disabled. 01300 * @rmtoll CR1 RXIE LL_FMPI2C_IsEnabledIT_RX 01301 * @param FMPI2Cx FMPI2C Instance. 01302 * @retval State of bit (1 or 0). 01303 */ 01304 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_RX(FMPI2C_TypeDef *FMPI2Cx) 01305 { 01306 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_RXIE) == (FMPI2C_CR1_RXIE)) ? 1UL : 0UL); 01307 } 01308 01309 /** 01310 * @brief Enable Address match interrupt (slave mode only). 01311 * @rmtoll CR1 ADDRIE LL_FMPI2C_EnableIT_ADDR 01312 * @param FMPI2Cx FMPI2C Instance. 01313 * @retval None 01314 */ 01315 __STATIC_INLINE void LL_FMPI2C_EnableIT_ADDR(FMPI2C_TypeDef *FMPI2Cx) 01316 { 01317 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ADDRIE); 01318 } 01319 01320 /** 01321 * @brief Disable Address match interrupt (slave mode only). 01322 * @rmtoll CR1 ADDRIE LL_FMPI2C_DisableIT_ADDR 01323 * @param FMPI2Cx FMPI2C Instance. 01324 * @retval None 01325 */ 01326 __STATIC_INLINE void LL_FMPI2C_DisableIT_ADDR(FMPI2C_TypeDef *FMPI2Cx) 01327 { 01328 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ADDRIE); 01329 } 01330 01331 /** 01332 * @brief Check if Address match interrupt is enabled or disabled. 01333 * @rmtoll CR1 ADDRIE LL_FMPI2C_IsEnabledIT_ADDR 01334 * @param FMPI2Cx FMPI2C Instance. 01335 * @retval State of bit (1 or 0). 01336 */ 01337 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_ADDR(FMPI2C_TypeDef *FMPI2Cx) 01338 { 01339 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ADDRIE) == (FMPI2C_CR1_ADDRIE)) ? 1UL : 0UL); 01340 } 01341 01342 /** 01343 * @brief Enable Not acknowledge received interrupt. 01344 * @rmtoll CR1 NACKIE LL_FMPI2C_EnableIT_NACK 01345 * @param FMPI2Cx FMPI2C Instance. 01346 * @retval None 01347 */ 01348 __STATIC_INLINE void LL_FMPI2C_EnableIT_NACK(FMPI2C_TypeDef *FMPI2Cx) 01349 { 01350 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NACKIE); 01351 } 01352 01353 /** 01354 * @brief Disable Not acknowledge received interrupt. 01355 * @rmtoll CR1 NACKIE LL_FMPI2C_DisableIT_NACK 01356 * @param FMPI2Cx FMPI2C Instance. 01357 * @retval None 01358 */ 01359 __STATIC_INLINE void LL_FMPI2C_DisableIT_NACK(FMPI2C_TypeDef *FMPI2Cx) 01360 { 01361 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NACKIE); 01362 } 01363 01364 /** 01365 * @brief Check if Not acknowledge received interrupt is enabled or disabled. 01366 * @rmtoll CR1 NACKIE LL_FMPI2C_IsEnabledIT_NACK 01367 * @param FMPI2Cx FMPI2C Instance. 01368 * @retval State of bit (1 or 0). 01369 */ 01370 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_NACK(FMPI2C_TypeDef *FMPI2Cx) 01371 { 01372 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_NACKIE) == (FMPI2C_CR1_NACKIE)) ? 1UL : 0UL); 01373 } 01374 01375 /** 01376 * @brief Enable STOP detection interrupt. 01377 * @rmtoll CR1 STOPIE LL_FMPI2C_EnableIT_STOP 01378 * @param FMPI2Cx FMPI2C Instance. 01379 * @retval None 01380 */ 01381 __STATIC_INLINE void LL_FMPI2C_EnableIT_STOP(FMPI2C_TypeDef *FMPI2Cx) 01382 { 01383 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_STOPIE); 01384 } 01385 01386 /** 01387 * @brief Disable STOP detection interrupt. 01388 * @rmtoll CR1 STOPIE LL_FMPI2C_DisableIT_STOP 01389 * @param FMPI2Cx FMPI2C Instance. 01390 * @retval None 01391 */ 01392 __STATIC_INLINE void LL_FMPI2C_DisableIT_STOP(FMPI2C_TypeDef *FMPI2Cx) 01393 { 01394 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_STOPIE); 01395 } 01396 01397 /** 01398 * @brief Check if STOP detection interrupt is enabled or disabled. 01399 * @rmtoll CR1 STOPIE LL_FMPI2C_IsEnabledIT_STOP 01400 * @param FMPI2Cx FMPI2C Instance. 01401 * @retval State of bit (1 or 0). 01402 */ 01403 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_STOP(FMPI2C_TypeDef *FMPI2Cx) 01404 { 01405 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_STOPIE) == (FMPI2C_CR1_STOPIE)) ? 1UL : 0UL); 01406 } 01407 01408 /** 01409 * @brief Enable Transfer Complete interrupt. 01410 * @note Any of these events will generate interrupt : 01411 * Transfer Complete (TC) 01412 * Transfer Complete Reload (TCR) 01413 * @rmtoll CR1 TCIE LL_FMPI2C_EnableIT_TC 01414 * @param FMPI2Cx FMPI2C Instance. 01415 * @retval None 01416 */ 01417 __STATIC_INLINE void LL_FMPI2C_EnableIT_TC(FMPI2C_TypeDef *FMPI2Cx) 01418 { 01419 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TCIE); 01420 } 01421 01422 /** 01423 * @brief Disable Transfer Complete interrupt. 01424 * @note Any of these events will generate interrupt : 01425 * Transfer Complete (TC) 01426 * Transfer Complete Reload (TCR) 01427 * @rmtoll CR1 TCIE LL_FMPI2C_DisableIT_TC 01428 * @param FMPI2Cx FMPI2C Instance. 01429 * @retval None 01430 */ 01431 __STATIC_INLINE void LL_FMPI2C_DisableIT_TC(FMPI2C_TypeDef *FMPI2Cx) 01432 { 01433 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TCIE); 01434 } 01435 01436 /** 01437 * @brief Check if Transfer Complete interrupt is enabled or disabled. 01438 * @rmtoll CR1 TCIE LL_FMPI2C_IsEnabledIT_TC 01439 * @param FMPI2Cx FMPI2C Instance. 01440 * @retval State of bit (1 or 0). 01441 */ 01442 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_TC(FMPI2C_TypeDef *FMPI2Cx) 01443 { 01444 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_TCIE) == (FMPI2C_CR1_TCIE)) ? 1UL : 0UL); 01445 } 01446 01447 /** 01448 * @brief Enable Error interrupts. 01449 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01450 * SMBus feature is supported by the FMPI2Cx Instance. 01451 * @note Any of these errors will generate interrupt : 01452 * Arbitration Loss (ARLO) 01453 * Bus Error detection (BERR) 01454 * Overrun/Underrun (OVR) 01455 * SMBus Timeout detection (TIMEOUT) 01456 * SMBus PEC error detection (PECERR) 01457 * SMBus Alert pin event detection (ALERT) 01458 * @rmtoll CR1 ERRIE LL_FMPI2C_EnableIT_ERR 01459 * @param FMPI2Cx FMPI2C Instance. 01460 * @retval None 01461 */ 01462 __STATIC_INLINE void LL_FMPI2C_EnableIT_ERR(FMPI2C_TypeDef *FMPI2Cx) 01463 { 01464 SET_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ERRIE); 01465 } 01466 01467 /** 01468 * @brief Disable Error interrupts. 01469 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01470 * SMBus feature is supported by the FMPI2Cx Instance. 01471 * @note Any of these errors will generate interrupt : 01472 * Arbitration Loss (ARLO) 01473 * Bus Error detection (BERR) 01474 * Overrun/Underrun (OVR) 01475 * SMBus Timeout detection (TIMEOUT) 01476 * SMBus PEC error detection (PECERR) 01477 * SMBus Alert pin event detection (ALERT) 01478 * @rmtoll CR1 ERRIE LL_FMPI2C_DisableIT_ERR 01479 * @param FMPI2Cx FMPI2C Instance. 01480 * @retval None 01481 */ 01482 __STATIC_INLINE void LL_FMPI2C_DisableIT_ERR(FMPI2C_TypeDef *FMPI2Cx) 01483 { 01484 CLEAR_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ERRIE); 01485 } 01486 01487 /** 01488 * @brief Check if Error interrupts are enabled or disabled. 01489 * @rmtoll CR1 ERRIE LL_FMPI2C_IsEnabledIT_ERR 01490 * @param FMPI2Cx FMPI2C Instance. 01491 * @retval State of bit (1 or 0). 01492 */ 01493 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledIT_ERR(FMPI2C_TypeDef *FMPI2Cx) 01494 { 01495 return ((READ_BIT(FMPI2Cx->CR1, FMPI2C_CR1_ERRIE) == (FMPI2C_CR1_ERRIE)) ? 1UL : 0UL); 01496 } 01497 01498 /** 01499 * @} 01500 */ 01501 01502 /** @defgroup FMPI2C_LL_EF_FLAG_management FLAG_management 01503 * @{ 01504 */ 01505 01506 /** 01507 * @brief Indicate the status of Transmit data register empty flag. 01508 * @note RESET: When next data is written in Transmit data register. 01509 * SET: When Transmit data register is empty. 01510 * @rmtoll ISR TXE LL_FMPI2C_IsActiveFlag_TXE 01511 * @param FMPI2Cx FMPI2C Instance. 01512 * @retval State of bit (1 or 0). 01513 */ 01514 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_TXE(FMPI2C_TypeDef *FMPI2Cx) 01515 { 01516 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_TXE) == (FMPI2C_ISR_TXE)) ? 1UL : 0UL); 01517 } 01518 01519 /** 01520 * @brief Indicate the status of Transmit interrupt flag. 01521 * @note RESET: When next data is written in Transmit data register. 01522 * SET: When Transmit data register is empty. 01523 * @rmtoll ISR TXIS LL_FMPI2C_IsActiveFlag_TXIS 01524 * @param FMPI2Cx FMPI2C Instance. 01525 * @retval State of bit (1 or 0). 01526 */ 01527 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_TXIS(FMPI2C_TypeDef *FMPI2Cx) 01528 { 01529 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_TXIS) == (FMPI2C_ISR_TXIS)) ? 1UL : 0UL); 01530 } 01531 01532 /** 01533 * @brief Indicate the status of Receive data register not empty flag. 01534 * @note RESET: When Receive data register is read. 01535 * SET: When the received data is copied in Receive data register. 01536 * @rmtoll ISR RXNE LL_FMPI2C_IsActiveFlag_RXNE 01537 * @param FMPI2Cx FMPI2C Instance. 01538 * @retval State of bit (1 or 0). 01539 */ 01540 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_RXNE(FMPI2C_TypeDef *FMPI2Cx) 01541 { 01542 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_RXNE) == (FMPI2C_ISR_RXNE)) ? 1UL : 0UL); 01543 } 01544 01545 /** 01546 * @brief Indicate the status of Address matched flag (slave mode). 01547 * @note RESET: Clear default value. 01548 * SET: When the received slave address matched with one of the enabled slave address. 01549 * @rmtoll ISR ADDR LL_FMPI2C_IsActiveFlag_ADDR 01550 * @param FMPI2Cx FMPI2C Instance. 01551 * @retval State of bit (1 or 0). 01552 */ 01553 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_ADDR(FMPI2C_TypeDef *FMPI2Cx) 01554 { 01555 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_ADDR) == (FMPI2C_ISR_ADDR)) ? 1UL : 0UL); 01556 } 01557 01558 /** 01559 * @brief Indicate the status of Not Acknowledge received flag. 01560 * @note RESET: Clear default value. 01561 * SET: When a NACK is received after a byte transmission. 01562 * @rmtoll ISR NACKF LL_FMPI2C_IsActiveFlag_NACK 01563 * @param FMPI2Cx FMPI2C Instance. 01564 * @retval State of bit (1 or 0). 01565 */ 01566 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_NACK(FMPI2C_TypeDef *FMPI2Cx) 01567 { 01568 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_NACKF) == (FMPI2C_ISR_NACKF)) ? 1UL : 0UL); 01569 } 01570 01571 /** 01572 * @brief Indicate the status of Stop detection flag. 01573 * @note RESET: Clear default value. 01574 * SET: When a Stop condition is detected. 01575 * @rmtoll ISR STOPF LL_FMPI2C_IsActiveFlag_STOP 01576 * @param FMPI2Cx FMPI2C Instance. 01577 * @retval State of bit (1 or 0). 01578 */ 01579 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_STOP(FMPI2C_TypeDef *FMPI2Cx) 01580 { 01581 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_STOPF) == (FMPI2C_ISR_STOPF)) ? 1UL : 0UL); 01582 } 01583 01584 /** 01585 * @brief Indicate the status of Transfer complete flag (master mode). 01586 * @note RESET: Clear default value. 01587 * SET: When RELOAD=0, AUTOEND=0 and NBYTES date have been transferred. 01588 * @rmtoll ISR TC LL_FMPI2C_IsActiveFlag_TC 01589 * @param FMPI2Cx FMPI2C Instance. 01590 * @retval State of bit (1 or 0). 01591 */ 01592 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_TC(FMPI2C_TypeDef *FMPI2Cx) 01593 { 01594 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_TC) == (FMPI2C_ISR_TC)) ? 1UL : 0UL); 01595 } 01596 01597 /** 01598 * @brief Indicate the status of Transfer complete flag (master mode). 01599 * @note RESET: Clear default value. 01600 * SET: When RELOAD=1 and NBYTES date have been transferred. 01601 * @rmtoll ISR TCR LL_FMPI2C_IsActiveFlag_TCR 01602 * @param FMPI2Cx FMPI2C Instance. 01603 * @retval State of bit (1 or 0). 01604 */ 01605 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_TCR(FMPI2C_TypeDef *FMPI2Cx) 01606 { 01607 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_TCR) == (FMPI2C_ISR_TCR)) ? 1UL : 0UL); 01608 } 01609 01610 /** 01611 * @brief Indicate the status of Bus error flag. 01612 * @note RESET: Clear default value. 01613 * SET: When a misplaced Start or Stop condition is detected. 01614 * @rmtoll ISR BERR LL_FMPI2C_IsActiveFlag_BERR 01615 * @param FMPI2Cx FMPI2C Instance. 01616 * @retval State of bit (1 or 0). 01617 */ 01618 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_BERR(FMPI2C_TypeDef *FMPI2Cx) 01619 { 01620 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_BERR) == (FMPI2C_ISR_BERR)) ? 1UL : 0UL); 01621 } 01622 01623 /** 01624 * @brief Indicate the status of Arbitration lost flag. 01625 * @note RESET: Clear default value. 01626 * SET: When arbitration lost. 01627 * @rmtoll ISR ARLO LL_FMPI2C_IsActiveFlag_ARLO 01628 * @param FMPI2Cx FMPI2C Instance. 01629 * @retval State of bit (1 or 0). 01630 */ 01631 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_ARLO(FMPI2C_TypeDef *FMPI2Cx) 01632 { 01633 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_ARLO) == (FMPI2C_ISR_ARLO)) ? 1UL : 0UL); 01634 } 01635 01636 /** 01637 * @brief Indicate the status of Overrun/Underrun flag (slave mode). 01638 * @note RESET: Clear default value. 01639 * SET: When an overrun/underrun error occurs (Clock Stretching Disabled). 01640 * @rmtoll ISR OVR LL_FMPI2C_IsActiveFlag_OVR 01641 * @param FMPI2Cx FMPI2C Instance. 01642 * @retval State of bit (1 or 0). 01643 */ 01644 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_OVR(FMPI2C_TypeDef *FMPI2Cx) 01645 { 01646 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_OVR) == (FMPI2C_ISR_OVR)) ? 1UL : 0UL); 01647 } 01648 01649 /** 01650 * @brief Indicate the status of SMBus PEC error flag in reception. 01651 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01652 * SMBus feature is supported by the FMPI2Cx Instance. 01653 * @note RESET: Clear default value. 01654 * SET: When the received PEC does not match with the PEC register content. 01655 * @rmtoll ISR PECERR LL_FMPI2C_IsActiveSMBusFlag_PECERR 01656 * @param FMPI2Cx FMPI2C Instance. 01657 * @retval State of bit (1 or 0). 01658 */ 01659 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveSMBusFlag_PECERR(FMPI2C_TypeDef *FMPI2Cx) 01660 { 01661 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_PECERR) == (FMPI2C_ISR_PECERR)) ? 1UL : 0UL); 01662 } 01663 01664 /** 01665 * @brief Indicate the status of SMBus Timeout detection flag. 01666 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01667 * SMBus feature is supported by the FMPI2Cx Instance. 01668 * @note RESET: Clear default value. 01669 * SET: When a timeout or extended clock timeout occurs. 01670 * @rmtoll ISR TIMEOUT LL_FMPI2C_IsActiveSMBusFlag_TIMEOUT 01671 * @param FMPI2Cx FMPI2C Instance. 01672 * @retval State of bit (1 or 0). 01673 */ 01674 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveSMBusFlag_TIMEOUT(FMPI2C_TypeDef *FMPI2Cx) 01675 { 01676 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_TIMEOUT) == (FMPI2C_ISR_TIMEOUT)) ? 1UL : 0UL); 01677 } 01678 01679 /** 01680 * @brief Indicate the status of SMBus alert flag. 01681 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01682 * SMBus feature is supported by the FMPI2Cx Instance. 01683 * @note RESET: Clear default value. 01684 * SET: When SMBus host configuration, SMBus alert enabled and 01685 * a falling edge event occurs on SMBA pin. 01686 * @rmtoll ISR ALERT LL_FMPI2C_IsActiveSMBusFlag_ALERT 01687 * @param FMPI2Cx FMPI2C Instance. 01688 * @retval State of bit (1 or 0). 01689 */ 01690 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveSMBusFlag_ALERT(FMPI2C_TypeDef *FMPI2Cx) 01691 { 01692 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_ALERT) == (FMPI2C_ISR_ALERT)) ? 1UL : 0UL); 01693 } 01694 01695 /** 01696 * @brief Indicate the status of Bus Busy flag. 01697 * @note RESET: Clear default value. 01698 * SET: When a Start condition is detected. 01699 * @rmtoll ISR BUSY LL_FMPI2C_IsActiveFlag_BUSY 01700 * @param FMPI2Cx FMPI2C Instance. 01701 * @retval State of bit (1 or 0). 01702 */ 01703 __STATIC_INLINE uint32_t LL_FMPI2C_IsActiveFlag_BUSY(FMPI2C_TypeDef *FMPI2Cx) 01704 { 01705 return ((READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_BUSY) == (FMPI2C_ISR_BUSY)) ? 1UL : 0UL); 01706 } 01707 01708 /** 01709 * @brief Clear Address Matched flag. 01710 * @rmtoll ICR ADDRCF LL_FMPI2C_ClearFlag_ADDR 01711 * @param FMPI2Cx FMPI2C Instance. 01712 * @retval None 01713 */ 01714 __STATIC_INLINE void LL_FMPI2C_ClearFlag_ADDR(FMPI2C_TypeDef *FMPI2Cx) 01715 { 01716 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_ADDRCF); 01717 } 01718 01719 /** 01720 * @brief Clear Not Acknowledge flag. 01721 * @rmtoll ICR NACKCF LL_FMPI2C_ClearFlag_NACK 01722 * @param FMPI2Cx FMPI2C Instance. 01723 * @retval None 01724 */ 01725 __STATIC_INLINE void LL_FMPI2C_ClearFlag_NACK(FMPI2C_TypeDef *FMPI2Cx) 01726 { 01727 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_NACKCF); 01728 } 01729 01730 /** 01731 * @brief Clear Stop detection flag. 01732 * @rmtoll ICR STOPCF LL_FMPI2C_ClearFlag_STOP 01733 * @param FMPI2Cx FMPI2C Instance. 01734 * @retval None 01735 */ 01736 __STATIC_INLINE void LL_FMPI2C_ClearFlag_STOP(FMPI2C_TypeDef *FMPI2Cx) 01737 { 01738 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_STOPCF); 01739 } 01740 01741 /** 01742 * @brief Clear Transmit data register empty flag (TXE). 01743 * @note This bit can be clear by software in order to flush the transmit data register (TXDR). 01744 * @rmtoll ISR TXE LL_FMPI2C_ClearFlag_TXE 01745 * @param FMPI2Cx FMPI2C Instance. 01746 * @retval None 01747 */ 01748 __STATIC_INLINE void LL_FMPI2C_ClearFlag_TXE(FMPI2C_TypeDef *FMPI2Cx) 01749 { 01750 WRITE_REG(FMPI2Cx->ISR, FMPI2C_ISR_TXE); 01751 } 01752 01753 /** 01754 * @brief Clear Bus error flag. 01755 * @rmtoll ICR BERRCF LL_FMPI2C_ClearFlag_BERR 01756 * @param FMPI2Cx FMPI2C Instance. 01757 * @retval None 01758 */ 01759 __STATIC_INLINE void LL_FMPI2C_ClearFlag_BERR(FMPI2C_TypeDef *FMPI2Cx) 01760 { 01761 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_BERRCF); 01762 } 01763 01764 /** 01765 * @brief Clear Arbitration lost flag. 01766 * @rmtoll ICR ARLOCF LL_FMPI2C_ClearFlag_ARLO 01767 * @param FMPI2Cx FMPI2C Instance. 01768 * @retval None 01769 */ 01770 __STATIC_INLINE void LL_FMPI2C_ClearFlag_ARLO(FMPI2C_TypeDef *FMPI2Cx) 01771 { 01772 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_ARLOCF); 01773 } 01774 01775 /** 01776 * @brief Clear Overrun/Underrun flag. 01777 * @rmtoll ICR OVRCF LL_FMPI2C_ClearFlag_OVR 01778 * @param FMPI2Cx FMPI2C Instance. 01779 * @retval None 01780 */ 01781 __STATIC_INLINE void LL_FMPI2C_ClearFlag_OVR(FMPI2C_TypeDef *FMPI2Cx) 01782 { 01783 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_OVRCF); 01784 } 01785 01786 /** 01787 * @brief Clear SMBus PEC error flag. 01788 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01789 * SMBus feature is supported by the FMPI2Cx Instance. 01790 * @rmtoll ICR PECCF LL_FMPI2C_ClearSMBusFlag_PECERR 01791 * @param FMPI2Cx FMPI2C Instance. 01792 * @retval None 01793 */ 01794 __STATIC_INLINE void LL_FMPI2C_ClearSMBusFlag_PECERR(FMPI2C_TypeDef *FMPI2Cx) 01795 { 01796 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_PECCF); 01797 } 01798 01799 /** 01800 * @brief Clear SMBus Timeout detection flag. 01801 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01802 * SMBus feature is supported by the FMPI2Cx Instance. 01803 * @rmtoll ICR TIMOUTCF LL_FMPI2C_ClearSMBusFlag_TIMEOUT 01804 * @param FMPI2Cx FMPI2C Instance. 01805 * @retval None 01806 */ 01807 __STATIC_INLINE void LL_FMPI2C_ClearSMBusFlag_TIMEOUT(FMPI2C_TypeDef *FMPI2Cx) 01808 { 01809 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_TIMOUTCF); 01810 } 01811 01812 /** 01813 * @brief Clear SMBus Alert flag. 01814 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 01815 * SMBus feature is supported by the FMPI2Cx Instance. 01816 * @rmtoll ICR ALERTCF LL_FMPI2C_ClearSMBusFlag_ALERT 01817 * @param FMPI2Cx FMPI2C Instance. 01818 * @retval None 01819 */ 01820 __STATIC_INLINE void LL_FMPI2C_ClearSMBusFlag_ALERT(FMPI2C_TypeDef *FMPI2Cx) 01821 { 01822 SET_BIT(FMPI2Cx->ICR, FMPI2C_ICR_ALERTCF); 01823 } 01824 01825 /** 01826 * @} 01827 */ 01828 01829 /** @defgroup FMPI2C_LL_EF_Data_Management Data_Management 01830 * @{ 01831 */ 01832 01833 /** 01834 * @brief Enable automatic STOP condition generation (master mode). 01835 * @note Automatic end mode : a STOP condition is automatically sent when NBYTES data are transferred. 01836 * This bit has no effect in slave mode or when RELOAD bit is set. 01837 * @rmtoll CR2 AUTOEND LL_FMPI2C_EnableAutoEndMode 01838 * @param FMPI2Cx FMPI2C Instance. 01839 * @retval None 01840 */ 01841 __STATIC_INLINE void LL_FMPI2C_EnableAutoEndMode(FMPI2C_TypeDef *FMPI2Cx) 01842 { 01843 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_AUTOEND); 01844 } 01845 01846 /** 01847 * @brief Disable automatic STOP condition generation (master mode). 01848 * @note Software end mode : TC flag is set when NBYTES data are transferre, stretching SCL low. 01849 * @rmtoll CR2 AUTOEND LL_FMPI2C_DisableAutoEndMode 01850 * @param FMPI2Cx FMPI2C Instance. 01851 * @retval None 01852 */ 01853 __STATIC_INLINE void LL_FMPI2C_DisableAutoEndMode(FMPI2C_TypeDef *FMPI2Cx) 01854 { 01855 CLEAR_BIT(FMPI2Cx->CR2, FMPI2C_CR2_AUTOEND); 01856 } 01857 01858 /** 01859 * @brief Check if automatic STOP condition is enabled or disabled. 01860 * @rmtoll CR2 AUTOEND LL_FMPI2C_IsEnabledAutoEndMode 01861 * @param FMPI2Cx FMPI2C Instance. 01862 * @retval State of bit (1 or 0). 01863 */ 01864 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledAutoEndMode(FMPI2C_TypeDef *FMPI2Cx) 01865 { 01866 return ((READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_AUTOEND) == (FMPI2C_CR2_AUTOEND)) ? 1UL : 0UL); 01867 } 01868 01869 /** 01870 * @brief Enable reload mode (master mode). 01871 * @note The transfer is not completed after the NBYTES data transfer, NBYTES will be reloaded when TCR flag is set. 01872 * @rmtoll CR2 RELOAD LL_FMPI2C_EnableReloadMode 01873 * @param FMPI2Cx FMPI2C Instance. 01874 * @retval None 01875 */ 01876 __STATIC_INLINE void LL_FMPI2C_EnableReloadMode(FMPI2C_TypeDef *FMPI2Cx) 01877 { 01878 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_RELOAD); 01879 } 01880 01881 /** 01882 * @brief Disable reload mode (master mode). 01883 * @note The transfer is completed after the NBYTES data transfer(STOP or RESTART will follow). 01884 * @rmtoll CR2 RELOAD LL_FMPI2C_DisableReloadMode 01885 * @param FMPI2Cx FMPI2C Instance. 01886 * @retval None 01887 */ 01888 __STATIC_INLINE void LL_FMPI2C_DisableReloadMode(FMPI2C_TypeDef *FMPI2Cx) 01889 { 01890 CLEAR_BIT(FMPI2Cx->CR2, FMPI2C_CR2_RELOAD); 01891 } 01892 01893 /** 01894 * @brief Check if reload mode is enabled or disabled. 01895 * @rmtoll CR2 RELOAD LL_FMPI2C_IsEnabledReloadMode 01896 * @param FMPI2Cx FMPI2C Instance. 01897 * @retval State of bit (1 or 0). 01898 */ 01899 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledReloadMode(FMPI2C_TypeDef *FMPI2Cx) 01900 { 01901 return ((READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_RELOAD) == (FMPI2C_CR2_RELOAD)) ? 1UL : 0UL); 01902 } 01903 01904 /** 01905 * @brief Configure the number of bytes for transfer. 01906 * @note Changing these bits when START bit is set is not allowed. 01907 * @rmtoll CR2 NBYTES LL_FMPI2C_SetTransferSize 01908 * @param FMPI2Cx FMPI2C Instance. 01909 * @param TransferSize This parameter must be a value between Min_Data=0x00 and Max_Data=0xFF. 01910 * @retval None 01911 */ 01912 __STATIC_INLINE void LL_FMPI2C_SetTransferSize(FMPI2C_TypeDef *FMPI2Cx, uint32_t TransferSize) 01913 { 01914 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_NBYTES, TransferSize << FMPI2C_CR2_NBYTES_Pos); 01915 } 01916 01917 /** 01918 * @brief Get the number of bytes configured for transfer. 01919 * @rmtoll CR2 NBYTES LL_FMPI2C_GetTransferSize 01920 * @param FMPI2Cx FMPI2C Instance. 01921 * @retval Value between Min_Data=0x0 and Max_Data=0xFF 01922 */ 01923 __STATIC_INLINE uint32_t LL_FMPI2C_GetTransferSize(FMPI2C_TypeDef *FMPI2Cx) 01924 { 01925 return (uint32_t)(READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_NBYTES) >> FMPI2C_CR2_NBYTES_Pos); 01926 } 01927 01928 /** 01929 * @brief Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code 01930 or next received byte. 01931 * @note Usage in Slave mode only. 01932 * @rmtoll CR2 NACK LL_FMPI2C_AcknowledgeNextData 01933 * @param FMPI2Cx FMPI2C Instance. 01934 * @param TypeAcknowledge This parameter can be one of the following values: 01935 * @arg @ref LL_FMPI2C_ACK 01936 * @arg @ref LL_FMPI2C_NACK 01937 * @retval None 01938 */ 01939 __STATIC_INLINE void LL_FMPI2C_AcknowledgeNextData(FMPI2C_TypeDef *FMPI2Cx, uint32_t TypeAcknowledge) 01940 { 01941 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_NACK, TypeAcknowledge); 01942 } 01943 01944 /** 01945 * @brief Generate a START or RESTART condition 01946 * @note The START bit can be set even if bus is BUSY or FMPI2C is in slave mode. 01947 * This action has no effect when RELOAD is set. 01948 * @rmtoll CR2 START LL_FMPI2C_GenerateStartCondition 01949 * @param FMPI2Cx FMPI2C Instance. 01950 * @retval None 01951 */ 01952 __STATIC_INLINE void LL_FMPI2C_GenerateStartCondition(FMPI2C_TypeDef *FMPI2Cx) 01953 { 01954 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_START); 01955 } 01956 01957 /** 01958 * @brief Generate a STOP condition after the current byte transfer (master mode). 01959 * @rmtoll CR2 STOP LL_FMPI2C_GenerateStopCondition 01960 * @param FMPI2Cx FMPI2C Instance. 01961 * @retval None 01962 */ 01963 __STATIC_INLINE void LL_FMPI2C_GenerateStopCondition(FMPI2C_TypeDef *FMPI2Cx) 01964 { 01965 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_STOP); 01966 } 01967 01968 /** 01969 * @brief Enable automatic RESTART Read request condition for 10bit address header (master mode). 01970 * @note The master sends the complete 10bit slave address read sequence : 01971 * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address 01972 in Read direction. 01973 * @rmtoll CR2 HEAD10R LL_FMPI2C_EnableAuto10BitRead 01974 * @param FMPI2Cx FMPI2C Instance. 01975 * @retval None 01976 */ 01977 __STATIC_INLINE void LL_FMPI2C_EnableAuto10BitRead(FMPI2C_TypeDef *FMPI2Cx) 01978 { 01979 CLEAR_BIT(FMPI2Cx->CR2, FMPI2C_CR2_HEAD10R); 01980 } 01981 01982 /** 01983 * @brief Disable automatic RESTART Read request condition for 10bit address header (master mode). 01984 * @note The master only sends the first 7 bits of 10bit address in Read direction. 01985 * @rmtoll CR2 HEAD10R LL_FMPI2C_DisableAuto10BitRead 01986 * @param FMPI2Cx FMPI2C Instance. 01987 * @retval None 01988 */ 01989 __STATIC_INLINE void LL_FMPI2C_DisableAuto10BitRead(FMPI2C_TypeDef *FMPI2Cx) 01990 { 01991 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_HEAD10R); 01992 } 01993 01994 /** 01995 * @brief Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled. 01996 * @rmtoll CR2 HEAD10R LL_FMPI2C_IsEnabledAuto10BitRead 01997 * @param FMPI2Cx FMPI2C Instance. 01998 * @retval State of bit (1 or 0). 01999 */ 02000 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledAuto10BitRead(FMPI2C_TypeDef *FMPI2Cx) 02001 { 02002 return ((READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_HEAD10R) != (FMPI2C_CR2_HEAD10R)) ? 1UL : 0UL); 02003 } 02004 02005 /** 02006 * @brief Configure the transfer direction (master mode). 02007 * @note Changing these bits when START bit is set is not allowed. 02008 * @rmtoll CR2 RD_WRN LL_FMPI2C_SetTransferRequest 02009 * @param FMPI2Cx FMPI2C Instance. 02010 * @param TransferRequest This parameter can be one of the following values: 02011 * @arg @ref LL_FMPI2C_REQUEST_WRITE 02012 * @arg @ref LL_FMPI2C_REQUEST_READ 02013 * @retval None 02014 */ 02015 __STATIC_INLINE void LL_FMPI2C_SetTransferRequest(FMPI2C_TypeDef *FMPI2Cx, uint32_t TransferRequest) 02016 { 02017 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_RD_WRN, TransferRequest); 02018 } 02019 02020 /** 02021 * @brief Get the transfer direction requested (master mode). 02022 * @rmtoll CR2 RD_WRN LL_FMPI2C_GetTransferRequest 02023 * @param FMPI2Cx FMPI2C Instance. 02024 * @retval Returned value can be one of the following values: 02025 * @arg @ref LL_FMPI2C_REQUEST_WRITE 02026 * @arg @ref LL_FMPI2C_REQUEST_READ 02027 */ 02028 __STATIC_INLINE uint32_t LL_FMPI2C_GetTransferRequest(FMPI2C_TypeDef *FMPI2Cx) 02029 { 02030 return (uint32_t)(READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_RD_WRN)); 02031 } 02032 02033 /** 02034 * @brief Configure the slave address for transfer (master mode). 02035 * @note Changing these bits when START bit is set is not allowed. 02036 * @rmtoll CR2 SADD LL_FMPI2C_SetSlaveAddr 02037 * @param FMPI2Cx FMPI2C Instance. 02038 * @param SlaveAddr This parameter must be a value between Min_Data=0x00 and Max_Data=0x3F. 02039 * @retval None 02040 */ 02041 __STATIC_INLINE void LL_FMPI2C_SetSlaveAddr(FMPI2C_TypeDef *FMPI2Cx, uint32_t SlaveAddr) 02042 { 02043 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_SADD, SlaveAddr); 02044 } 02045 02046 /** 02047 * @brief Get the slave address programmed for transfer. 02048 * @rmtoll CR2 SADD LL_FMPI2C_GetSlaveAddr 02049 * @param FMPI2Cx FMPI2C Instance. 02050 * @retval Value between Min_Data=0x0 and Max_Data=0x3F 02051 */ 02052 __STATIC_INLINE uint32_t LL_FMPI2C_GetSlaveAddr(FMPI2C_TypeDef *FMPI2Cx) 02053 { 02054 return (uint32_t)(READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_SADD)); 02055 } 02056 02057 /** 02058 * @brief Handles FMPI2Cx communication when starting transfer or during transfer (TC or TCR flag are set). 02059 * @rmtoll CR2 SADD LL_FMPI2C_HandleTransfer\n 02060 * CR2 ADD10 LL_FMPI2C_HandleTransfer\n 02061 * CR2 RD_WRN LL_FMPI2C_HandleTransfer\n 02062 * CR2 START LL_FMPI2C_HandleTransfer\n 02063 * CR2 STOP LL_FMPI2C_HandleTransfer\n 02064 * CR2 RELOAD LL_FMPI2C_HandleTransfer\n 02065 * CR2 NBYTES LL_FMPI2C_HandleTransfer\n 02066 * CR2 AUTOEND LL_FMPI2C_HandleTransfer\n 02067 * CR2 HEAD10R LL_FMPI2C_HandleTransfer 02068 * @param FMPI2Cx FMPI2C Instance. 02069 * @param SlaveAddr Specifies the slave address to be programmed. 02070 * @param SlaveAddrSize This parameter can be one of the following values: 02071 * @arg @ref LL_FMPI2C_ADDRSLAVE_7BIT 02072 * @arg @ref LL_FMPI2C_ADDRSLAVE_10BIT 02073 * @param TransferSize Specifies the number of bytes to be programmed. 02074 * This parameter must be a value between Min_Data=0 and Max_Data=255. 02075 * @param EndMode This parameter can be one of the following values: 02076 * @arg @ref LL_FMPI2C_MODE_RELOAD 02077 * @arg @ref LL_FMPI2C_MODE_AUTOEND 02078 * @arg @ref LL_FMPI2C_MODE_SOFTEND 02079 * @arg @ref LL_FMPI2C_MODE_SMBUS_RELOAD 02080 * @arg @ref LL_FMPI2C_MODE_SMBUS_AUTOEND_NO_PEC 02081 * @arg @ref LL_FMPI2C_MODE_SMBUS_SOFTEND_NO_PEC 02082 * @arg @ref LL_FMPI2C_MODE_SMBUS_AUTOEND_WITH_PEC 02083 * @arg @ref LL_FMPI2C_MODE_SMBUS_SOFTEND_WITH_PEC 02084 * @param Request This parameter can be one of the following values: 02085 * @arg @ref LL_FMPI2C_GENERATE_NOSTARTSTOP 02086 * @arg @ref LL_FMPI2C_GENERATE_STOP 02087 * @arg @ref LL_FMPI2C_GENERATE_START_READ 02088 * @arg @ref LL_FMPI2C_GENERATE_START_WRITE 02089 * @arg @ref LL_FMPI2C_GENERATE_RESTART_7BIT_READ 02090 * @arg @ref LL_FMPI2C_GENERATE_RESTART_7BIT_WRITE 02091 * @arg @ref LL_FMPI2C_GENERATE_RESTART_10BIT_READ 02092 * @arg @ref LL_FMPI2C_GENERATE_RESTART_10BIT_WRITE 02093 * @retval None 02094 */ 02095 __STATIC_INLINE void LL_FMPI2C_HandleTransfer(FMPI2C_TypeDef *FMPI2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize, 02096 uint32_t TransferSize, uint32_t EndMode, uint32_t Request) 02097 { 02098 MODIFY_REG(FMPI2Cx->CR2, FMPI2C_CR2_SADD | FMPI2C_CR2_ADD10 | 02099 (FMPI2C_CR2_RD_WRN & (uint32_t)(Request >> (31U - FMPI2C_CR2_RD_WRN_Pos))) | 02100 FMPI2C_CR2_START | FMPI2C_CR2_STOP | FMPI2C_CR2_RELOAD | 02101 FMPI2C_CR2_NBYTES | FMPI2C_CR2_AUTOEND | FMPI2C_CR2_HEAD10R, 02102 SlaveAddr | SlaveAddrSize | (TransferSize << FMPI2C_CR2_NBYTES_Pos) | EndMode | Request); 02103 } 02104 02105 /** 02106 * @brief Indicate the value of transfer direction (slave mode). 02107 * @note RESET: Write transfer, Slave enters in receiver mode. 02108 * SET: Read transfer, Slave enters in transmitter mode. 02109 * @rmtoll ISR DIR LL_FMPI2C_GetTransferDirection 02110 * @param FMPI2Cx FMPI2C Instance. 02111 * @retval Returned value can be one of the following values: 02112 * @arg @ref LL_FMPI2C_DIRECTION_WRITE 02113 * @arg @ref LL_FMPI2C_DIRECTION_READ 02114 */ 02115 __STATIC_INLINE uint32_t LL_FMPI2C_GetTransferDirection(FMPI2C_TypeDef *FMPI2Cx) 02116 { 02117 return (uint32_t)(READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_DIR)); 02118 } 02119 02120 /** 02121 * @brief Return the slave matched address. 02122 * @rmtoll ISR ADDCODE LL_FMPI2C_GetAddressMatchCode 02123 * @param FMPI2Cx FMPI2C Instance. 02124 * @retval Value between Min_Data=0x00 and Max_Data=0x3F 02125 */ 02126 __STATIC_INLINE uint32_t LL_FMPI2C_GetAddressMatchCode(FMPI2C_TypeDef *FMPI2Cx) 02127 { 02128 return (uint32_t)(READ_BIT(FMPI2Cx->ISR, FMPI2C_ISR_ADDCODE) >> FMPI2C_ISR_ADDCODE_Pos << 1); 02129 } 02130 02131 /** 02132 * @brief Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode). 02133 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 02134 * SMBus feature is supported by the FMPI2Cx Instance. 02135 * @note This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition 02136 or an Address Matched is received. 02137 * This bit has no effect when RELOAD bit is set. 02138 * This bit has no effect in device mode when SBC bit is not set. 02139 * @rmtoll CR2 PECBYTE LL_FMPI2C_EnableSMBusPECCompare 02140 * @param FMPI2Cx FMPI2C Instance. 02141 * @retval None 02142 */ 02143 __STATIC_INLINE void LL_FMPI2C_EnableSMBusPECCompare(FMPI2C_TypeDef *FMPI2Cx) 02144 { 02145 SET_BIT(FMPI2Cx->CR2, FMPI2C_CR2_PECBYTE); 02146 } 02147 02148 /** 02149 * @brief Check if the SMBus Packet Error byte internal comparison is requested or not. 02150 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 02151 * SMBus feature is supported by the FMPI2Cx Instance. 02152 * @rmtoll CR2 PECBYTE LL_FMPI2C_IsEnabledSMBusPECCompare 02153 * @param FMPI2Cx FMPI2C Instance. 02154 * @retval State of bit (1 or 0). 02155 */ 02156 __STATIC_INLINE uint32_t LL_FMPI2C_IsEnabledSMBusPECCompare(FMPI2C_TypeDef *FMPI2Cx) 02157 { 02158 return ((READ_BIT(FMPI2Cx->CR2, FMPI2C_CR2_PECBYTE) == (FMPI2C_CR2_PECBYTE)) ? 1UL : 0UL); 02159 } 02160 02161 /** 02162 * @brief Get the SMBus Packet Error byte calculated. 02163 * @note The macro IS_FMPSMBUS_ALL_INSTANCE(FMPI2Cx) can be used to check whether or not 02164 * SMBus feature is supported by the FMPI2Cx Instance. 02165 * @rmtoll PECR PEC LL_FMPI2C_GetSMBusPEC 02166 * @param FMPI2Cx FMPI2C Instance. 02167 * @retval Value between Min_Data=0x00 and Max_Data=0xFF 02168 */ 02169 __STATIC_INLINE uint32_t LL_FMPI2C_GetSMBusPEC(FMPI2C_TypeDef *FMPI2Cx) 02170 { 02171 return (uint32_t)(READ_BIT(FMPI2Cx->PECR, FMPI2C_PECR_PEC)); 02172 } 02173 02174 /** 02175 * @brief Read Receive Data register. 02176 * @rmtoll RXDR RXDATA LL_FMPI2C_ReceiveData8 02177 * @param FMPI2Cx FMPI2C Instance. 02178 * @retval Value between Min_Data=0x00 and Max_Data=0xFF 02179 */ 02180 __STATIC_INLINE uint8_t LL_FMPI2C_ReceiveData8(FMPI2C_TypeDef *FMPI2Cx) 02181 { 02182 return (uint8_t)(READ_BIT(FMPI2Cx->RXDR, FMPI2C_RXDR_RXDATA)); 02183 } 02184 02185 /** 02186 * @brief Write in Transmit Data Register . 02187 * @rmtoll TXDR TXDATA LL_FMPI2C_TransmitData8 02188 * @param FMPI2Cx FMPI2C Instance. 02189 * @param Data Value between Min_Data=0x00 and Max_Data=0xFF 02190 * @retval None 02191 */ 02192 __STATIC_INLINE void LL_FMPI2C_TransmitData8(FMPI2C_TypeDef *FMPI2Cx, uint8_t Data) 02193 { 02194 WRITE_REG(FMPI2Cx->TXDR, Data); 02195 } 02196 02197 /** 02198 * @} 02199 */ 02200 02201 #if defined(USE_FULL_LL_DRIVER) 02202 /** @defgroup FMPI2C_LL_EF_Init Initialization and de-initialization functions 02203 * @{ 02204 */ 02205 02206 ErrorStatus LL_FMPI2C_Init(FMPI2C_TypeDef *FMPI2Cx, LL_FMPI2C_InitTypeDef *FMPI2C_InitStruct); 02207 ErrorStatus LL_FMPI2C_DeInit(FMPI2C_TypeDef *FMPI2Cx); 02208 void LL_FMPI2C_StructInit(LL_FMPI2C_InitTypeDef *FMPI2C_InitStruct); 02209 02210 02211 /** 02212 * @} 02213 */ 02214 #endif /* USE_FULL_LL_DRIVER */ 02215 02216 /** 02217 * @} 02218 */ 02219 02220 /** 02221 * @} 02222 */ 02223 02224 #endif /* FMPI2C1 */ 02225 02226 /** 02227 * @} 02228 */ 02229 02230 #endif /* FMPI2C_CR1_PE */ 02231 #ifdef __cplusplus 02232 } 02233 #endif 02234 02235 #endif /* STM32F4xx_LL_FMPI2C_H */ 02236 02237 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/