Prusa MINI Firmware overview
|
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))) |
#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))) |