Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 6 | ||
|---|---|---|---|
| Line 65... | Line 65... | ||
| 65 | * @{ |
65 | * @{ |
| 66 | */ |
66 | */ |
| 67 | typedef struct |
67 | typedef struct |
| 68 | { |
68 | { |
| 69 | uint32_t PeripheralMode; /*!< Specifies the peripheral mode. |
69 | uint32_t PeripheralMode; /*!< Specifies the peripheral mode. |
| 70 | This parameter can be a value of @ref I2C_LL_EC_PERIPHERAL_MODE |
70 | This parameter can be a value of @ref I2C_LL_EC_PERIPHERAL_MODE. |
| 71 | 71 | ||
| 72 | This feature can be modified afterwards using unitary function @ref LL_I2C_SetMode(). */ |
72 | This feature can be modified afterwards using unitary function |
| - | 73 | @ref LL_I2C_SetMode(). */ |
|
| 73 | 74 | ||
| 74 | uint32_t Timing; /*!< Specifies the SDA setup, hold time and the SCL high, low period values. |
75 | uint32_t Timing; /*!< Specifies the SDA setup, hold time and the SCL high, low period values. |
| 75 | This parameter must be set by referring to the STM32CubeMX Tool and |
76 | This parameter must be set by referring to the STM32CubeMX Tool and |
| 76 | the helper macro @ref __LL_I2C_CONVERT_TIMINGS() |
77 | the helper macro @ref __LL_I2C_CONVERT_TIMINGS(). |
| 77 | 78 | ||
| 78 | This feature can be modified afterwards using unitary function @ref LL_I2C_SetTiming(). */ |
79 | This feature can be modified afterwards using unitary function |
| - | 80 | @ref LL_I2C_SetTiming(). */ |
|
| 79 | 81 | ||
| 80 | uint32_t AnalogFilter; /*!< Enables or disables analog noise filter. |
82 | uint32_t AnalogFilter; /*!< Enables or disables analog noise filter. |
| 81 | This parameter can be a value of @ref I2C_LL_EC_ANALOGFILTER_SELECTION |
83 | This parameter can be a value of @ref I2C_LL_EC_ANALOGFILTER_SELECTION. |
| 82 | 84 | ||
| - | 85 | This feature can be modified afterwards using unitary functions |
|
| 83 | This feature can be modified afterwards using unitary functions @ref LL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter(). */ |
86 | @ref LL_I2C_EnableAnalogFilter() or LL_I2C_DisableAnalogFilter(). */ |
| 84 | 87 | ||
| 85 | uint32_t DigitalFilter; /*!< Configures the digital noise filter. |
88 | uint32_t DigitalFilter; /*!< Configures the digital noise filter. |
| 86 | This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F |
89 | This parameter can be a number between Min_Data = 0x00 and Max_Data = 0x0F. |
| 87 | 90 | ||
| 88 | This feature can be modified afterwards using unitary function @ref LL_I2C_SetDigitalFilter(). */ |
91 | This feature can be modified afterwards using unitary function |
| - | 92 | @ref LL_I2C_SetDigitalFilter(). */ |
|
| 89 | 93 | ||
| 90 | uint32_t OwnAddress1; /*!< Specifies the device own address 1. |
94 | uint32_t OwnAddress1; /*!< Specifies the device own address 1. |
| 91 | This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF |
95 | This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF. |
| 92 | 96 | ||
| 93 | This feature can be modified afterwards using unitary function @ref LL_I2C_SetOwnAddress1(). */ |
97 | This feature can be modified afterwards using unitary function |
| - | 98 | @ref LL_I2C_SetOwnAddress1(). */ |
|
| 94 | 99 | ||
| 95 | uint32_t TypeAcknowledge; /*!< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte. |
100 | uint32_t TypeAcknowledge; /*!< Specifies the ACKnowledge or Non ACKnowledge condition after the address receive |
| - | 101 | match code or next received byte. |
|
| 96 | This parameter can be a value of @ref I2C_LL_EC_I2C_ACKNOWLEDGE |
102 | This parameter can be a value of @ref I2C_LL_EC_I2C_ACKNOWLEDGE. |
| 97 | 103 | ||
| 98 | This feature can be modified afterwards using unitary function @ref LL_I2C_AcknowledgeNextData(). */ |
104 | This feature can be modified afterwards using unitary function |
| - | 105 | @ref LL_I2C_AcknowledgeNextData(). */ |
|
| 99 | 106 | ||
| 100 | uint32_t OwnAddrSize; /*!< Specifies the device own address 1 size (7-bit or 10-bit). |
107 | uint32_t OwnAddrSize; /*!< Specifies the device own address 1 size (7-bit or 10-bit). |
| 101 | This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1 |
108 | This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS1. |
| 102 | 109 | ||
| 103 | This feature can be modified afterwards using unitary function @ref LL_I2C_SetOwnAddress1(). */ |
110 | This feature can be modified afterwards using unitary function |
| - | 111 | @ref LL_I2C_SetOwnAddress1(). */ |
|
| 104 | } LL_I2C_InitTypeDef; |
112 | } LL_I2C_InitTypeDef; |
| 105 | /** |
113 | /** |
| 106 | * @} |
114 | * @} |
| 107 | */ |
115 | */ |
| 108 | #endif /*USE_FULL_LL_DRIVER*/ |
116 | #endif /*USE_FULL_LL_DRIVER*/ |
| Line 168... | Line 176... | ||
| 168 | */ |
176 | */ |
| 169 | 177 | ||
| 170 | /** @defgroup I2C_LL_EC_PERIPHERAL_MODE Peripheral Mode |
178 | /** @defgroup I2C_LL_EC_PERIPHERAL_MODE Peripheral Mode |
| 171 | * @{ |
179 | * @{ |
| 172 | */ |
180 | */ |
| 173 | #define LL_I2C_MODE_I2C 0x00000000U /*!< I2C Master or Slave mode */ |
181 | #define LL_I2C_MODE_I2C 0x00000000U /*!< I2C Master or Slave mode */ |
| 174 | #define LL_I2C_MODE_SMBUS_HOST I2C_CR1_SMBHEN /*!< SMBus Host address acknowledge */ |
182 | #define LL_I2C_MODE_SMBUS_HOST I2C_CR1_SMBHEN /*!< SMBus Host address acknowledge */ |
| 175 | #define LL_I2C_MODE_SMBUS_DEVICE 0x00000000U /*!< SMBus Device default mode (Default address not acknowledge) */ |
183 | #define LL_I2C_MODE_SMBUS_DEVICE 0x00000000U /*!< SMBus Device default mode |
| - | 184 | (Default address not acknowledge) */ |
|
| 176 | #define LL_I2C_MODE_SMBUS_DEVICE_ARP I2C_CR1_SMBDEN /*!< SMBus Device Default address acknowledge */ |
185 | #define LL_I2C_MODE_SMBUS_DEVICE_ARP I2C_CR1_SMBDEN /*!< SMBus Device Default address acknowledge */ |
| 177 | /** |
186 | /** |
| 178 | * @} |
187 | * @} |
| 179 | */ |
188 | */ |
| 180 | 189 | ||
| 181 | /** @defgroup I2C_LL_EC_ANALOGFILTER_SELECTION Analog Filter Selection |
190 | /** @defgroup I2C_LL_EC_ANALOGFILTER_SELECTION Analog Filter Selection |
| Line 206... | Line 215... | ||
| 206 | */ |
215 | */ |
| 207 | 216 | ||
| 208 | /** @defgroup I2C_LL_EC_OWNADDRESS2 Own Address 2 Masks |
217 | /** @defgroup I2C_LL_EC_OWNADDRESS2 Own Address 2 Masks |
| 209 | * @{ |
218 | * @{ |
| 210 | */ |
219 | */ |
| 211 | #define LL_I2C_OWNADDRESS2_NOMASK I2C_OAR2_OA2NOMASK /*!< Own Address2 No mask. */ |
220 | #define LL_I2C_OWNADDRESS2_NOMASK I2C_OAR2_OA2NOMASK /*!< Own Address2 No mask. */ |
| 212 | #define LL_I2C_OWNADDRESS2_MASK01 I2C_OAR2_OA2MASK01 /*!< Only Address2 bits[7:2] are compared. */ |
221 | #define LL_I2C_OWNADDRESS2_MASK01 I2C_OAR2_OA2MASK01 /*!< Only Address2 bits[7:2] are compared. */ |
| 213 | #define LL_I2C_OWNADDRESS2_MASK02 I2C_OAR2_OA2MASK02 /*!< Only Address2 bits[7:3] are compared. */ |
222 | #define LL_I2C_OWNADDRESS2_MASK02 I2C_OAR2_OA2MASK02 /*!< Only Address2 bits[7:3] are compared. */ |
| 214 | #define LL_I2C_OWNADDRESS2_MASK03 I2C_OAR2_OA2MASK03 /*!< Only Address2 bits[7:4] are compared. */ |
223 | #define LL_I2C_OWNADDRESS2_MASK03 I2C_OAR2_OA2MASK03 /*!< Only Address2 bits[7:4] are compared. */ |
| 215 | #define LL_I2C_OWNADDRESS2_MASK04 I2C_OAR2_OA2MASK04 /*!< Only Address2 bits[7:5] are compared. */ |
224 | #define LL_I2C_OWNADDRESS2_MASK04 I2C_OAR2_OA2MASK04 /*!< Only Address2 bits[7:5] are compared. */ |
| 216 | #define LL_I2C_OWNADDRESS2_MASK05 I2C_OAR2_OA2MASK05 /*!< Only Address2 bits[7:6] are compared. */ |
225 | #define LL_I2C_OWNADDRESS2_MASK05 I2C_OAR2_OA2MASK05 /*!< Only Address2 bits[7:6] are compared. */ |
| 217 | #define LL_I2C_OWNADDRESS2_MASK06 I2C_OAR2_OA2MASK06 /*!< Only Address2 bits[7] are compared. */ |
226 | #define LL_I2C_OWNADDRESS2_MASK06 I2C_OAR2_OA2MASK06 /*!< Only Address2 bits[7] are compared. */ |
| 218 | #define LL_I2C_OWNADDRESS2_MASK07 I2C_OAR2_OA2MASK07 /*!< No comparison is done. All Address2 are acknowledged.*/ |
227 | #define LL_I2C_OWNADDRESS2_MASK07 I2C_OAR2_OA2MASK07 /*!< No comparison is done. |
| - | 228 | All Address2 are acknowledged. */ |
|
| 219 | /** |
229 | /** |
| 220 | * @} |
230 | * @} |
| 221 | */ |
231 | */ |
| 222 | 232 | ||
| 223 | /** @defgroup I2C_LL_EC_I2C_ACKNOWLEDGE Acknowledge Generation |
233 | /** @defgroup I2C_LL_EC_I2C_ACKNOWLEDGE Acknowledge Generation |
| Line 248... | Line 258... | ||
| 248 | */ |
258 | */ |
| 249 | 259 | ||
| 250 | /** @defgroup I2C_LL_EC_MODE Transfer End Mode |
260 | /** @defgroup I2C_LL_EC_MODE Transfer End Mode |
| 251 | * @{ |
261 | * @{ |
| 252 | */ |
262 | */ |
| 253 | #define LL_I2C_MODE_RELOAD I2C_CR2_RELOAD /*!< Enable I2C Reload mode. */ |
263 | #define LL_I2C_MODE_RELOAD I2C_CR2_RELOAD /*!< Enable I2C Reload mode. */ |
| 254 | #define LL_I2C_MODE_AUTOEND I2C_CR2_AUTOEND /*!< Enable I2C Automatic end mode with no HW PEC comparison. */ |
264 | #define LL_I2C_MODE_AUTOEND I2C_CR2_AUTOEND /*!< Enable I2C Automatic end mode |
| - | 265 | with no HW PEC comparison. */ |
|
| 255 | #define LL_I2C_MODE_SOFTEND 0x00000000U /*!< Enable I2C Software end mode with no HW PEC comparison. */ |
266 | #define LL_I2C_MODE_SOFTEND 0x00000000U /*!< Enable I2C Software end mode |
| - | 267 | with no HW PEC comparison. */ |
|
| 256 | #define LL_I2C_MODE_SMBUS_RELOAD LL_I2C_MODE_RELOAD /*!< Enable SMBUS Automatic end mode with HW PEC comparison. */ |
268 | #define LL_I2C_MODE_SMBUS_RELOAD LL_I2C_MODE_RELOAD /*!< Enable SMBUS Automatic end mode |
| - | 269 | with HW PEC comparison. */ |
|
| 257 | #define LL_I2C_MODE_SMBUS_AUTOEND_NO_PEC LL_I2C_MODE_AUTOEND /*!< Enable SMBUS Automatic end mode with HW PEC comparison. */ |
270 | #define LL_I2C_MODE_SMBUS_AUTOEND_NO_PEC LL_I2C_MODE_AUTOEND /*!< Enable SMBUS Automatic end mode |
| - | 271 | with HW PEC comparison. */ |
|
| 258 | #define LL_I2C_MODE_SMBUS_SOFTEND_NO_PEC LL_I2C_MODE_SOFTEND /*!< Enable SMBUS Software end mode with HW PEC comparison. */ |
272 | #define LL_I2C_MODE_SMBUS_SOFTEND_NO_PEC LL_I2C_MODE_SOFTEND /*!< Enable SMBUS Software end mode |
| - | 273 | with HW PEC comparison. */ |
|
| 259 | #define LL_I2C_MODE_SMBUS_AUTOEND_WITH_PEC (uint32_t)(LL_I2C_MODE_AUTOEND | I2C_CR2_PECBYTE) /*!< Enable SMBUS Automatic end mode with HW PEC comparison. */ |
274 | #define LL_I2C_MODE_SMBUS_AUTOEND_WITH_PEC (uint32_t)(LL_I2C_MODE_AUTOEND | I2C_CR2_PECBYTE) |
| - | 275 | /*!< Enable SMBUS Automatic end mode with HW PEC comparison. */ |
|
| 260 | #define LL_I2C_MODE_SMBUS_SOFTEND_WITH_PEC (uint32_t)(LL_I2C_MODE_SOFTEND | I2C_CR2_PECBYTE) /*!< Enable SMBUS Software end mode with HW PEC comparison. */ |
276 | #define LL_I2C_MODE_SMBUS_SOFTEND_WITH_PEC (uint32_t)(LL_I2C_MODE_SOFTEND | I2C_CR2_PECBYTE) |
| - | 277 | /*!< Enable SMBUS Software end mode with HW PEC comparison. */ |
|
| 261 | /** |
278 | /** |
| 262 | * @} |
279 | * @} |
| 263 | */ |
280 | */ |
| 264 | 281 | ||
| 265 | /** @defgroup I2C_LL_EC_GENERATE Start And Stop Generation |
282 | /** @defgroup I2C_LL_EC_GENERATE Start And Stop Generation |
| 266 | * @{ |
283 | * @{ |
| 267 | */ |
284 | */ |
| 268 | #define LL_I2C_GENERATE_NOSTARTSTOP 0x00000000U /*!< Don't Generate Stop and Start condition. */ |
285 | #define LL_I2C_GENERATE_NOSTARTSTOP 0x00000000U |
| - | 286 | /*!< Don't Generate Stop and Start condition. */ |
|
| 269 | #define LL_I2C_GENERATE_STOP (uint32_t)(0x80000000U | I2C_CR2_STOP) /*!< Generate Stop condition (Size should be set to 0). */ |
287 | #define LL_I2C_GENERATE_STOP (uint32_t)(0x80000000U | I2C_CR2_STOP) |
| - | 288 | /*!< Generate Stop condition (Size should be set to 0). */ |
|
| 270 | #define LL_I2C_GENERATE_START_READ (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN) /*!< Generate Start for read request. */ |
289 | #define LL_I2C_GENERATE_START_READ (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN) |
| - | 290 | /*!< Generate Start for read request. */ |
|
| 271 | #define LL_I2C_GENERATE_START_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) /*!< Generate Start for write request. */ |
291 | #define LL_I2C_GENERATE_START_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) |
| - | 292 | /*!< Generate Start for write request. */ |
|
| 272 | #define LL_I2C_GENERATE_RESTART_7BIT_READ (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN) /*!< Generate Restart for read request, slave 7Bit address. */ |
293 | #define LL_I2C_GENERATE_RESTART_7BIT_READ (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN) |
| - | 294 | /*!< Generate Restart for read request, slave 7Bit address. */ |
|
| 273 | #define LL_I2C_GENERATE_RESTART_7BIT_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) /*!< Generate Restart for write request, slave 7Bit address. */ |
295 | #define LL_I2C_GENERATE_RESTART_7BIT_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) |
| - | 296 | /*!< Generate Restart for write request, slave 7Bit address. */ |
|
| 274 | #define LL_I2C_GENERATE_RESTART_10BIT_READ (uint32_t)(0x80000000U | I2C_CR2_START | I2C_CR2_RD_WRN | I2C_CR2_HEAD10R) /*!< Generate Restart for read request, slave 10Bit address. */ |
297 | #define LL_I2C_GENERATE_RESTART_10BIT_READ (uint32_t)(0x80000000U | I2C_CR2_START | \ |
| - | 298 | I2C_CR2_RD_WRN | I2C_CR2_HEAD10R) |
|
| - | 299 | /*!< Generate Restart for read request, slave 10Bit address. */ |
|
| 275 | #define LL_I2C_GENERATE_RESTART_10BIT_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) /*!< Generate Restart for write request, slave 10Bit address.*/ |
300 | #define LL_I2C_GENERATE_RESTART_10BIT_WRITE (uint32_t)(0x80000000U | I2C_CR2_START) |
| - | 301 | /*!< Generate Restart for write request, slave 10Bit address.*/ |
|
| 276 | /** |
302 | /** |
| 277 | * @} |
303 | * @} |
| 278 | */ |
304 | */ |
| 279 | 305 | ||
| 280 | /** @defgroup I2C_LL_EC_DIRECTION Read Write Direction |
306 | /** @defgroup I2C_LL_EC_DIRECTION Read Write Direction |
| 281 | * @{ |
307 | * @{ |
| 282 | */ |
308 | */ |
| 283 | #define LL_I2C_DIRECTION_WRITE 0x00000000U /*!< Write transfer request by master, slave enters receiver mode. */ |
309 | #define LL_I2C_DIRECTION_WRITE 0x00000000U /*!< Write transfer request by master, |
| - | 310 | slave enters receiver mode. */ |
|
| 284 | #define LL_I2C_DIRECTION_READ I2C_ISR_DIR /*!< Read transfer request by master, slave enters transmitter mode.*/ |
311 | #define LL_I2C_DIRECTION_READ I2C_ISR_DIR /*!< Read transfer request by master, |
| - | 312 | slave enters transmitter mode.*/ |
|
| 285 | /** |
313 | /** |
| 286 | * @} |
314 | * @} |
| 287 | */ |
315 | */ |
| 288 | 316 | ||
| 289 | /** @defgroup I2C_LL_EC_DMA_REG_DATA DMA Register Data |
317 | /** @defgroup I2C_LL_EC_DMA_REG_DATA DMA Register Data |
| 290 | * @{ |
318 | * @{ |
| 291 | */ |
319 | */ |
| 292 | #define LL_I2C_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for transmission */ |
320 | #define LL_I2C_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for |
| - | 321 | transmission */ |
|
| 293 | #define LL_I2C_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for reception */ |
322 | #define LL_I2C_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for |
| - | 323 | reception */ |
|
| 294 | /** |
324 | /** |
| 295 | * @} |
325 | * @} |
| 296 | */ |
326 | */ |
| 297 | 327 | ||
| 298 | /** @defgroup I2C_LL_EC_SMBUS_TIMEOUTA_MODE SMBus TimeoutA Mode SCL SDA Timeout |
328 | /** @defgroup I2C_LL_EC_SMBUS_TIMEOUTA_MODE SMBus TimeoutA Mode SCL SDA Timeout |
| 299 | * @{ |
329 | * @{ |
| 300 | */ |
330 | */ |
| 301 | #define LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW 0x00000000U /*!< TimeoutA is used to detect SCL low level timeout. */ |
331 | #define LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW 0x00000000U /*!< TimeoutA is used to detect |
| - | 332 | SCL low level timeout. */ |
|
| 302 | #define LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH I2C_TIMEOUTR_TIDLE /*!< TimeoutA is used to detect both SCL and SDA high level timeout.*/ |
333 | #define LL_I2C_SMBUS_TIMEOUTA_MODE_SDA_SCL_HIGH I2C_TIMEOUTR_TIDLE /*!< TimeoutA is used to detect |
| - | 334 | both SCL and SDA high level timeout.*/ |
|
| 303 | /** |
335 | /** |
| 304 | * @} |
336 | * @} |
| 305 | */ |
337 | */ |
| 306 | 338 | ||
| 307 | /** @defgroup I2C_LL_EC_SMBUS_TIMEOUT_SELECTION SMBus Timeout Selection |
339 | /** @defgroup I2C_LL_EC_SMBUS_TIMEOUT_SELECTION SMBus Timeout Selection |
| 308 | * @{ |
340 | * @{ |
| 309 | */ |
341 | */ |
| 310 | #define LL_I2C_SMBUS_TIMEOUTA I2C_TIMEOUTR_TIMOUTEN /*!< TimeoutA enable bit */ |
342 | #define LL_I2C_SMBUS_TIMEOUTA I2C_TIMEOUTR_TIMOUTEN /*!< TimeoutA enable bit */ |
| 311 | #define LL_I2C_SMBUS_TIMEOUTB I2C_TIMEOUTR_TEXTEN /*!< TimeoutB (extended clock) enable bit */ |
343 | #define LL_I2C_SMBUS_TIMEOUTB I2C_TIMEOUTR_TEXTEN /*!< TimeoutB (extended clock) |
| - | 344 | enable bit */ |
|
| 312 | #define LL_I2C_SMBUS_ALL_TIMEOUT (uint32_t)(I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN) /*!< TimeoutA and TimeoutB (extended clock) enable bits */ |
345 | #define LL_I2C_SMBUS_ALL_TIMEOUT (uint32_t)(I2C_TIMEOUTR_TIMOUTEN | \ |
| - | 346 | I2C_TIMEOUTR_TEXTEN) /*!< TimeoutA and TimeoutB |
|
| - | 347 | (extended clock) enable bits */ |
|
| 313 | /** |
348 | /** |
| 314 | * @} |
349 | * @} |
| 315 | */ |
350 | */ |
| 316 | 351 | ||
| 317 | /** |
352 | /** |
| Line 351... | Line 386... | ||
| 351 | * @{ |
386 | * @{ |
| 352 | */ |
387 | */ |
| 353 | /** |
388 | /** |
| 354 | * @brief Configure the SDA setup, hold time and the SCL high, low period. |
389 | * @brief Configure the SDA setup, hold time and the SCL high, low period. |
| 355 | * @param __PRESCALER__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. |
390 | * @param __PRESCALER__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. |
| 356 | * @param __DATA_SETUP_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. (tscldel = (SCLDEL+1)xtpresc) |
391 | * @param __SETUP_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. |
| - | 392 | (tscldel = (SCLDEL+1)xtpresc) |
|
| 357 | * @param __DATA_HOLD_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. (tsdadel = SDADELxtpresc) |
393 | * @param __HOLD_TIME__ This parameter must be a value between Min_Data=0 and Max_Data=0xF. |
| - | 394 | (tsdadel = SDADELxtpresc) |
|
| 358 | * @param __CLOCK_HIGH_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. (tsclh = (SCLH+1)xtpresc) |
395 | * @param __SCLH_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. |
| - | 396 | (tsclh = (SCLH+1)xtpresc) |
|
| 359 | * @param __CLOCK_LOW_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. (tscll = (SCLL+1)xtpresc) |
397 | * @param __SCLL_PERIOD__ This parameter must be a value between Min_Data=0 and Max_Data=0xFF. |
| - | 398 | (tscll = (SCLL+1)xtpresc) |
|
| 360 | * @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF |
399 | * @retval Value between Min_Data=0 and Max_Data=0xFFFFFFFF |
| 361 | */ |
400 | */ |
| 362 | #define __LL_I2C_CONVERT_TIMINGS(__PRESCALER__, __DATA_SETUP_TIME__, __DATA_HOLD_TIME__, __CLOCK_HIGH_PERIOD__, __CLOCK_LOW_PERIOD__) \ |
401 | #define __LL_I2C_CONVERT_TIMINGS(__PRESCALER__, __SETUP_TIME__, __HOLD_TIME__, __SCLH_PERIOD__, __SCLL_PERIOD__) \ |
| 363 | ((((uint32_t)(__PRESCALER__) << I2C_TIMINGR_PRESC_Pos) & I2C_TIMINGR_PRESC) | \ |
402 | ((((uint32_t)(__PRESCALER__) << I2C_TIMINGR_PRESC_Pos) & I2C_TIMINGR_PRESC) | \ |
| 364 | (((uint32_t)(__DATA_SETUP_TIME__) << I2C_TIMINGR_SCLDEL_Pos) & I2C_TIMINGR_SCLDEL) | \ |
403 | (((uint32_t)(__SETUP_TIME__) << I2C_TIMINGR_SCLDEL_Pos) & I2C_TIMINGR_SCLDEL) | \ |
| 365 | (((uint32_t)(__DATA_HOLD_TIME__) << I2C_TIMINGR_SDADEL_Pos) & I2C_TIMINGR_SDADEL) | \ |
404 | (((uint32_t)(__HOLD_TIME__) << I2C_TIMINGR_SDADEL_Pos) & I2C_TIMINGR_SDADEL) | \ |
| 366 | (((uint32_t)(__CLOCK_HIGH_PERIOD__) << I2C_TIMINGR_SCLH_Pos) & I2C_TIMINGR_SCLH) | \ |
405 | (((uint32_t)(__SCLH_PERIOD__) << I2C_TIMINGR_SCLH_Pos) & I2C_TIMINGR_SCLH) | \ |
| 367 | (((uint32_t)(__CLOCK_LOW_PERIOD__) << I2C_TIMINGR_SCLL_Pos) & I2C_TIMINGR_SCLL)) |
406 | (((uint32_t)(__SCLL_PERIOD__) << I2C_TIMINGR_SCLL_Pos) & I2C_TIMINGR_SCLL)) |
| 368 | /** |
407 | /** |
| 369 | * @} |
408 | * @} |
| 370 | */ |
409 | */ |
| 371 | 410 | ||
| 372 | /** |
411 | /** |
| Line 426... | Line 465... | ||
| 426 | * CR1 DNF LL_I2C_ConfigFilters |
465 | * CR1 DNF LL_I2C_ConfigFilters |
| 427 | * @param I2Cx I2C Instance. |
466 | * @param I2Cx I2C Instance. |
| 428 | * @param AnalogFilter This parameter can be one of the following values: |
467 | * @param AnalogFilter This parameter can be one of the following values: |
| 429 | * @arg @ref LL_I2C_ANALOGFILTER_ENABLE |
468 | * @arg @ref LL_I2C_ANALOGFILTER_ENABLE |
| 430 | * @arg @ref LL_I2C_ANALOGFILTER_DISABLE |
469 | * @arg @ref LL_I2C_ANALOGFILTER_DISABLE |
| - | 470 | * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) |
|
| 431 | * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). |
471 | and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). |
| 432 | * This parameter is used to configure the digital noise filter on SDA and SCL input. |
472 | * This parameter is used to configure the digital noise filter on SDA and SCL input. |
| 433 | * The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk. |
473 | * The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk. |
| 434 | * @retval None |
474 | * @retval None |
| 435 | */ |
475 | */ |
| 436 | __STATIC_INLINE void LL_I2C_ConfigFilters(I2C_TypeDef *I2Cx, uint32_t AnalogFilter, uint32_t DigitalFilter) |
476 | __STATIC_INLINE void LL_I2C_ConfigFilters(I2C_TypeDef *I2Cx, uint32_t AnalogFilter, uint32_t DigitalFilter) |
| Line 442... | Line 482... | ||
| 442 | * @brief Configure Digital Noise Filter. |
482 | * @brief Configure Digital Noise Filter. |
| 443 | * @note If the analog filter is also enabled, the digital filter is added to analog filter. |
483 | * @note If the analog filter is also enabled, the digital filter is added to analog filter. |
| 444 | * This filter can only be programmed when the I2C is disabled (PE = 0). |
484 | * This filter can only be programmed when the I2C is disabled (PE = 0). |
| 445 | * @rmtoll CR1 DNF LL_I2C_SetDigitalFilter |
485 | * @rmtoll CR1 DNF LL_I2C_SetDigitalFilter |
| 446 | * @param I2Cx I2C Instance. |
486 | * @param I2Cx I2C Instance. |
| - | 487 | * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) |
|
| 447 | * @param DigitalFilter This parameter must be a value between Min_Data=0x00 (Digital filter disabled) and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). |
488 | and Max_Data=0x0F (Digital filter enabled and filtering capability up to 15*ti2cclk). |
| 448 | * This parameter is used to configure the digital noise filter on SDA and SCL input. |
489 | * This parameter is used to configure the digital noise filter on SDA and SCL input. |
| 449 | * The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk. |
490 | * The digital filter will filter spikes with a length of up to DNF[3:0]*ti2cclk. |
| 450 | * @retval None |
491 | * @retval None |
| 451 | */ |
492 | */ |
| 452 | __STATIC_INLINE void LL_I2C_SetDigitalFilter(I2C_TypeDef *I2Cx, uint32_t DigitalFilter) |
493 | __STATIC_INLINE void LL_I2C_SetDigitalFilter(I2C_TypeDef *I2Cx, uint32_t DigitalFilter) |
| Line 576... | Line 617... | ||
| 576 | * @arg @ref LL_I2C_DMA_REG_DATA_RECEIVE |
617 | * @arg @ref LL_I2C_DMA_REG_DATA_RECEIVE |
| 577 | * @retval Address of data register |
618 | * @retval Address of data register |
| 578 | */ |
619 | */ |
| 579 | __STATIC_INLINE uint32_t LL_I2C_DMA_GetRegAddr(I2C_TypeDef *I2Cx, uint32_t Direction) |
620 | __STATIC_INLINE uint32_t LL_I2C_DMA_GetRegAddr(I2C_TypeDef *I2Cx, uint32_t Direction) |
| 580 | { |
621 | { |
| 581 | register uint32_t data_reg_addr; |
622 | uint32_t data_reg_addr; |
| 582 | 623 | ||
| 583 | if (Direction == LL_I2C_DMA_REG_DATA_TRANSMIT) |
624 | if (Direction == LL_I2C_DMA_REG_DATA_TRANSMIT) |
| 584 | { |
625 | { |
| 585 | /* return address of TXDR register */ |
626 | /* return address of TXDR register */ |
| 586 | data_reg_addr = (uint32_t) & (I2Cx->TXDR); |
627 | data_reg_addr = (uint32_t) &(I2Cx->TXDR); |
| 587 | } |
628 | } |
| 588 | else |
629 | else |
| 589 | { |
630 | { |
| 590 | /* return address of RXDR register */ |
631 | /* return address of RXDR register */ |
| 591 | data_reg_addr = (uint32_t) & (I2Cx->RXDR); |
632 | data_reg_addr = (uint32_t) &(I2Cx->RXDR); |
| 592 | } |
633 | } |
| 593 | 634 | ||
| 594 | return data_reg_addr; |
635 | return data_reg_addr; |
| 595 | } |
636 | } |
| 596 | 637 | ||
| Line 663... | Line 704... | ||
| 663 | } |
704 | } |
| 664 | 705 | ||
| 665 | #if defined(I2C_CR1_WUPEN) |
706 | #if defined(I2C_CR1_WUPEN) |
| 666 | /** |
707 | /** |
| 667 | * @brief Enable Wakeup from STOP. |
708 | * @brief Enable Wakeup from STOP. |
| 668 | * @note Macro @ref IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
709 | * @note The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
| 669 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
710 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
| 670 | * @note This bit can only be programmed when Digital Filter is disabled. |
711 | * @note This bit can only be programmed when Digital Filter is disabled. |
| 671 | * @rmtoll CR1 WUPEN LL_I2C_EnableWakeUpFromStop |
712 | * @rmtoll CR1 WUPEN LL_I2C_EnableWakeUpFromStop |
| 672 | * @param I2Cx I2C Instance. |
713 | * @param I2Cx I2C Instance. |
| 673 | * @retval None |
714 | * @retval None |
| Line 677... | Line 718... | ||
| 677 | SET_BIT(I2Cx->CR1, I2C_CR1_WUPEN); |
718 | SET_BIT(I2Cx->CR1, I2C_CR1_WUPEN); |
| 678 | } |
719 | } |
| 679 | 720 | ||
| 680 | /** |
721 | /** |
| 681 | * @brief Disable Wakeup from STOP. |
722 | * @brief Disable Wakeup from STOP. |
| 682 | * @note Macro @ref IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
723 | * @note The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
| 683 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
724 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
| 684 | * @rmtoll CR1 WUPEN LL_I2C_DisableWakeUpFromStop |
725 | * @rmtoll CR1 WUPEN LL_I2C_DisableWakeUpFromStop |
| 685 | * @param I2Cx I2C Instance. |
726 | * @param I2Cx I2C Instance. |
| 686 | * @retval None |
727 | * @retval None |
| 687 | */ |
728 | */ |
| Line 690... | Line 731... | ||
| 690 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_WUPEN); |
731 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_WUPEN); |
| 691 | } |
732 | } |
| 692 | 733 | ||
| 693 | /** |
734 | /** |
| 694 | * @brief Check if Wakeup from STOP is enabled or disabled. |
735 | * @brief Check if Wakeup from STOP is enabled or disabled. |
| 695 | * @note Macro @ref IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
736 | * @note The macro IS_I2C_WAKEUP_FROMSTOP_INSTANCE(I2Cx) can be used to check whether or not |
| 696 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
737 | * WakeUpFromStop feature is supported by the I2Cx Instance. |
| 697 | * @rmtoll CR1 WUPEN LL_I2C_IsEnabledWakeUpFromStop |
738 | * @rmtoll CR1 WUPEN LL_I2C_IsEnabledWakeUpFromStop |
| 698 | * @param I2Cx I2C Instance. |
739 | * @param I2Cx I2C Instance. |
| 699 | * @retval State of bit (1 or 0). |
740 | * @retval State of bit (1 or 0). |
| 700 | */ |
741 | */ |
| 701 | __STATIC_INLINE uint32_t LL_I2C_IsEnabledWakeUpFromStop(I2C_TypeDef *I2Cx) |
742 | __STATIC_INLINE uint32_t LL_I2C_IsEnabledWakeUpFromStop(I2C_TypeDef *I2Cx) |
| 702 | { |
743 | { |
| 703 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_WUPEN) == (I2C_CR1_WUPEN)) ? 1UL : 0UL); |
744 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_WUPEN) == (I2C_CR1_WUPEN)) ? 1UL : 0UL); |
| 704 | } |
745 | } |
| 705 | #endif |
- | |
| 706 | 746 | ||
| - | 747 | #endif /* I2C_CR1_WUPEN */ |
|
| 707 | /** |
748 | /** |
| 708 | * @brief Enable General Call. |
749 | * @brief Enable General Call. |
| 709 | * @note When enabled the Address 0x00 is ACKed. |
750 | * @note When enabled the Address 0x00 is ACKed. |
| 710 | * @rmtoll CR1 GCEN LL_I2C_EnableGeneralCall |
751 | * @rmtoll CR1 GCEN LL_I2C_EnableGeneralCall |
| 711 | * @param I2Cx I2C Instance. |
752 | * @param I2Cx I2C Instance. |
| Line 941... | Line 982... | ||
| 941 | return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLDEL) >> I2C_TIMINGR_SCLDEL_Pos); |
982 | return (uint32_t)(READ_BIT(I2Cx->TIMINGR, I2C_TIMINGR_SCLDEL) >> I2C_TIMINGR_SCLDEL_Pos); |
| 942 | } |
983 | } |
| 943 | 984 | ||
| 944 | /** |
985 | /** |
| 945 | * @brief Configure peripheral mode. |
986 | * @brief Configure peripheral mode. |
| 946 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
987 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 947 | * SMBus feature is supported by the I2Cx Instance. |
988 | * SMBus feature is supported by the I2Cx Instance. |
| 948 | * @rmtoll CR1 SMBHEN LL_I2C_SetMode\n |
989 | * @rmtoll CR1 SMBHEN LL_I2C_SetMode\n |
| 949 | * CR1 SMBDEN LL_I2C_SetMode |
990 | * CR1 SMBDEN LL_I2C_SetMode |
| 950 | * @param I2Cx I2C Instance. |
991 | * @param I2Cx I2C Instance. |
| 951 | * @param PeripheralMode This parameter can be one of the following values: |
992 | * @param PeripheralMode This parameter can be one of the following values: |
| Line 960... | Line 1001... | ||
| 960 | MODIFY_REG(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN, PeripheralMode); |
1001 | MODIFY_REG(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN, PeripheralMode); |
| 961 | } |
1002 | } |
| 962 | 1003 | ||
| 963 | /** |
1004 | /** |
| 964 | * @brief Get peripheral mode. |
1005 | * @brief Get peripheral mode. |
| 965 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1006 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 966 | * SMBus feature is supported by the I2Cx Instance. |
1007 | * SMBus feature is supported by the I2Cx Instance. |
| 967 | * @rmtoll CR1 SMBHEN LL_I2C_GetMode\n |
1008 | * @rmtoll CR1 SMBHEN LL_I2C_GetMode\n |
| 968 | * CR1 SMBDEN LL_I2C_GetMode |
1009 | * CR1 SMBDEN LL_I2C_GetMode |
| 969 | * @param I2Cx I2C Instance. |
1010 | * @param I2Cx I2C Instance. |
| 970 | * @retval Returned value can be one of the following values: |
1011 | * @retval Returned value can be one of the following values: |
| Line 978... | Line 1019... | ||
| 978 | return (uint32_t)(READ_BIT(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN)); |
1019 | return (uint32_t)(READ_BIT(I2Cx->CR1, I2C_CR1_SMBHEN | I2C_CR1_SMBDEN)); |
| 979 | } |
1020 | } |
| 980 | 1021 | ||
| 981 | /** |
1022 | /** |
| 982 | * @brief Enable SMBus alert (Host or Device mode) |
1023 | * @brief Enable SMBus alert (Host or Device mode) |
| 983 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1024 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 984 | * SMBus feature is supported by the I2Cx Instance. |
1025 | * SMBus feature is supported by the I2Cx Instance. |
| 985 | * @note SMBus Device mode: |
1026 | * @note SMBus Device mode: |
| 986 | * - SMBus Alert pin is drived low and |
1027 | * - SMBus Alert pin is drived low and |
| 987 | * Alert Response Address Header acknowledge is enabled. |
1028 | * Alert Response Address Header acknowledge is enabled. |
| 988 | * SMBus Host mode: |
1029 | * SMBus Host mode: |
| Line 996... | Line 1037... | ||
| 996 | SET_BIT(I2Cx->CR1, I2C_CR1_ALERTEN); |
1037 | SET_BIT(I2Cx->CR1, I2C_CR1_ALERTEN); |
| 997 | } |
1038 | } |
| 998 | 1039 | ||
| 999 | /** |
1040 | /** |
| 1000 | * @brief Disable SMBus alert (Host or Device mode) |
1041 | * @brief Disable SMBus alert (Host or Device mode) |
| 1001 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1042 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1002 | * SMBus feature is supported by the I2Cx Instance. |
1043 | * SMBus feature is supported by the I2Cx Instance. |
| 1003 | * @note SMBus Device mode: |
1044 | * @note SMBus Device mode: |
| 1004 | * - SMBus Alert pin is not drived (can be used as a standard GPIO) and |
1045 | * - SMBus Alert pin is not drived (can be used as a standard GPIO) and |
| 1005 | * Alert Response Address Header acknowledge is disabled. |
1046 | * Alert Response Address Header acknowledge is disabled. |
| 1006 | * SMBus Host mode: |
1047 | * SMBus Host mode: |
| Line 1014... | Line 1055... | ||
| 1014 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_ALERTEN); |
1055 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_ALERTEN); |
| 1015 | } |
1056 | } |
| 1016 | 1057 | ||
| 1017 | /** |
1058 | /** |
| 1018 | * @brief Check if SMBus alert (Host or Device mode) is enabled or disabled. |
1059 | * @brief Check if SMBus alert (Host or Device mode) is enabled or disabled. |
| 1019 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1060 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1020 | * SMBus feature is supported by the I2Cx Instance. |
1061 | * SMBus feature is supported by the I2Cx Instance. |
| 1021 | * @rmtoll CR1 ALERTEN LL_I2C_IsEnabledSMBusAlert |
1062 | * @rmtoll CR1 ALERTEN LL_I2C_IsEnabledSMBusAlert |
| 1022 | * @param I2Cx I2C Instance. |
1063 | * @param I2Cx I2C Instance. |
| 1023 | * @retval State of bit (1 or 0). |
1064 | * @retval State of bit (1 or 0). |
| 1024 | */ |
1065 | */ |
| Line 1027... | Line 1068... | ||
| 1027 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_ALERTEN) == (I2C_CR1_ALERTEN)) ? 1UL : 0UL); |
1068 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_ALERTEN) == (I2C_CR1_ALERTEN)) ? 1UL : 0UL); |
| 1028 | } |
1069 | } |
| 1029 | 1070 | ||
| 1030 | /** |
1071 | /** |
| 1031 | * @brief Enable SMBus Packet Error Calculation (PEC). |
1072 | * @brief Enable SMBus Packet Error Calculation (PEC). |
| 1032 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1073 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1033 | * SMBus feature is supported by the I2Cx Instance. |
1074 | * SMBus feature is supported by the I2Cx Instance. |
| 1034 | * @rmtoll CR1 PECEN LL_I2C_EnableSMBusPEC |
1075 | * @rmtoll CR1 PECEN LL_I2C_EnableSMBusPEC |
| 1035 | * @param I2Cx I2C Instance. |
1076 | * @param I2Cx I2C Instance. |
| 1036 | * @retval None |
1077 | * @retval None |
| 1037 | */ |
1078 | */ |
| Line 1040... | Line 1081... | ||
| 1040 | SET_BIT(I2Cx->CR1, I2C_CR1_PECEN); |
1081 | SET_BIT(I2Cx->CR1, I2C_CR1_PECEN); |
| 1041 | } |
1082 | } |
| 1042 | 1083 | ||
| 1043 | /** |
1084 | /** |
| 1044 | * @brief Disable SMBus Packet Error Calculation (PEC). |
1085 | * @brief Disable SMBus Packet Error Calculation (PEC). |
| 1045 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1086 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1046 | * SMBus feature is supported by the I2Cx Instance. |
1087 | * SMBus feature is supported by the I2Cx Instance. |
| 1047 | * @rmtoll CR1 PECEN LL_I2C_DisableSMBusPEC |
1088 | * @rmtoll CR1 PECEN LL_I2C_DisableSMBusPEC |
| 1048 | * @param I2Cx I2C Instance. |
1089 | * @param I2Cx I2C Instance. |
| 1049 | * @retval None |
1090 | * @retval None |
| 1050 | */ |
1091 | */ |
| Line 1053... | Line 1094... | ||
| 1053 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_PECEN); |
1094 | CLEAR_BIT(I2Cx->CR1, I2C_CR1_PECEN); |
| 1054 | } |
1095 | } |
| 1055 | 1096 | ||
| 1056 | /** |
1097 | /** |
| 1057 | * @brief Check if SMBus Packet Error Calculation (PEC) is enabled or disabled. |
1098 | * @brief Check if SMBus Packet Error Calculation (PEC) is enabled or disabled. |
| 1058 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1099 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1059 | * SMBus feature is supported by the I2Cx Instance. |
1100 | * SMBus feature is supported by the I2Cx Instance. |
| 1060 | * @rmtoll CR1 PECEN LL_I2C_IsEnabledSMBusPEC |
1101 | * @rmtoll CR1 PECEN LL_I2C_IsEnabledSMBusPEC |
| 1061 | * @param I2Cx I2C Instance. |
1102 | * @param I2Cx I2C Instance. |
| 1062 | * @retval State of bit (1 or 0). |
1103 | * @retval State of bit (1 or 0). |
| 1063 | */ |
1104 | */ |
| Line 1066... | Line 1107... | ||
| 1066 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_PECEN) == (I2C_CR1_PECEN)) ? 1UL : 0UL); |
1107 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_PECEN) == (I2C_CR1_PECEN)) ? 1UL : 0UL); |
| 1067 | } |
1108 | } |
| 1068 | 1109 | ||
| 1069 | /** |
1110 | /** |
| 1070 | * @brief Configure the SMBus Clock Timeout. |
1111 | * @brief Configure the SMBus Clock Timeout. |
| 1071 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1112 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1072 | * SMBus feature is supported by the I2Cx Instance. |
1113 | * SMBus feature is supported by the I2Cx Instance. |
| 1073 | * @note This configuration can only be programmed when associated Timeout is disabled (TimeoutA and/orTimeoutB). |
1114 | * @note This configuration can only be programmed when associated Timeout is disabled (TimeoutA and/orTimeoutB). |
| 1074 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_ConfigSMBusTimeout\n |
1115 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_ConfigSMBusTimeout\n |
| 1075 | * TIMEOUTR TIDLE LL_I2C_ConfigSMBusTimeout\n |
1116 | * TIMEOUTR TIDLE LL_I2C_ConfigSMBusTimeout\n |
| 1076 | * TIMEOUTR TIMEOUTB LL_I2C_ConfigSMBusTimeout |
1117 | * TIMEOUTR TIMEOUTB LL_I2C_ConfigSMBusTimeout |
| Line 1089... | Line 1130... | ||
| 1089 | TimeoutA | TimeoutAMode | (TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos)); |
1130 | TimeoutA | TimeoutAMode | (TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos)); |
| 1090 | } |
1131 | } |
| 1091 | 1132 | ||
| 1092 | /** |
1133 | /** |
| 1093 | * @brief Configure the SMBus Clock TimeoutA (SCL low timeout or SCL and SDA high timeout depends on TimeoutA mode). |
1134 | * @brief Configure the SMBus Clock TimeoutA (SCL low timeout or SCL and SDA high timeout depends on TimeoutA mode). |
| 1094 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1135 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1095 | * SMBus feature is supported by the I2Cx Instance. |
1136 | * SMBus feature is supported by the I2Cx Instance. |
| 1096 | * @note These bits can only be programmed when TimeoutA is disabled. |
1137 | * @note These bits can only be programmed when TimeoutA is disabled. |
| 1097 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_SetSMBusTimeoutA |
1138 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_SetSMBusTimeoutA |
| 1098 | * @param I2Cx I2C Instance. |
1139 | * @param I2Cx I2C Instance. |
| 1099 | * @param TimeoutA This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. |
1140 | * @param TimeoutA This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. |
| Line 1104... | Line 1145... | ||
| 1104 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutA); |
1145 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutA); |
| 1105 | } |
1146 | } |
| 1106 | 1147 | ||
| 1107 | /** |
1148 | /** |
| 1108 | * @brief Get the SMBus Clock TimeoutA setting. |
1149 | * @brief Get the SMBus Clock TimeoutA setting. |
| 1109 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1150 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1110 | * SMBus feature is supported by the I2Cx Instance. |
1151 | * SMBus feature is supported by the I2Cx Instance. |
| 1111 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_GetSMBusTimeoutA |
1152 | * @rmtoll TIMEOUTR TIMEOUTA LL_I2C_GetSMBusTimeoutA |
| 1112 | * @param I2Cx I2C Instance. |
1153 | * @param I2Cx I2C Instance. |
| 1113 | * @retval Value between Min_Data=0 and Max_Data=0xFFF |
1154 | * @retval Value between Min_Data=0 and Max_Data=0xFFF |
| 1114 | */ |
1155 | */ |
| Line 1117... | Line 1158... | ||
| 1117 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA)); |
1158 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTA)); |
| 1118 | } |
1159 | } |
| 1119 | 1160 | ||
| 1120 | /** |
1161 | /** |
| 1121 | * @brief Set the SMBus Clock TimeoutA mode. |
1162 | * @brief Set the SMBus Clock TimeoutA mode. |
| 1122 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1163 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1123 | * SMBus feature is supported by the I2Cx Instance. |
1164 | * SMBus feature is supported by the I2Cx Instance. |
| 1124 | * @note This bit can only be programmed when TimeoutA is disabled. |
1165 | * @note This bit can only be programmed when TimeoutA is disabled. |
| 1125 | * @rmtoll TIMEOUTR TIDLE LL_I2C_SetSMBusTimeoutAMode |
1166 | * @rmtoll TIMEOUTR TIDLE LL_I2C_SetSMBusTimeoutAMode |
| 1126 | * @param I2Cx I2C Instance. |
1167 | * @param I2Cx I2C Instance. |
| 1127 | * @param TimeoutAMode This parameter can be one of the following values: |
1168 | * @param TimeoutAMode This parameter can be one of the following values: |
| Line 1134... | Line 1175... | ||
| 1134 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutAMode); |
1175 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutAMode); |
| 1135 | } |
1176 | } |
| 1136 | 1177 | ||
| 1137 | /** |
1178 | /** |
| 1138 | * @brief Get the SMBus Clock TimeoutA mode. |
1179 | * @brief Get the SMBus Clock TimeoutA mode. |
| 1139 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1180 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1140 | * SMBus feature is supported by the I2Cx Instance. |
1181 | * SMBus feature is supported by the I2Cx Instance. |
| 1141 | * @rmtoll TIMEOUTR TIDLE LL_I2C_GetSMBusTimeoutAMode |
1182 | * @rmtoll TIMEOUTR TIDLE LL_I2C_GetSMBusTimeoutAMode |
| 1142 | * @param I2Cx I2C Instance. |
1183 | * @param I2Cx I2C Instance. |
| 1143 | * @retval Returned value can be one of the following values: |
1184 | * @retval Returned value can be one of the following values: |
| 1144 | * @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW |
1185 | * @arg @ref LL_I2C_SMBUS_TIMEOUTA_MODE_SCL_LOW |
| Line 1149... | Line 1190... | ||
| 1149 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIDLE)); |
1190 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIDLE)); |
| 1150 | } |
1191 | } |
| 1151 | 1192 | ||
| 1152 | /** |
1193 | /** |
| 1153 | * @brief Configure the SMBus Extended Cumulative Clock TimeoutB (Master or Slave mode). |
1194 | * @brief Configure the SMBus Extended Cumulative Clock TimeoutB (Master or Slave mode). |
| 1154 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1195 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1155 | * SMBus feature is supported by the I2Cx Instance. |
1196 | * SMBus feature is supported by the I2Cx Instance. |
| 1156 | * @note These bits can only be programmed when TimeoutB is disabled. |
1197 | * @note These bits can only be programmed when TimeoutB is disabled. |
| 1157 | * @rmtoll TIMEOUTR TIMEOUTB LL_I2C_SetSMBusTimeoutB |
1198 | * @rmtoll TIMEOUTR TIMEOUTB LL_I2C_SetSMBusTimeoutB |
| 1158 | * @param I2Cx I2C Instance. |
1199 | * @param I2Cx I2C Instance. |
| 1159 | * @param TimeoutB This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. |
1200 | * @param TimeoutB This parameter must be a value between Min_Data=0 and Max_Data=0xFFF. |
| Line 1163... | Line 1204... | ||
| 1163 | { |
1204 | { |
| 1164 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos); |
1205 | WRITE_REG(I2Cx->TIMEOUTR, TimeoutB << I2C_TIMEOUTR_TIMEOUTB_Pos); |
| 1165 | } |
1206 | } |
| 1166 | 1207 | ||
| 1167 | /** |
1208 | /** |
| 1168 | * @brief Get the SMBus Extented Cumulative Clock TimeoutB setting. |
1209 | * @brief Get the SMBus Extended Cumulative Clock TimeoutB setting. |
| 1169 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1210 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1170 | * SMBus feature is supported by the I2Cx Instance. |
1211 | * SMBus feature is supported by the I2Cx Instance. |
| 1171 | * @rmtoll TIMEOUTR TIMEOUTB LL_I2C_GetSMBusTimeoutB |
1212 | * @rmtoll TIMEOUTR TIMEOUTB LL_I2C_GetSMBusTimeoutB |
| 1172 | * @param I2Cx I2C Instance. |
1213 | * @param I2Cx I2C Instance. |
| 1173 | * @retval Value between Min_Data=0 and Max_Data=0xFFF |
1214 | * @retval Value between Min_Data=0 and Max_Data=0xFFF |
| 1174 | */ |
1215 | */ |
| Line 1177... | Line 1218... | ||
| 1177 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTB) >> I2C_TIMEOUTR_TIMEOUTB_Pos); |
1218 | return (uint32_t)(READ_BIT(I2Cx->TIMEOUTR, I2C_TIMEOUTR_TIMEOUTB) >> I2C_TIMEOUTR_TIMEOUTB_Pos); |
| 1178 | } |
1219 | } |
| 1179 | 1220 | ||
| 1180 | /** |
1221 | /** |
| 1181 | * @brief Enable the SMBus Clock Timeout. |
1222 | * @brief Enable the SMBus Clock Timeout. |
| 1182 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1223 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1183 | * SMBus feature is supported by the I2Cx Instance. |
1224 | * SMBus feature is supported by the I2Cx Instance. |
| 1184 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_EnableSMBusTimeout\n |
1225 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_EnableSMBusTimeout\n |
| 1185 | * TIMEOUTR TEXTEN LL_I2C_EnableSMBusTimeout |
1226 | * TIMEOUTR TEXTEN LL_I2C_EnableSMBusTimeout |
| 1186 | * @param I2Cx I2C Instance. |
1227 | * @param I2Cx I2C Instance. |
| 1187 | * @param ClockTimeout This parameter can be one of the following values: |
1228 | * @param ClockTimeout This parameter can be one of the following values: |
| Line 1195... | Line 1236... | ||
| 1195 | SET_BIT(I2Cx->TIMEOUTR, ClockTimeout); |
1236 | SET_BIT(I2Cx->TIMEOUTR, ClockTimeout); |
| 1196 | } |
1237 | } |
| 1197 | 1238 | ||
| 1198 | /** |
1239 | /** |
| 1199 | * @brief Disable the SMBus Clock Timeout. |
1240 | * @brief Disable the SMBus Clock Timeout. |
| 1200 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1241 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1201 | * SMBus feature is supported by the I2Cx Instance. |
1242 | * SMBus feature is supported by the I2Cx Instance. |
| 1202 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_DisableSMBusTimeout\n |
1243 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_DisableSMBusTimeout\n |
| 1203 | * TIMEOUTR TEXTEN LL_I2C_DisableSMBusTimeout |
1244 | * TIMEOUTR TEXTEN LL_I2C_DisableSMBusTimeout |
| 1204 | * @param I2Cx I2C Instance. |
1245 | * @param I2Cx I2C Instance. |
| 1205 | * @param ClockTimeout This parameter can be one of the following values: |
1246 | * @param ClockTimeout This parameter can be one of the following values: |
| Line 1213... | Line 1254... | ||
| 1213 | CLEAR_BIT(I2Cx->TIMEOUTR, ClockTimeout); |
1254 | CLEAR_BIT(I2Cx->TIMEOUTR, ClockTimeout); |
| 1214 | } |
1255 | } |
| 1215 | 1256 | ||
| 1216 | /** |
1257 | /** |
| 1217 | * @brief Check if the SMBus Clock Timeout is enabled or disabled. |
1258 | * @brief Check if the SMBus Clock Timeout is enabled or disabled. |
| 1218 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1259 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1219 | * SMBus feature is supported by the I2Cx Instance. |
1260 | * SMBus feature is supported by the I2Cx Instance. |
| 1220 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_IsEnabledSMBusTimeout\n |
1261 | * @rmtoll TIMEOUTR TIMOUTEN LL_I2C_IsEnabledSMBusTimeout\n |
| 1221 | * TIMEOUTR TEXTEN LL_I2C_IsEnabledSMBusTimeout |
1262 | * TIMEOUTR TEXTEN LL_I2C_IsEnabledSMBusTimeout |
| 1222 | * @param I2Cx I2C Instance. |
1263 | * @param I2Cx I2C Instance. |
| 1223 | * @param ClockTimeout This parameter can be one of the following values: |
1264 | * @param ClockTimeout This parameter can be one of the following values: |
| Line 1226... | Line 1267... | ||
| 1226 | * @arg @ref LL_I2C_SMBUS_ALL_TIMEOUT |
1267 | * @arg @ref LL_I2C_SMBUS_ALL_TIMEOUT |
| 1227 | * @retval State of bit (1 or 0). |
1268 | * @retval State of bit (1 or 0). |
| 1228 | */ |
1269 | */ |
| 1229 | __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t ClockTimeout) |
1270 | __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusTimeout(I2C_TypeDef *I2Cx, uint32_t ClockTimeout) |
| 1230 | { |
1271 | { |
| 1231 | return ((READ_BIT(I2Cx->TIMEOUTR, (I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN)) == (ClockTimeout)) ? 1UL : 0UL); |
1272 | return ((READ_BIT(I2Cx->TIMEOUTR, (I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN)) == \ |
| - | 1273 | (ClockTimeout)) ? 1UL : 0UL); |
|
| 1232 | } |
1274 | } |
| 1233 | 1275 | ||
| 1234 | /** |
1276 | /** |
| 1235 | * @} |
1277 | * @} |
| 1236 | */ |
1278 | */ |
| Line 1443... | Line 1485... | ||
| 1443 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_TCIE) == (I2C_CR1_TCIE)) ? 1UL : 0UL); |
1485 | return ((READ_BIT(I2Cx->CR1, I2C_CR1_TCIE) == (I2C_CR1_TCIE)) ? 1UL : 0UL); |
| 1444 | } |
1486 | } |
| 1445 | 1487 | ||
| 1446 | /** |
1488 | /** |
| 1447 | * @brief Enable Error interrupts. |
1489 | * @brief Enable Error interrupts. |
| 1448 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1490 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1449 | * SMBus feature is supported by the I2Cx Instance. |
1491 | * SMBus feature is supported by the I2Cx Instance. |
| 1450 | * @note Any of these errors will generate interrupt : |
1492 | * @note Any of these errors will generate interrupt : |
| 1451 | * Arbitration Loss (ARLO) |
1493 | * Arbitration Loss (ARLO) |
| 1452 | * Bus Error detection (BERR) |
1494 | * Bus Error detection (BERR) |
| 1453 | * Overrun/Underrun (OVR) |
1495 | * Overrun/Underrun (OVR) |
| Line 1463... | Line 1505... | ||
| 1463 | SET_BIT(I2Cx->CR1, I2C_CR1_ERRIE); |
1505 | SET_BIT(I2Cx->CR1, I2C_CR1_ERRIE); |
| 1464 | } |
1506 | } |
| 1465 | 1507 | ||
| 1466 | /** |
1508 | /** |
| 1467 | * @brief Disable Error interrupts. |
1509 | * @brief Disable Error interrupts. |
| 1468 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1510 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1469 | * SMBus feature is supported by the I2Cx Instance. |
1511 | * SMBus feature is supported by the I2Cx Instance. |
| 1470 | * @note Any of these errors will generate interrupt : |
1512 | * @note Any of these errors will generate interrupt : |
| 1471 | * Arbitration Loss (ARLO) |
1513 | * Arbitration Loss (ARLO) |
| 1472 | * Bus Error detection (BERR) |
1514 | * Bus Error detection (BERR) |
| 1473 | * Overrun/Underrun (OVR) |
1515 | * Overrun/Underrun (OVR) |
| Line 1645... | Line 1687... | ||
| 1645 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_OVR) == (I2C_ISR_OVR)) ? 1UL : 0UL); |
1687 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_OVR) == (I2C_ISR_OVR)) ? 1UL : 0UL); |
| 1646 | } |
1688 | } |
| 1647 | 1689 | ||
| 1648 | /** |
1690 | /** |
| 1649 | * @brief Indicate the status of SMBus PEC error flag in reception. |
1691 | * @brief Indicate the status of SMBus PEC error flag in reception. |
| 1650 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1692 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1651 | * SMBus feature is supported by the I2Cx Instance. |
1693 | * SMBus feature is supported by the I2Cx Instance. |
| 1652 | * @note RESET: Clear default value. |
1694 | * @note RESET: Clear default value. |
| 1653 | * SET: When the received PEC does not match with the PEC register content. |
1695 | * SET: When the received PEC does not match with the PEC register content. |
| 1654 | * @rmtoll ISR PECERR LL_I2C_IsActiveSMBusFlag_PECERR |
1696 | * @rmtoll ISR PECERR LL_I2C_IsActiveSMBusFlag_PECERR |
| 1655 | * @param I2Cx I2C Instance. |
1697 | * @param I2Cx I2C Instance. |
| Line 1660... | Line 1702... | ||
| 1660 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_PECERR) == (I2C_ISR_PECERR)) ? 1UL : 0UL); |
1702 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_PECERR) == (I2C_ISR_PECERR)) ? 1UL : 0UL); |
| 1661 | } |
1703 | } |
| 1662 | 1704 | ||
| 1663 | /** |
1705 | /** |
| 1664 | * @brief Indicate the status of SMBus Timeout detection flag. |
1706 | * @brief Indicate the status of SMBus Timeout detection flag. |
| 1665 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1707 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1666 | * SMBus feature is supported by the I2Cx Instance. |
1708 | * SMBus feature is supported by the I2Cx Instance. |
| 1667 | * @note RESET: Clear default value. |
1709 | * @note RESET: Clear default value. |
| 1668 | * SET: When a timeout or extended clock timeout occurs. |
1710 | * SET: When a timeout or extended clock timeout occurs. |
| 1669 | * @rmtoll ISR TIMEOUT LL_I2C_IsActiveSMBusFlag_TIMEOUT |
1711 | * @rmtoll ISR TIMEOUT LL_I2C_IsActiveSMBusFlag_TIMEOUT |
| 1670 | * @param I2Cx I2C Instance. |
1712 | * @param I2Cx I2C Instance. |
| Line 1675... | Line 1717... | ||
| 1675 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_TIMEOUT) == (I2C_ISR_TIMEOUT)) ? 1UL : 0UL); |
1717 | return ((READ_BIT(I2Cx->ISR, I2C_ISR_TIMEOUT) == (I2C_ISR_TIMEOUT)) ? 1UL : 0UL); |
| 1676 | } |
1718 | } |
| 1677 | 1719 | ||
| 1678 | /** |
1720 | /** |
| 1679 | * @brief Indicate the status of SMBus alert flag. |
1721 | * @brief Indicate the status of SMBus alert flag. |
| 1680 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1722 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1681 | * SMBus feature is supported by the I2Cx Instance. |
1723 | * SMBus feature is supported by the I2Cx Instance. |
| 1682 | * @note RESET: Clear default value. |
1724 | * @note RESET: Clear default value. |
| 1683 | * SET: When SMBus host configuration, SMBus alert enabled and |
1725 | * SET: When SMBus host configuration, SMBus alert enabled and |
| 1684 | * a falling edge event occurs on SMBA pin. |
1726 | * a falling edge event occurs on SMBA pin. |
| 1685 | * @rmtoll ISR ALERT LL_I2C_IsActiveSMBusFlag_ALERT |
1727 | * @rmtoll ISR ALERT LL_I2C_IsActiveSMBusFlag_ALERT |
| Line 1782... | Line 1824... | ||
| 1782 | SET_BIT(I2Cx->ICR, I2C_ICR_OVRCF); |
1824 | SET_BIT(I2Cx->ICR, I2C_ICR_OVRCF); |
| 1783 | } |
1825 | } |
| 1784 | 1826 | ||
| 1785 | /** |
1827 | /** |
| 1786 | * @brief Clear SMBus PEC error flag. |
1828 | * @brief Clear SMBus PEC error flag. |
| 1787 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1829 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1788 | * SMBus feature is supported by the I2Cx Instance. |
1830 | * SMBus feature is supported by the I2Cx Instance. |
| 1789 | * @rmtoll ICR PECCF LL_I2C_ClearSMBusFlag_PECERR |
1831 | * @rmtoll ICR PECCF LL_I2C_ClearSMBusFlag_PECERR |
| 1790 | * @param I2Cx I2C Instance. |
1832 | * @param I2Cx I2C Instance. |
| 1791 | * @retval None |
1833 | * @retval None |
| 1792 | */ |
1834 | */ |
| Line 1795... | Line 1837... | ||
| 1795 | SET_BIT(I2Cx->ICR, I2C_ICR_PECCF); |
1837 | SET_BIT(I2Cx->ICR, I2C_ICR_PECCF); |
| 1796 | } |
1838 | } |
| 1797 | 1839 | ||
| 1798 | /** |
1840 | /** |
| 1799 | * @brief Clear SMBus Timeout detection flag. |
1841 | * @brief Clear SMBus Timeout detection flag. |
| 1800 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1842 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1801 | * SMBus feature is supported by the I2Cx Instance. |
1843 | * SMBus feature is supported by the I2Cx Instance. |
| 1802 | * @rmtoll ICR TIMOUTCF LL_I2C_ClearSMBusFlag_TIMEOUT |
1844 | * @rmtoll ICR TIMOUTCF LL_I2C_ClearSMBusFlag_TIMEOUT |
| 1803 | * @param I2Cx I2C Instance. |
1845 | * @param I2Cx I2C Instance. |
| 1804 | * @retval None |
1846 | * @retval None |
| 1805 | */ |
1847 | */ |
| Line 1808... | Line 1850... | ||
| 1808 | SET_BIT(I2Cx->ICR, I2C_ICR_TIMOUTCF); |
1850 | SET_BIT(I2Cx->ICR, I2C_ICR_TIMOUTCF); |
| 1809 | } |
1851 | } |
| 1810 | 1852 | ||
| 1811 | /** |
1853 | /** |
| 1812 | * @brief Clear SMBus Alert flag. |
1854 | * @brief Clear SMBus Alert flag. |
| 1813 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
1855 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 1814 | * SMBus feature is supported by the I2Cx Instance. |
1856 | * SMBus feature is supported by the I2Cx Instance. |
| 1815 | * @rmtoll ICR ALERTCF LL_I2C_ClearSMBusFlag_ALERT |
1857 | * @rmtoll ICR ALERTCF LL_I2C_ClearSMBusFlag_ALERT |
| 1816 | * @param I2Cx I2C Instance. |
1858 | * @param I2Cx I2C Instance. |
| 1817 | * @retval None |
1859 | * @retval None |
| 1818 | */ |
1860 | */ |
| Line 1923... | Line 1965... | ||
| 1923 | { |
1965 | { |
| 1924 | return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_NBYTES) >> I2C_CR2_NBYTES_Pos); |
1966 | return (uint32_t)(READ_BIT(I2Cx->CR2, I2C_CR2_NBYTES) >> I2C_CR2_NBYTES_Pos); |
| 1925 | } |
1967 | } |
| 1926 | 1968 | ||
| 1927 | /** |
1969 | /** |
| 1928 | * @brief Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte. |
1970 | * @brief Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code |
| - | 1971 | or next received byte. |
|
| 1929 | * @note Usage in Slave mode only. |
1972 | * @note Usage in Slave mode only. |
| 1930 | * @rmtoll CR2 NACK LL_I2C_AcknowledgeNextData |
1973 | * @rmtoll CR2 NACK LL_I2C_AcknowledgeNextData |
| 1931 | * @param I2Cx I2C Instance. |
1974 | * @param I2Cx I2C Instance. |
| 1932 | * @param TypeAcknowledge This parameter can be one of the following values: |
1975 | * @param TypeAcknowledge This parameter can be one of the following values: |
| 1933 | * @arg @ref LL_I2C_ACK |
1976 | * @arg @ref LL_I2C_ACK |
| Line 1964... | Line 2007... | ||
| 1964 | } |
2007 | } |
| 1965 | 2008 | ||
| 1966 | /** |
2009 | /** |
| 1967 | * @brief Enable automatic RESTART Read request condition for 10bit address header (master mode). |
2010 | * @brief Enable automatic RESTART Read request condition for 10bit address header (master mode). |
| 1968 | * @note The master sends the complete 10bit slave address read sequence : |
2011 | * @note The master sends the complete 10bit slave address read sequence : |
| 1969 | * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address in Read direction. |
2012 | * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address |
| - | 2013 | in Read direction. |
|
| 1970 | * @rmtoll CR2 HEAD10R LL_I2C_EnableAuto10BitRead |
2014 | * @rmtoll CR2 HEAD10R LL_I2C_EnableAuto10BitRead |
| 1971 | * @param I2Cx I2C Instance. |
2015 | * @param I2Cx I2C Instance. |
| 1972 | * @retval None |
2016 | * @retval None |
| 1973 | */ |
2017 | */ |
| 1974 | __STATIC_INLINE void LL_I2C_EnableAuto10BitRead(I2C_TypeDef *I2Cx) |
2018 | __STATIC_INLINE void LL_I2C_EnableAuto10BitRead(I2C_TypeDef *I2Cx) |
| Line 2090... | Line 2134... | ||
| 2090 | * @retval None |
2134 | * @retval None |
| 2091 | */ |
2135 | */ |
| 2092 | __STATIC_INLINE void LL_I2C_HandleTransfer(I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize, |
2136 | __STATIC_INLINE void LL_I2C_HandleTransfer(I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize, |
| 2093 | uint32_t TransferSize, uint32_t EndMode, uint32_t Request) |
2137 | uint32_t TransferSize, uint32_t EndMode, uint32_t Request) |
| 2094 | { |
2138 | { |
| - | 2139 | MODIFY_REG(I2Cx->CR2, I2C_CR2_SADD | I2C_CR2_ADD10 | |
|
| 2095 | MODIFY_REG(I2Cx->CR2, I2C_CR2_SADD | I2C_CR2_ADD10 | (I2C_CR2_RD_WRN & (uint32_t)(Request >> (31U - I2C_CR2_RD_WRN_Pos))) | I2C_CR2_START | I2C_CR2_STOP | I2C_CR2_RELOAD | |
2140 | (I2C_CR2_RD_WRN & (uint32_t)(Request >> (31U - I2C_CR2_RD_WRN_Pos))) | |
| - | 2141 | I2C_CR2_START | I2C_CR2_STOP | I2C_CR2_RELOAD | |
|
| 2096 | I2C_CR2_NBYTES | I2C_CR2_AUTOEND | I2C_CR2_HEAD10R, |
2142 | I2C_CR2_NBYTES | I2C_CR2_AUTOEND | I2C_CR2_HEAD10R, |
| 2097 | SlaveAddr | SlaveAddrSize | (TransferSize << I2C_CR2_NBYTES_Pos) | EndMode | Request); |
2143 | SlaveAddr | SlaveAddrSize | (TransferSize << I2C_CR2_NBYTES_Pos) | EndMode | Request); |
| 2098 | } |
2144 | } |
| 2099 | 2145 | ||
| 2100 | /** |
2146 | /** |
| Line 2123... | Line 2169... | ||
| 2123 | return (uint32_t)(READ_BIT(I2Cx->ISR, I2C_ISR_ADDCODE) >> I2C_ISR_ADDCODE_Pos << 1); |
2169 | return (uint32_t)(READ_BIT(I2Cx->ISR, I2C_ISR_ADDCODE) >> I2C_ISR_ADDCODE_Pos << 1); |
| 2124 | } |
2170 | } |
| 2125 | 2171 | ||
| 2126 | /** |
2172 | /** |
| 2127 | * @brief Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode). |
2173 | * @brief Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode). |
| 2128 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
2174 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 2129 | * SMBus feature is supported by the I2Cx Instance. |
2175 | * SMBus feature is supported by the I2Cx Instance. |
| 2130 | * @note This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition or an Address Matched is received. |
2176 | * @note This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition |
| - | 2177 | or an Address Matched is received. |
|
| 2131 | * This bit has no effect when RELOAD bit is set. |
2178 | * This bit has no effect when RELOAD bit is set. |
| 2132 | * This bit has no effect in device mode when SBC bit is not set. |
2179 | * This bit has no effect in device mode when SBC bit is not set. |
| 2133 | * @rmtoll CR2 PECBYTE LL_I2C_EnableSMBusPECCompare |
2180 | * @rmtoll CR2 PECBYTE LL_I2C_EnableSMBusPECCompare |
| 2134 | * @param I2Cx I2C Instance. |
2181 | * @param I2Cx I2C Instance. |
| 2135 | * @retval None |
2182 | * @retval None |
| Line 2139... | Line 2186... | ||
| 2139 | SET_BIT(I2Cx->CR2, I2C_CR2_PECBYTE); |
2186 | SET_BIT(I2Cx->CR2, I2C_CR2_PECBYTE); |
| 2140 | } |
2187 | } |
| 2141 | 2188 | ||
| 2142 | /** |
2189 | /** |
| 2143 | * @brief Check if the SMBus Packet Error byte internal comparison is requested or not. |
2190 | * @brief Check if the SMBus Packet Error byte internal comparison is requested or not. |
| 2144 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
2191 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 2145 | * SMBus feature is supported by the I2Cx Instance. |
2192 | * SMBus feature is supported by the I2Cx Instance. |
| 2146 | * @rmtoll CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare |
2193 | * @rmtoll CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare |
| 2147 | * @param I2Cx I2C Instance. |
2194 | * @param I2Cx I2C Instance. |
| 2148 | * @retval State of bit (1 or 0). |
2195 | * @retval State of bit (1 or 0). |
| 2149 | */ |
2196 | */ |
| Line 2152... | Line 2199... | ||
| 2152 | return ((READ_BIT(I2Cx->CR2, I2C_CR2_PECBYTE) == (I2C_CR2_PECBYTE)) ? 1UL : 0UL); |
2199 | return ((READ_BIT(I2Cx->CR2, I2C_CR2_PECBYTE) == (I2C_CR2_PECBYTE)) ? 1UL : 0UL); |
| 2153 | } |
2200 | } |
| 2154 | 2201 | ||
| 2155 | /** |
2202 | /** |
| 2156 | * @brief Get the SMBus Packet Error byte calculated. |
2203 | * @brief Get the SMBus Packet Error byte calculated. |
| 2157 | * @note Macro @ref IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
2204 | * @note The macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not |
| 2158 | * SMBus feature is supported by the I2Cx Instance. |
2205 | * SMBus feature is supported by the I2Cx Instance. |
| 2159 | * @rmtoll PECR PEC LL_I2C_GetSMBusPEC |
2206 | * @rmtoll PECR PEC LL_I2C_GetSMBusPEC |
| 2160 | * @param I2Cx I2C Instance. |
2207 | * @param I2Cx I2C Instance. |
| 2161 | * @retval Value between Min_Data=0x00 and Max_Data=0xFF |
2208 | * @retval Value between Min_Data=0x00 and Max_Data=0xFF |
| 2162 | */ |
2209 | */ |
| 2163 | __STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC(I2C_TypeDef *I2Cx) |
2210 | __STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC(I2C_TypeDef *I2Cx) |
| 2164 | { |
2211 | { |
| 2165 | return (uint32_t)(READ_BIT(I2Cx->PECR, I2C_PECR_PEC)); |
2212 | return (uint32_t)(READ_BIT(I2Cx->PECR, I2C_PECR_PEC)); |
| 2166 | } |
2213 | } |
| 2167 | 2214 | ||