Prusa MINI Firmware overview
|
Go to the documentation of this file.
37 #ifndef __STM32F4xx_HAL_I2C_H
38 #define __STM32F4xx_HAL_I2C_H
216 #define HAL_I2C_ERROR_NONE 0x00000000U
217 #define HAL_I2C_ERROR_BERR 0x00000001U
218 #define HAL_I2C_ERROR_ARLO 0x00000002U
219 #define HAL_I2C_ERROR_AF 0x00000004U
220 #define HAL_I2C_ERROR_OVR 0x00000008U
221 #define HAL_I2C_ERROR_DMA 0x00000010U
222 #define HAL_I2C_ERROR_TIMEOUT 0x00000020U
230 #define I2C_DUTYCYCLE_2 0x00000000U
231 #define I2C_DUTYCYCLE_16_9 I2C_CCR_DUTY
239 #define I2C_ADDRESSINGMODE_7BIT 0x00004000U
240 #define I2C_ADDRESSINGMODE_10BIT (I2C_OAR1_ADDMODE | 0x00004000U)
248 #define I2C_DUALADDRESS_DISABLE 0x00000000U
249 #define I2C_DUALADDRESS_ENABLE I2C_OAR2_ENDUAL
257 #define I2C_GENERALCALL_DISABLE 0x00000000U
258 #define I2C_GENERALCALL_ENABLE I2C_CR1_ENGC
266 #define I2C_NOSTRETCH_DISABLE 0x00000000U
267 #define I2C_NOSTRETCH_ENABLE I2C_CR1_NOSTRETCH
275 #define I2C_MEMADD_SIZE_8BIT 0x00000001U
276 #define I2C_MEMADD_SIZE_16BIT 0x00000010U
284 #define I2C_DIRECTION_RECEIVE 0x00000000U
285 #define I2C_DIRECTION_TRANSMIT 0x00000001U
293 #define I2C_FIRST_FRAME 0x00000001U
294 #define I2C_NEXT_FRAME 0x00000002U
295 #define I2C_FIRST_AND_LAST_FRAME 0x00000004U
296 #define I2C_LAST_FRAME 0x00000008U
304 #define I2C_IT_BUF I2C_CR2_ITBUFEN
305 #define I2C_IT_EVT I2C_CR2_ITEVTEN
306 #define I2C_IT_ERR I2C_CR2_ITERREN
314 #define I2C_FLAG_SMBALERT 0x00018000U
315 #define I2C_FLAG_TIMEOUT 0x00014000U
316 #define I2C_FLAG_PECERR 0x00011000U
317 #define I2C_FLAG_OVR 0x00010800U
318 #define I2C_FLAG_AF 0x00010400U
319 #define I2C_FLAG_ARLO 0x00010200U
320 #define I2C_FLAG_BERR 0x00010100U
321 #define I2C_FLAG_TXE 0x00010080U
322 #define I2C_FLAG_RXNE 0x00010040U
323 #define I2C_FLAG_STOPF 0x00010010U
324 #define I2C_FLAG_ADD10 0x00010008U
325 #define I2C_FLAG_BTF 0x00010004U
326 #define I2C_FLAG_ADDR 0x00010002U
327 #define I2C_FLAG_SB 0x00010001U
328 #define I2C_FLAG_DUALF 0x00100080U
329 #define I2C_FLAG_SMBHOST 0x00100040U
330 #define I2C_FLAG_SMBDEFAULT 0x00100020U
331 #define I2C_FLAG_GENCALL 0x00100010U
332 #define I2C_FLAG_TRA 0x00100004U
333 #define I2C_FLAG_BUSY 0x00100002U
334 #define I2C_FLAG_MSL 0x00100001U
353 #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
365 #define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
366 #define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
378 #define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
409 #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 16U)) == 0x01U)?((((__HANDLE__)->Instance->SR1) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)): \
410 ((((__HANDLE__)->Instance->SR2) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)))
426 #define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR1 = ~((__FLAG__) & I2C_FLAG_MASK))
433 #define __HAL_I2C_CLEAR_ADDRFLAG(__HANDLE__) \
435 __IO uint32_t tmpreg = 0x00U; \
436 tmpreg = (__HANDLE__)->Instance->SR1; \
437 tmpreg = (__HANDLE__)->Instance->SR2; \
446 #define __HAL_I2C_CLEAR_STOPFLAG(__HANDLE__) \
448 __IO uint32_t tmpreg = 0x00U; \
449 tmpreg = (__HANDLE__)->Instance->SR1; \
450 (__HANDLE__)->Instance->CR1 |= I2C_CR1_PE; \
459 #define __HAL_I2C_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= I2C_CR1_PE)
466 #define __HAL_I2C_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~I2C_CR1_PE)
567 #define I2C_FLAG_MASK 0x0000FFFFU
577 #define I2C_FREQRANGE(__PCLK__) ((__PCLK__)/1000000U)
578 #define I2C_RISE_TIME(__FREQRANGE__, __SPEED__) (((__SPEED__) <= 100000U) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))
579 #define I2C_SPEED_STANDARD(__PCLK__, __SPEED__) (((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CCR_CCR) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))
580 #define I2C_SPEED_FAST(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__DUTYCYCLE__) == I2C_DUTYCYCLE_2)? ((__PCLK__) / ((__SPEED__) * 3U)) : (((__PCLK__) / ((__SPEED__) * 25U)) | I2C_DUTYCYCLE_16_9))
581 #define I2C_SPEED(__PCLK__, __SPEED__, __DUTYCYCLE__) (((__SPEED__) <= 100000U)? (I2C_SPEED_STANDARD((__PCLK__), (__SPEED__))) : \
582 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__)) & I2C_CCR_CCR) == 0U)? 1U : \
583 ((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__))) | I2C_CCR_FS))
585 #define I2C_7BIT_ADD_WRITE(__ADDRESS__) ((uint8_t)((__ADDRESS__) & (~I2C_OAR1_ADD0)))
586 #define I2C_7BIT_ADD_READ(__ADDRESS__) ((uint8_t)((__ADDRESS__) | I2C_OAR1_ADD0))
588 #define I2C_10BIT_ADDRESS(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))
589 #define I2C_10BIT_HEADER_WRITE(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)0x00F0)))
590 #define I2C_10BIT_HEADER_READ(__ADDRESS__) ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)(0x00F1))))
592 #define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0xFF00)) >> 8)))
593 #define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))
598 #define IS_I2C_DUTY_CYCLE(CYCLE) (((CYCLE) == I2C_DUTYCYCLE_2) || \
599 ((CYCLE) == I2C_DUTYCYCLE_16_9))
600 #define IS_I2C_ADDRESSING_MODE(ADDRESS) (((ADDRESS) == I2C_ADDRESSINGMODE_7BIT) || \
601 ((ADDRESS) == I2C_ADDRESSINGMODE_10BIT))
602 #define IS_I2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == I2C_DUALADDRESS_DISABLE) || \
603 ((ADDRESS) == I2C_DUALADDRESS_ENABLE))
604 #define IS_I2C_GENERAL_CALL(CALL) (((CALL) == I2C_GENERALCALL_DISABLE) || \
605 ((CALL) == I2C_GENERALCALL_ENABLE))
606 #define IS_I2C_NO_STRETCH(STRETCH) (((STRETCH) == I2C_NOSTRETCH_DISABLE) || \
607 ((STRETCH) == I2C_NOSTRETCH_ENABLE))
608 #define IS_I2C_MEMADD_SIZE(SIZE) (((SIZE) == I2C_MEMADD_SIZE_8BIT) || \
609 ((SIZE) == I2C_MEMADD_SIZE_16BIT))
610 #define IS_I2C_CLOCK_SPEED(SPEED) (((SPEED) > 0U) && ((SPEED) <= 400000U))
611 #define IS_I2C_OWN_ADDRESS1(ADDRESS1) (((ADDRESS1) & 0xFFFFFC00U) == 0U)
612 #define IS_I2C_OWN_ADDRESS2(ADDRESS2) (((ADDRESS2) & 0xFFFFFF01U) == 0U)
613 #define IS_I2C_TRANSFER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == I2C_FIRST_FRAME) || \
614 ((REQUEST) == I2C_NEXT_FRAME) || \
615 ((REQUEST) == I2C_FIRST_AND_LAST_FRAME) || \
616 ((REQUEST) == I2C_LAST_FRAME))
HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
uint32_t OwnAddress2
Definition: stm32f4xx_hal_i2c.h:80
HAL_StatusTypeDef HAL_I2C_EnableListen_IT(I2C_HandleTypeDef *hi2c)
__IO uint32_t EventCount
Definition: stm32f4xx_hal_i2c.h:199
Definition: stm32f4xx_hal_i2c.h:120
void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef *hi2c)
This file contains HAL common defines, enumeration, macros and structures definitions.
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c)
__IO uint32_t ErrorCode
Definition: stm32f4xx_hal_i2c.h:191
Definition: stm32f4xx_hal_i2c.h:155
__IO uint32_t Memaddress
Definition: stm32f4xx_hal_i2c.h:195
HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
I2C MSP Initialization This function configures the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:190
Definition: stm32f4xx_hal_i2c.h:154
__IO uint32_t XferOptions
Definition: stm32f4xx_hal_i2c.h:176
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c)
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
I2C MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:225
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
uint32_t DutyCycle
Definition: stm32f4xx_hal_i2c.h:68
HAL_StatusTypeDef HAL_I2C_DisableListen_IT(I2C_HandleTypeDef *hi2c)
void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
__IO uint16_t XferCount
Definition: stm32f4xx_hal_i2c.h:174
__IO uint32_t Devaddress
Definition: stm32f4xx_hal_i2c.h:193
HAL_StatusTypeDef HAL_I2C_DeInit(I2C_HandleTypeDef *hi2c)
I2C Configuration Structure definition.
Definition: stm32f4xx_hal_i2c.h:63
uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c)
Definition: stm32f4xx_hal_i2c.h:121
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c)
HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
HAL_I2C_StateTypeDef HAL_I2C_GetState(I2C_HandleTypeDef *hi2c)
HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
uint32_t AddressingMode
Definition: stm32f4xx_hal_i2c.h:74
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c)
Definition: stm32f4xx_hal_i2c.h:129
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
uint32_t GeneralCallMode
Definition: stm32f4xx_hal_i2c.h:83
DMA handle Structure definition.
Definition: stm32f4xx_hal_dma.h:155
HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
__IO uint32_t PreviousState
Definition: stm32f4xx_hal_i2c.h:178
void HAL_I2C_ER_IRQHandler(I2C_HandleTypeDef *hi2c)
Header file of I2C HAL Extension module.
void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c)
uint32_t OwnAddress1
Definition: stm32f4xx_hal_i2c.h:71
HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
DMA_HandleTypeDef * hdmatx
Definition: stm32f4xx_hal_i2c.h:181
HAL_LockTypeDef Lock
Definition: stm32f4xx_hal_i2c.h:185
I2C_InitTypeDef Init
Definition: stm32f4xx_hal_i2c.h:168
Definition: stm32f4xx_hal_i2c.h:124
const uint8_t[]
Definition: 404_html.c:3
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
__IO HAL_I2C_StateTypeDef State
Definition: stm32f4xx_hal_i2c.h:187
Definition: stm32f4xx_hal_i2c.h:123
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions)
HAL_I2C_ModeTypeDef
HAL Mode structure definition.
Definition: stm32f4xx_hal_i2c.h:152
DMA_HandleTypeDef * hdmarx
Definition: stm32f4xx_hal_i2c.h:183
Definition: stm32f4xx_hal_i2c.h:122
HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size)
__IO uint32_t MemaddSize
Definition: stm32f4xx_hal_i2c.h:197
HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress)
I2C_TypeDef * Instance
Definition: stm32f4xx_hal_i2c.h:166
HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Definition: stm32f4xx_hal_i2c.h:127
void HAL_I2C_ListenCpltCallback(I2C_HandleTypeDef *hi2c)
uint8_t * pBuffPtr
Definition: stm32f4xx_hal_i2c.h:170
uint32_t ClockSpeed
Definition: stm32f4xx_hal_i2c.h:65
HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
__IO HAL_I2C_ModeTypeDef Mode
Definition: stm32f4xx_hal_i2c.h:189
Definition: stm32f4xx_hal_i2c.h:157
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
uint32_t DualAddressMode
Definition: stm32f4xx_hal_i2c.h:77
HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c)
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c)
Definition: stm32f4xx_hal_i2c.h:125
HAL_I2C_ModeTypeDef HAL_I2C_GetMode(I2C_HandleTypeDef *hi2c)
HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32f4xx_hal_def.h:66
HAL_I2C_StateTypeDef
HAL State structure definition.
Definition: stm32f4xx_hal_i2c.h:117
HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
Definition: stm32f4xx_hal_i2c.h:130
Definition: stm32f4xx_hal_i2c.h:119
HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)
uint32_t NoStretchMode
Definition: stm32f4xx_hal_i2c.h:86
Definition: stm32f4xx_hal_i2c.h:156
uint16_t XferSize
Definition: stm32f4xx_hal_i2c.h:172
HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)
Definition: stm32f4xx_hal_i2c.h:131
I2C handle Structure definition.
Definition: stm32f4xx_hal_i2c.h:164
HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout)