RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Macros

Macros

#define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->State = HAL_I2C_STATE_RESET)
 Reset I2C handle state.
 
#define __HAL_I2C_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__))
 Enable the specified I2C interrupt.
 
#define __HAL_I2C_DISABLE_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__)))
 Disable the specified I2C interrupt.
 
#define __HAL_I2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
 Check whether the specified I2C interrupt source is enabled or not.
 
#define I2C_FLAG_MASK   (0x0001FFFFU)
 Check whether the specified I2C flag is set or not.
 
#define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__)
 
#define __HAL_I2C_CLEAR_FLAG(__HANDLE__, __FLAG__)
 Clear the I2C pending flags which are cleared by writing 1 in a specific bit.
 
#define __HAL_I2C_ENABLE(__HANDLE__)   (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
 Enable the specified I2C peripheral.
 
#define __HAL_I2C_DISABLE(__HANDLE__)   (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))
 Disable the specified I2C peripheral.
 
#define __HAL_I2C_GENERATE_NACK(__HANDLE__)   (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK))
 Generate a Non-Acknowledge I2C peripheral in Slave mode.
 

Detailed Description

Macro Definition Documentation

◆ __HAL_I2C_CLEAR_FLAG

#define __HAL_I2C_CLEAR_FLAG (   __HANDLE__,
  __FLAG__ 
)
Value:
(((__FLAG__) == I2C_FLAG_TXE) ? \
((__HANDLE__)->Instance->ISR |= (__FLAG__)) : \
((__HANDLE__)->Instance->ICR = (__FLAG__)))

Clear the I2C pending flags which are cleared by writing 1 in a specific bit.

Parameters
__HANDLE__specifies the I2C Handle.
__FLAG__specifies the flag to clear. This parameter can be any combination of the following values:
  • I2C_FLAG_TXE Transmit data register empty
  • I2C_FLAG_ADDR Address matched (slave mode)
  • I2C_FLAG_AF Acknowledge failure received flag
  • I2C_FLAG_STOPF STOP detection flag
  • I2C_FLAG_BERR Bus error
  • I2C_FLAG_ARLO Arbitration lost
  • I2C_FLAG_OVR Overrun/Underrun
  • I2C_FLAG_PECERR PEC error in reception
  • I2C_FLAG_TIMEOUT Timeout or Tlow detection flag
  • I2C_FLAG_ALERT SMBus alert
Return values
None

◆ __HAL_I2C_DISABLE

#define __HAL_I2C_DISABLE (   __HANDLE__)    (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))

Disable the specified I2C peripheral.

Parameters
__HANDLE__specifies the I2C Handle.
Return values
None

◆ __HAL_I2C_DISABLE_IT

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

Disable the specified I2C interrupt.

Parameters
__HANDLE__specifies the I2C Handle.
__INTERRUPT__specifies the interrupt source to disable. This parameter can be one of the following values:
  • I2C_IT_ERRI Errors interrupt enable
  • I2C_IT_TCI Transfer complete interrupt enable
  • I2C_IT_STOPI STOP detection interrupt enable
  • I2C_IT_NACKI NACK received interrupt enable
  • I2C_IT_ADDRI Address match interrupt enable
  • I2C_IT_RXI RX interrupt enable
  • I2C_IT_TXI TX interrupt enable
Return values
None

◆ __HAL_I2C_ENABLE

#define __HAL_I2C_ENABLE (   __HANDLE__)    (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE))

Enable the specified I2C peripheral.

Parameters
__HANDLE__specifies the I2C Handle.
Return values
None

◆ __HAL_I2C_ENABLE_IT

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

Enable the specified I2C interrupt.

Parameters
__HANDLE__specifies the I2C Handle.
__INTERRUPT__specifies the interrupt source to enable. This parameter can be one of the following values:
  • I2C_IT_ERRI Errors interrupt enable
  • I2C_IT_TCI Transfer complete interrupt enable
  • I2C_IT_STOPI STOP detection interrupt enable
  • I2C_IT_NACKI NACK received interrupt enable
  • I2C_IT_ADDRI Address match interrupt enable
  • I2C_IT_RXI RX interrupt enable
  • I2C_IT_TXI TX interrupt enable
Return values
None

◆ __HAL_I2C_GENERATE_NACK

#define __HAL_I2C_GENERATE_NACK (   __HANDLE__)    (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK))

Generate a Non-Acknowledge I2C peripheral in Slave mode.

Parameters
__HANDLE__specifies the I2C Handle.
Return values
None

◆ __HAL_I2C_GET_FLAG

#define __HAL_I2C_GET_FLAG (   __HANDLE__,
  __FLAG__ 
)
Value:
(((((__HANDLE__)->Instance->ISR) & \
(__FLAG__)) == (__FLAG__)) ? SET : RESET)

◆ __HAL_I2C_GET_IT_SOURCE

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

Check whether the specified I2C interrupt source is enabled or not.

Parameters
__HANDLE__specifies the I2C Handle.
__INTERRUPT__specifies the I2C interrupt source to check. This parameter can be one of the following values:
  • I2C_IT_ERRI Errors interrupt enable
  • I2C_IT_TCI Transfer complete interrupt enable
  • I2C_IT_STOPI STOP detection interrupt enable
  • I2C_IT_NACKI NACK received interrupt enable
  • I2C_IT_ADDRI Address match interrupt enable
  • I2C_IT_RXI RX interrupt enable
  • I2C_IT_TXI TX interrupt enable
Return values
Thenew state of INTERRUPT (SET or RESET).

◆ __HAL_I2C_RESET_HANDLE_STATE

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

Reset I2C handle state.

Parameters
__HANDLE__specifies the I2C Handle.
Return values
None

◆ I2C_FLAG_MASK

#define I2C_FLAG_MASK   (0x0001FFFFU)

Check whether the specified I2C flag is set or not.

Parameters
__HANDLE__specifies the I2C Handle.
__FLAG__specifies the flag to check. This parameter can be one of the following values:
  • I2C_FLAG_TXE Transmit data register empty
  • I2C_FLAG_TXIS Transmit interrupt status
  • I2C_FLAG_RXNE Receive data register not empty
  • I2C_FLAG_ADDR Address matched (slave mode)
  • I2C_FLAG_AF Acknowledge failure received flag
  • I2C_FLAG_STOPF STOP detection flag
  • I2C_FLAG_TC Transfer complete (master mode)
  • I2C_FLAG_TCR Transfer complete reload
  • I2C_FLAG_BERR Bus error
  • I2C_FLAG_ARLO Arbitration lost
  • I2C_FLAG_OVR Overrun/Underrun
  • I2C_FLAG_PECERR PEC error in reception
  • I2C_FLAG_TIMEOUT Timeout or Tlow detection flag
  • I2C_FLAG_ALERT SMBus alert
  • I2C_FLAG_BUSY Bus busy
  • I2C_FLAG_DIR Transfer direction (slave mode)
Return values
Thenew state of FLAG (SET or RESET).