Prusa MINI Firmware overview
I2C Exported Macros
Collaboration diagram for I2C Exported Macros:

Macros

#define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
 Reset I2C handle state. More...
 
#define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
 Enable or disable the specified I2C interrupts. More...
 
#define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
 
#define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
 Checks if the specified I2C interrupt source is enabled or disabled. More...
 
#define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__)
 Checks whether the specified I2C flag is set or not. More...
 
#define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__)   ((__HANDLE__)->Instance->SR1 = ~((__FLAG__) & I2C_FLAG_MASK))
 Clears the I2C pending flags which are cleared by writing 0 in a specific bit. More...
 
#define __HAL_I2C_CLEAR_ADDRFLAG(__HANDLE__)
 Clears the I2C ADDR pending flag. More...
 
#define __HAL_I2C_CLEAR_STOPFLAG(__HANDLE__)
 Clears the I2C STOPF pending flag. More...
 
#define __HAL_I2C_ENABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 |= I2C_CR1_PE)
 Enable the I2C peripheral. More...
 
#define __HAL_I2C_DISABLE(__HANDLE__)   ((__HANDLE__)->Instance->CR1 &= ~I2C_CR1_PE)
 Disable the I2C peripheral. More...
 

Detailed Description

Macro Definition Documentation

◆ __HAL_I2C_RESET_HANDLE_STATE

#define __HAL_I2C_RESET_HANDLE_STATE (   __HANDLE__)    ((__HANDLE__)->State = HAL_I2C_STATE_RESET)

Reset I2C handle state.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
Return values
None

◆ __HAL_I2C_ENABLE_IT

#define __HAL_I2C_ENABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)    ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))

Enable or disable the specified I2C interrupts.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
<strong>INTERRUPT</strong>specifies the interrupt source to enable or disable. This parameter can be one of the following values:
  • I2C_IT_BUF: Buffer interrupt enable
  • I2C_IT_EVT: Event interrupt enable
  • I2C_IT_ERR: Error interrupt enable
Return values
None

◆ __HAL_I2C_DISABLE_IT

#define __HAL_I2C_DISABLE_IT (   __HANDLE__,
  __INTERRUPT__ 
)    ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))

◆ __HAL_I2C_GET_IT_SOURCE

#define __HAL_I2C_GET_IT_SOURCE (   __HANDLE__,
  __INTERRUPT__ 
)    ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)

Checks if the specified I2C interrupt source is enabled or disabled.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
<strong>INTERRUPT</strong>specifies the I2C interrupt source to check. This parameter can be one of the following values:
  • I2C_IT_BUF: Buffer interrupt enable
  • I2C_IT_EVT: Event interrupt enable
  • I2C_IT_ERR: Error interrupt enable
Return values
Thenew state of INTERRUPT (TRUE or FALSE).

◆ __HAL_I2C_GET_FLAG

#define __HAL_I2C_GET_FLAG (   __HANDLE__,
  __FLAG__ 
)
Value:
((((uint8_t)((__FLAG__) >> 16U)) == 0x01U)?((((__HANDLE__)->Instance->SR1) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)): \
((((__HANDLE__)->Instance->SR2) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)))

Checks whether the specified I2C flag is set or not.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
<strong>FLAG</strong>specifies the flag to check. This parameter can be one of the following values:
  • I2C_FLAG_SMBALERT: SMBus Alert flag
  • I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
  • I2C_FLAG_PECERR: PEC error in reception flag
  • I2C_FLAG_OVR: Overrun/Underrun flag
  • I2C_FLAG_AF: Acknowledge failure flag
  • I2C_FLAG_ARLO: Arbitration lost flag
  • I2C_FLAG_BERR: Bus error flag
  • I2C_FLAG_TXE: Data register empty flag
  • I2C_FLAG_RXNE: Data register not empty flag
  • I2C_FLAG_STOPF: Stop detection flag
  • I2C_FLAG_ADD10: 10-bit header sent flag
  • I2C_FLAG_BTF: Byte transfer finished flag
  • I2C_FLAG_ADDR: Address sent flag Address matched flag
  • I2C_FLAG_SB: Start bit flag
  • I2C_FLAG_DUALF: Dual flag
  • I2C_FLAG_SMBHOST: SMBus host header
  • I2C_FLAG_SMBDEFAULT: SMBus default header
  • I2C_FLAG_GENCALL: General call header flag
  • I2C_FLAG_TRA: Transmitter/Receiver flag
  • I2C_FLAG_BUSY: Bus busy flag
  • I2C_FLAG_MSL: Master/Slave flag
Return values
Thenew state of FLAG (TRUE or FALSE).

◆ __HAL_I2C_CLEAR_FLAG

#define __HAL_I2C_CLEAR_FLAG (   __HANDLE__,
  __FLAG__ 
)    ((__HANDLE__)->Instance->SR1 = ~((__FLAG__) & I2C_FLAG_MASK))

Clears the I2C pending flags which are cleared by writing 0 in a specific bit.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
<strong>FLAG</strong>specifies the flag to clear. This parameter can be any combination of the following values:
  • I2C_FLAG_SMBALERT: SMBus Alert flag
  • I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
  • I2C_FLAG_PECERR: PEC error in reception flag
  • I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
  • I2C_FLAG_AF: Acknowledge failure flag
  • I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
  • I2C_FLAG_BERR: Bus error flag
Return values
None

◆ __HAL_I2C_CLEAR_ADDRFLAG

#define __HAL_I2C_CLEAR_ADDRFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg = 0x00U; \
tmpreg = (__HANDLE__)->Instance->SR1; \
tmpreg = (__HANDLE__)->Instance->SR2; \
UNUSED(tmpreg); \
} while(0)

Clears the I2C ADDR pending flag.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
Return values
None

◆ __HAL_I2C_CLEAR_STOPFLAG

#define __HAL_I2C_CLEAR_STOPFLAG (   __HANDLE__)
Value:
do{ \
__IO uint32_t tmpreg = 0x00U; \
tmpreg = (__HANDLE__)->Instance->SR1; \
(__HANDLE__)->Instance->CR1 |= I2C_CR1_PE; \
UNUSED(tmpreg); \
} while(0)

Clears the I2C STOPF pending flag.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2C where x: 1, 2, or 3 to select the I2C peripheral.
Return values
None

◆ __HAL_I2C_ENABLE

#define __HAL_I2C_ENABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1 |= I2C_CR1_PE)

Enable the I2C peripheral.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2Cx where x: 1 or 2 to select the I2C peripheral.
Return values
None

◆ __HAL_I2C_DISABLE

#define __HAL_I2C_DISABLE (   __HANDLE__)    ((__HANDLE__)->Instance->CR1 &= ~I2C_CR1_PE)

Disable the I2C peripheral.

Parameters
<strong>HANDLE</strong>specifies the I2C Handle. This parameter can be I2Cx where x: 1 or 2 to select the I2C peripheral.
Return values
None
I2C_FLAG_MASK
#define I2C_FLAG_MASK
Definition: stm32f4xx_hal_i2c.h:567
uint8_t
const uint8_t[]
Definition: 404_html.c:3