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

Modules

 I2C Private macros to check input parameters
 

Macros

#define I2C_FREQRANGE(__PCLK__)   ((__PCLK__)/1000000U)
 
#define I2C_RISE_TIME(__FREQRANGE__, __SPEED__)   (((__SPEED__) <= 100000U) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))
 
#define I2C_SPEED_STANDARD(__PCLK__, __SPEED__)   (((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CCR_CCR) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))
 
#define I2C_SPEED_FAST(__PCLK__, __SPEED__, __DUTYCYCLE__)   (((__DUTYCYCLE__) == I2C_DUTYCYCLE_2)? ((__PCLK__) / ((__SPEED__) * 3U)) : (((__PCLK__) / ((__SPEED__) * 25U)) | I2C_DUTYCYCLE_16_9))
 
#define I2C_SPEED(__PCLK__, __SPEED__, __DUTYCYCLE__)
 
#define I2C_7BIT_ADD_WRITE(__ADDRESS__)   ((uint8_t)((__ADDRESS__) & (~I2C_OAR1_ADD0)))
 
#define I2C_7BIT_ADD_READ(__ADDRESS__)   ((uint8_t)((__ADDRESS__) | I2C_OAR1_ADD0))
 
#define I2C_10BIT_ADDRESS(__ADDRESS__)   ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))
 
#define I2C_10BIT_HEADER_WRITE(__ADDRESS__)   ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)0x00F0)))
 
#define I2C_10BIT_HEADER_READ(__ADDRESS__)   ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)(0x00F1))))
 
#define I2C_MEM_ADD_MSB(__ADDRESS__)   ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0xFF00)) >> 8)))
 
#define I2C_MEM_ADD_LSB(__ADDRESS__)   ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))
 

Detailed Description

Macro Definition Documentation

◆ I2C_FREQRANGE

#define I2C_FREQRANGE (   __PCLK__)    ((__PCLK__)/1000000U)

◆ I2C_RISE_TIME

#define I2C_RISE_TIME (   __FREQRANGE__,
  __SPEED__ 
)    (((__SPEED__) <= 100000U) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))

◆ I2C_SPEED_STANDARD

#define I2C_SPEED_STANDARD (   __PCLK__,
  __SPEED__ 
)    (((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CCR_CCR) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))

◆ I2C_SPEED_FAST

#define I2C_SPEED_FAST (   __PCLK__,
  __SPEED__,
  __DUTYCYCLE__ 
)    (((__DUTYCYCLE__) == I2C_DUTYCYCLE_2)? ((__PCLK__) / ((__SPEED__) * 3U)) : (((__PCLK__) / ((__SPEED__) * 25U)) | I2C_DUTYCYCLE_16_9))

◆ I2C_SPEED

#define I2C_SPEED (   __PCLK__,
  __SPEED__,
  __DUTYCYCLE__ 
)
Value:
(((__SPEED__) <= 100000U)? (I2C_SPEED_STANDARD((__PCLK__), (__SPEED__))) : \
((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__)) & I2C_CCR_CCR) == 0U)? 1U : \
((I2C_SPEED_FAST((__PCLK__), (__SPEED__), (__DUTYCYCLE__))) | I2C_CCR_FS))

◆ I2C_7BIT_ADD_WRITE

#define I2C_7BIT_ADD_WRITE (   __ADDRESS__)    ((uint8_t)((__ADDRESS__) & (~I2C_OAR1_ADD0)))

◆ I2C_7BIT_ADD_READ

#define I2C_7BIT_ADD_READ (   __ADDRESS__)    ((uint8_t)((__ADDRESS__) | I2C_OAR1_ADD0))

◆ I2C_10BIT_ADDRESS

#define I2C_10BIT_ADDRESS (   __ADDRESS__)    ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))

◆ I2C_10BIT_HEADER_WRITE

#define I2C_10BIT_HEADER_WRITE (   __ADDRESS__)    ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)0x00F0)))

◆ I2C_10BIT_HEADER_READ

#define I2C_10BIT_HEADER_READ (   __ADDRESS__)    ((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0x0300)) >> 7) | (uint16_t)(0x00F1))))

◆ I2C_MEM_ADD_MSB

#define I2C_MEM_ADD_MSB (   __ADDRESS__)    ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)0xFF00)) >> 8)))

◆ I2C_MEM_ADD_LSB

#define I2C_MEM_ADD_LSB (   __ADDRESS__)    ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)0x00FF)))
I2C_SPEED_FAST
#define I2C_SPEED_FAST(__PCLK__, __SPEED__, __DUTYCYCLE__)
Definition: stm32f4xx_hal_i2c.h:580
I2C_SPEED_STANDARD
#define I2C_SPEED_STANDARD(__PCLK__, __SPEED__)
Definition: stm32f4xx_hal_i2c.h:579