## I2C Macro Definition Documentation

### I2C_CONFIG_MASK

#define I2C_CONFIG_MASK (((uint32_t)1U << I2C_CFG_CONNECT_IN_STANDBY_Pos) | \ ((uint32_t)1U << I2C_CFG_TX_DMA_ENABLE_Pos) | \ ((uint32_t)1U << I2C_CFG_RX_DMA_ENABLE_Pos) | \ ((uint32_t)1U << I2C_CFG_TX_INT_ENABLE_Pos) | \ ((uint32_t)1U << I2C_CFG_RX_INT_ENABLE_Pos) | \ ((uint32_t)1U << I2C_CFG_BUS_ERROR_INT_ENABLE_Pos) | \ (1U << I2C_CFG_OVERRUN_INT_ENABLE_Pos) | \ (1U << I2C_CFG_STOP_INT_ENABLE_Pos) | \ (1U << I2C_CFG_AUTO_ACK_ENABLE_Pos) | \ I2C_CFG_SLAVE_PRESCALE_Mask | \ I2C_CFG_MASTER_PRESCALE_Mask | \ I2C_CFG_SLAVE_ADDRESS_Mask | \ (1U << I2C_CFG_SLAVE_Pos))

Mask for the I2C_CFG register.

Location: i2c.h:41

### I2C_PADS_NUM

#define I2C_PADS_NUM 2U

Number of pads used for the I2C interface, for a single instance.

Location: i2c.h:57

### SYS_I2C_GPIOCONFIG

#define SYS_I2C_GPIOCONFIG Sys_I2C_GPIOConfig(I2C, (config), (scl), (sda))

Macro wrapper for Sys_I2C_GPIOConfig() Configure two GPIOs for the specified I2C interface.

Location: i2c.h:206

Parameters

Direction | Name | Description
--- | --- | ---
in | config | GPIO pin configuration for the I2C pads
in | scl | GPIO to use as the I2C transmit pad; use an integer
in | sda | GPIO to use as the I2C receive pad; use an integer

Example Code for SYS_I2C_GPIOCONFIG
// Configure GPIO3 and GPIO4 as SCL and SDA, enable 1 kOhm pull-up resistors, // and disable low-pass filter for default I2C interface SYS_I2C_GPIOCONFIG((GPIO_LPF_DISABLE | GPIO_1K_PULL_UP), GPIO3, GPIO4);

### SYS_I2C_CONFIG

#define SYS_I2C_CONFIG Sys_I2C_Config(I2C, (config))

Macro wrapper for Sys_I2C_Config() Apply I2C Master mode related configuration.

Location: i2c.h:229

Parameters

Direction | Name | Description
--- | --- | ---
in | config | I2C configurations for master mode; use I2C_[CONNECT | DISCONNECT]_IN_STANDBY, I2C_TX_DMA_[ENABLE | DISABLE] I2C_RX_DMA_[ENABLE | DISABLE] I2C_TX_INT_[ENABLE | DISABLE] I2C_RX_INT_[ENABLE | DISABLE] I2C_BUS_ERROR_INT_[ENABLE | DISABLE] I2C_OVERRUN_INT_[ENABLE | DISABLE] I2C_STOP_INT_[ENABLE | DISABLE] I2C_AUTO_ACK_[ENABLE | DISABLE] I2C_MASTER_PRESCALE_*, I2C_SLAVE_PRESCALE_*, a slave address constant shifted to I2C_CTRL0_SLAVE_ADDRESS_Pos, I2C_SLAVE_[ENABLE | DISABLE]

Example Code for SYS_I2C_CONFIG
// Apply I2C Master mode related configuration for default I2C interface // Set up prescaler, auto acknowledge, interrupt, and slave enable SYS_I2C_CONFIG((I2C_SLAVE_PRESCALE_4 | I2C_AUTO_ACK_ENABLE | I2C_RX_INT_ENABLE | I2C_TX_INT_ENABLE | I2C_STOP_INT_ENABLE | I2C_OVERRUN_INT_ENABLE | I2C_BUS_ERROR_INT_ENABLE | I2C_SLAVE_ENABLE | (64 << I2C_CFG_SLAVE_ADDRESS_Pos)));

### SYS_I2C_STARTREAD

#define SYS_I2C_STARTREAD Sys_I2C_StartRead(I2C, (addr))

Macro wrapper for Sys_I2C_StartRead() Send slave address on the bus with a read request.

Location: i2c.h:237

Parameters

Direction | Name | Description
--- | --- | ---
in | addr | I2C address to use for write transaction

Example Code for SYS_I2C_STARTREAD
// Send slave address 64 on the default I2C bus with a read request SYS_I2C_STARTREAD(64);

### SYS_I2C_STARTWRITE

#define SYS_I2C_STARTWRITE Sys_I2C_StartWrite(I2C, (addr))

Macro wrapper for Sys_I2C_StartWrite() Send slave address on the bus with a write request.

Location: i2c.h:245

Parameters

Direction | Name | Description
--- | --- | ---
in | addr | I2C address to use for write transaction

Example Code for SYS_I2C_STARTWRITE
// Send slave address 64 on the default I2C bus with a write request SYS_I2C_STARTWRITE(64);

### SYS_I2C_ACK

#define SYS_I2C_ACK Sys_I2C_ACK(I2C)

Macro wrapper for Sys_I2C_ACK() Issue an ACK on the I2C interface.

Location: i2c.h:252

Example Code for SYS_I2C_ACK
// Issue a ACK on the default I2C interface SYS_I2C_ACK();

### SYS_I2C_NACK

#define SYS_I2C_NACK Sys_I2C_NACK(I2C)

Macro wrapper for Sys_I2C_NACK() Issue a NACK on the I2C interface.

Location: i2c.h:259

Example Code for SYS_I2C_NACK
// Issue a NACK on the default I2C interface SYS_I2C_NACK();

### SYS_I2C_LASTDATA

#define SYS_I2C_LASTDATA Sys_I2C_LastData(I2C)

Macro wrapper for Sys_I2C_LastData() Indicate that the current data is the last byte.

Location: i2c.h:266

Example Code for SYS_I2C_LASTDATA
//Indicate that the current data is the last byte SYS_I2C_LASTDATA();

### SYS_I2C_RESET

#define SYS_I2C_RESET Sys_I2C_Reset(I2C)

Macro wrapper for Sys_I2C_Reset() Reset the I2C interface.

Location: i2c.h:273

Example Code for SYS_I2C_RESET
// Reset the default I2C interface SYS_I2C_RESET();

### SYS_I2C_NACKANDSTOP

#define SYS_I2C_NACKANDSTOP Sys_I2C_NackAndStop(I2C)

Macro wrapper for Sys_I2C_NackAndStop() Issue a NACK followed by a Stop condition on I2C bus.

Location: i2c.h:280

Example Code for SYS_I2C_NACKANDSTOP
// Issue a NACK followed by a Stop condition on default I2C bus SYS_I2C_NACKANDSTOP();