I2C - Inter-Integrated Circuit

Description

Inter-integrated Circuit (I2C) Peripheral API.

This module contains functions to control the I2C peripheral of Silicon Labs 32-bit MCUs and SoCs. The I2C interface allows communication on I2C buses with the lowest energy consumption possible.

Data Structures

struct I2C_Init_TypeDef
I2C initialization structure.
struct I2C_TransferSeq_TypeDef
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to stop).

Functions

uint32_t I2C_BusFreqGet (I2C_TypeDef *i2c)
Get the current configured I2C bus frequency.
void I2C_BusFreqSet (I2C_TypeDef *i2c, uint32_t freqRef, uint32_t freqScl, I2C_ClockHLR_TypeDef i2cMode)
Set the I2C bus frequency.
void I2C_Enable (I2C_TypeDef *i2c, bool enable)
Enable/disable I2C.
void I2C_Init (I2C_TypeDef *i2c, const I2C_Init_TypeDef *init)
Initialize I2C.
void I2C_IntClear (I2C_TypeDef *i2c, uint32_t flags)
Clear one or more pending I2C interrupts.
void I2C_IntDisable (I2C_TypeDef *i2c, uint32_t flags)
Disable one or more I2C interrupts.
void I2C_IntEnable (I2C_TypeDef *i2c, uint32_t flags)
Enable one or more I2C interrupts.
uint32_t I2C_IntGet (I2C_TypeDef *i2c)
Get pending I2C interrupt flags.
uint32_t I2C_IntGetEnabled (I2C_TypeDef *i2c)
Get enabled and pending I2C interrupt flags.
void I2C_IntSet (I2C_TypeDef *i2c, uint32_t flags)
Set one or more pending I2C interrupts from SW.
void I2C_Reset (I2C_TypeDef *i2c)
Reset I2C to the same state that it was in after a hardware reset.
uint8_t I2C_SlaveAddressGet (I2C_TypeDef *i2c)
Get slave address used for I2C peripheral (when operating in slave mode).
void I2C_SlaveAddressSet (I2C_TypeDef *i2c, uint8_t addr)
Set slave address to use for I2C peripheral (when operating in slave mode).
uint8_t I2C_SlaveAddressMaskGet (I2C_TypeDef *i2c)
Get slave address mask used for I2C peripheral (when operating in slave mode).
void I2C_SlaveAddressMaskSet (I2C_TypeDef *i2c, uint8_t mask)
Set slave address mask used for I2C peripheral (when operating in slave mode).
I2C_TransferReturn_TypeDef I2C_Transfer (I2C_TypeDef *i2c)
Continue an initiated I2C transfer (single master mode only).
I2C_TransferReturn_TypeDef I2C_TransferInit (I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
Prepare and start an I2C transfer (single master mode only).

Macros

#define I2C_FREQ_STANDARD_MAX 92000
Standard mode max frequency assuming using 4:4 ratio for Nlow:Nhigh.
#define I2C_FREQ_FAST_MAX 392157
Fast mode max frequency assuming using 6:3 ratio for Nlow:Nhigh.
#define I2C_FREQ_FASTPLUS_MAX 987167
Fast mode+ max frequency assuming using 11:6 ratio for Nlow:Nhigh.