libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
i2c.h File Reference
Include dependency graph for i2c.h:

Go to the source code of this file.

Macros

#define I2C0   I2C0_BASE
 
#define I2C1   I2C1_BASE
 
#define I2C_CONSET(port)   MMIO32((port) + 0x000)
 
#define I2C0_CONSET   I2C_CONSET(I2C0)
 
#define I2C1_CONSET   I2C_CONSET(I2C1)
 
#define I2C_STAT(port)   MMIO32((port) + 0x004)
 
#define I2C0_STAT   I2C_STAT(I2C0)
 
#define I2C1_STAT   I2C_STAT(I2C1)
 
#define I2C_DAT(port)   MMIO32((port) + 0x008)
 
#define I2C0_DAT   I2C_DAT(I2C0)
 
#define I2C1_DAT   I2C_DAT(I2C1)
 
#define I2C_ADR0(port)   MMIO32((port) + 0x00C)
 
#define I2C0_ADR0   I2C_ADR0(I2C0)
 
#define I2C1_ADR0   I2C_ADR0(I2C1)
 
#define I2C_SCLH(port)   MMIO32((port) + 0x010)
 
#define I2C0_SCLH   I2C_SCLH(I2C0)
 
#define I2C1_SCLH   I2C_SCLH(I2C1)
 
#define I2C_SCLL(port)   MMIO32((port) + 0x014)
 
#define I2C0_SCLL   I2C_SCLL(I2C0)
 
#define I2C1_SCLL   I2C_SCLL(I2C1)
 
#define I2C_CONCLR(port)   MMIO32((port) + 0x018)
 
#define I2C0_CONCLR   I2C_CONCLR(I2C0)
 
#define I2C1_CONCLR   I2C_CONCLR(I2C1)
 
#define I2C_MMCTRL(port)   MMIO32((port) + 0x01C)
 
#define I2C0_MMCTRL   I2C_MMCTRL(I2C0)
 
#define I2C1_MMCTRL   I2C_MMCTRL(I2C1)
 
#define I2C_ADR1(port)   MMIO32((port) + 0x020)
 
#define I2C0_ADR1   I2C_ADR1(I2C0)
 
#define I2C1_ADR1   I2C_ADR1(I2C1)
 
#define I2C_ADR2(port)   MMIO32((port) + 0x024)
 
#define I2C0_ADR2   I2C_ADR2(I2C0)
 
#define I2C1_ADR2   I2C_ADR2(I2C1)
 
#define I2C_ADR3(port)   MMIO32((port) + 0x028)
 
#define I2C0_ADR3   I2C_ADR3(I2C0)
 
#define I2C1_ADR3   I2C_ADR3(I2C1)
 
#define I2C_DATA_BUFFER(port)   MMIO32((port) + 0x02C)
 
#define I2C0_DATA_BUFFER   I2C_DATA_BUFFER(I2C0)
 
#define I2C1_DATA_BUFFER   I2C_DATA_BUFFER(I2C1)
 
#define I2C_MASK0(port)   MMIO32((port) + 0x030)
 
#define I2C0_MASK0   I2C_MASK0(I2C0)
 
#define I2C1_MASK0   I2C_MASK0(I2C1)
 
#define I2C_MASK1(port)   MMIO32((port) + 0x034)
 
#define I2C0_MASK1   I2C_MASK1(I2C0)
 
#define I2C1_MASK1   I2C_MASK1(I2C1)
 
#define I2C_MASK2(port)   MMIO32((port) + 0x038)
 
#define I2C0_MASK2   I2C_MASK2(I2C0)
 
#define I2C1_MASK2   I2C_MASK2(I2C1)
 
#define I2C_MASK3(port)   MMIO32((port) + 0x03C)
 
#define I2C0_MASK3   I2C_MASK3(I2C0)
 
#define I2C1_MASK3   I2C_MASK3(I2C1)
 
#define I2C_CONCLR_AAC   (1 << 2) /* Assert acknowledge Clear */
 
#define I2C_CONCLR_SIC   (1 << 3) /* I2C interrupt Clear */
 
#define I2C_CONCLR_STAC   (1 << 5) /* START flag Clear */
 
#define I2C_CONCLR_I2ENC   (1 << 6) /* I2C interface Disable bit */
 
#define I2C_CONSET_AA   (1 << 2) /* Assert acknowledge flag */
 
#define I2C_CONSET_SI   (1 << 3) /* I2C interrupt flag */
 
#define I2C_CONSET_STO   (1 << 4) /* STOP flag */
 
#define I2C_CONSET_STA   (1 << 5) /* START flag */
 
#define I2C_CONSET_I2EN   (1 << 6) /* I2C interface enable */
 
#define I2C_WRITE   0
 
#define I2C_READ   1
 

Functions

void i2c0_init (const uint16_t duty_cycle_count)
 
void i2c0_tx_start (void)
 
void i2c0_tx_byte (uint8_t byte)
 
uint8_t i2c0_rx_byte (void)
 
void i2c0_stop (void)