libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
I2C Defines

Defined Constants and Types for the LPC43xx I2C More...

Collaboration diagram for I2C Defines:

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)
 

Detailed Description

Defined Constants and Types for the LPC43xx I2C

Version
1.0.0
Author
© 2012 Michael Ossmann mike@.nosp@m.ossm.nosp@m.ann.c.nosp@m.om
Date
10 March 2013

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ I2C0

#define I2C0   I2C0_BASE

Definition at line 45 of file i2c.h.

◆ I2C0_ADR0

#define I2C0_ADR0   I2C_ADR0(I2C0)

Definition at line 67 of file i2c.h.

◆ I2C0_ADR1

#define I2C0_ADR1   I2C_ADR1(I2C0)

Definition at line 92 of file i2c.h.

◆ I2C0_ADR2

#define I2C0_ADR2   I2C_ADR2(I2C0)

Definition at line 97 of file i2c.h.

◆ I2C0_ADR3

#define I2C0_ADR3   I2C_ADR3(I2C0)

Definition at line 102 of file i2c.h.

◆ I2C0_CONCLR

#define I2C0_CONCLR   I2C_CONCLR(I2C0)

Definition at line 82 of file i2c.h.

◆ I2C0_CONSET

#define I2C0_CONSET   I2C_CONSET(I2C0)

Definition at line 52 of file i2c.h.

◆ I2C0_DAT

#define I2C0_DAT   I2C_DAT(I2C0)

Definition at line 62 of file i2c.h.

◆ I2C0_DATA_BUFFER

#define I2C0_DATA_BUFFER   I2C_DATA_BUFFER(I2C0)

Definition at line 107 of file i2c.h.

◆ I2C0_MASK0

#define I2C0_MASK0   I2C_MASK0(I2C0)

Definition at line 112 of file i2c.h.

◆ I2C0_MASK1

#define I2C0_MASK1   I2C_MASK1(I2C0)

Definition at line 117 of file i2c.h.

◆ I2C0_MASK2

#define I2C0_MASK2   I2C_MASK2(I2C0)

Definition at line 122 of file i2c.h.

◆ I2C0_MASK3

#define I2C0_MASK3   I2C_MASK3(I2C0)

Definition at line 127 of file i2c.h.

◆ I2C0_MMCTRL

#define I2C0_MMCTRL   I2C_MMCTRL(I2C0)

Definition at line 87 of file i2c.h.

◆ I2C0_SCLH

#define I2C0_SCLH   I2C_SCLH(I2C0)

Definition at line 72 of file i2c.h.

◆ I2C0_SCLL

#define I2C0_SCLL   I2C_SCLL(I2C0)

Definition at line 77 of file i2c.h.

◆ I2C0_STAT

#define I2C0_STAT   I2C_STAT(I2C0)

Definition at line 57 of file i2c.h.

◆ I2C1

#define I2C1   I2C1_BASE

Definition at line 46 of file i2c.h.

◆ I2C1_ADR0

#define I2C1_ADR0   I2C_ADR0(I2C1)

Definition at line 68 of file i2c.h.

◆ I2C1_ADR1

#define I2C1_ADR1   I2C_ADR1(I2C1)

Definition at line 93 of file i2c.h.

◆ I2C1_ADR2

#define I2C1_ADR2   I2C_ADR2(I2C1)

Definition at line 98 of file i2c.h.

◆ I2C1_ADR3

#define I2C1_ADR3   I2C_ADR3(I2C1)

Definition at line 103 of file i2c.h.

◆ I2C1_CONCLR

#define I2C1_CONCLR   I2C_CONCLR(I2C1)

Definition at line 83 of file i2c.h.

◆ I2C1_CONSET

#define I2C1_CONSET   I2C_CONSET(I2C1)

Definition at line 53 of file i2c.h.

◆ I2C1_DAT

#define I2C1_DAT   I2C_DAT(I2C1)

Definition at line 63 of file i2c.h.

◆ I2C1_DATA_BUFFER

#define I2C1_DATA_BUFFER   I2C_DATA_BUFFER(I2C1)

Definition at line 108 of file i2c.h.

◆ I2C1_MASK0

#define I2C1_MASK0   I2C_MASK0(I2C1)

Definition at line 113 of file i2c.h.

◆ I2C1_MASK1

#define I2C1_MASK1   I2C_MASK1(I2C1)

Definition at line 118 of file i2c.h.

◆ I2C1_MASK2

#define I2C1_MASK2   I2C_MASK2(I2C1)

Definition at line 123 of file i2c.h.

◆ I2C1_MASK3

#define I2C1_MASK3   I2C_MASK3(I2C1)

Definition at line 128 of file i2c.h.

◆ I2C1_MMCTRL

#define I2C1_MMCTRL   I2C_MMCTRL(I2C1)

Definition at line 88 of file i2c.h.

◆ I2C1_SCLH

#define I2C1_SCLH   I2C_SCLH(I2C1)

Definition at line 73 of file i2c.h.

◆ I2C1_SCLL

#define I2C1_SCLL   I2C_SCLL(I2C1)

Definition at line 78 of file i2c.h.

◆ I2C1_STAT

#define I2C1_STAT   I2C_STAT(I2C1)

Definition at line 58 of file i2c.h.

◆ I2C_ADR0

#define I2C_ADR0 (   port)    MMIO32((port) + 0x00C)

Definition at line 66 of file i2c.h.

◆ I2C_ADR1

#define I2C_ADR1 (   port)    MMIO32((port) + 0x020)

Definition at line 91 of file i2c.h.

◆ I2C_ADR2

#define I2C_ADR2 (   port)    MMIO32((port) + 0x024)

Definition at line 96 of file i2c.h.

◆ I2C_ADR3

#define I2C_ADR3 (   port)    MMIO32((port) + 0x028)

Definition at line 101 of file i2c.h.

◆ I2C_CONCLR

#define I2C_CONCLR (   port)    MMIO32((port) + 0x018)

Definition at line 81 of file i2c.h.

◆ I2C_CONCLR_AAC

#define I2C_CONCLR_AAC   (1 << 2) /* Assert acknowledge Clear */

Definition at line 132 of file i2c.h.

◆ I2C_CONCLR_I2ENC

#define I2C_CONCLR_I2ENC   (1 << 6) /* I2C interface Disable bit */

Definition at line 135 of file i2c.h.

◆ I2C_CONCLR_SIC

#define I2C_CONCLR_SIC   (1 << 3) /* I2C interrupt Clear */

Definition at line 133 of file i2c.h.

◆ I2C_CONCLR_STAC

#define I2C_CONCLR_STAC   (1 << 5) /* START flag Clear */

Definition at line 134 of file i2c.h.

◆ I2C_CONSET

#define I2C_CONSET (   port)    MMIO32((port) + 0x000)

Definition at line 51 of file i2c.h.

◆ I2C_CONSET_AA

#define I2C_CONSET_AA   (1 << 2) /* Assert acknowledge flag */

Definition at line 139 of file i2c.h.

◆ I2C_CONSET_I2EN

#define I2C_CONSET_I2EN   (1 << 6) /* I2C interface enable */

Definition at line 143 of file i2c.h.

◆ I2C_CONSET_SI

#define I2C_CONSET_SI   (1 << 3) /* I2C interrupt flag */

Definition at line 140 of file i2c.h.

◆ I2C_CONSET_STA

#define I2C_CONSET_STA   (1 << 5) /* START flag */

Definition at line 142 of file i2c.h.

◆ I2C_CONSET_STO

#define I2C_CONSET_STO   (1 << 4) /* STOP flag */

Definition at line 141 of file i2c.h.

◆ I2C_DAT

#define I2C_DAT (   port)    MMIO32((port) + 0x008)

Definition at line 61 of file i2c.h.

◆ I2C_DATA_BUFFER

#define I2C_DATA_BUFFER (   port)    MMIO32((port) + 0x02C)

Definition at line 106 of file i2c.h.

◆ I2C_MASK0

#define I2C_MASK0 (   port)    MMIO32((port) + 0x030)

Definition at line 111 of file i2c.h.

◆ I2C_MASK1

#define I2C_MASK1 (   port)    MMIO32((port) + 0x034)

Definition at line 116 of file i2c.h.

◆ I2C_MASK2

#define I2C_MASK2 (   port)    MMIO32((port) + 0x038)

Definition at line 121 of file i2c.h.

◆ I2C_MASK3

#define I2C_MASK3 (   port)    MMIO32((port) + 0x03C)

Definition at line 126 of file i2c.h.

◆ I2C_MMCTRL

#define I2C_MMCTRL (   port)    MMIO32((port) + 0x01C)

Definition at line 86 of file i2c.h.

◆ I2C_READ

#define I2C_READ   1

Definition at line 148 of file i2c.h.

◆ I2C_SCLH

#define I2C_SCLH (   port)    MMIO32((port) + 0x010)

Definition at line 71 of file i2c.h.

◆ I2C_SCLL

#define I2C_SCLL (   port)    MMIO32((port) + 0x014)

Definition at line 76 of file i2c.h.

◆ I2C_STAT

#define I2C_STAT (   port)    MMIO32((port) + 0x004)

Definition at line 56 of file i2c.h.

◆ I2C_WRITE

#define I2C_WRITE   0

Definition at line 147 of file i2c.h.

Function Documentation

◆ i2c0_init()

void i2c0_init ( const uint16_t  duty_cycle_count)

◆ i2c0_rx_byte()

uint8_t i2c0_rx_byte ( void  )

◆ i2c0_stop()

void i2c0_stop ( void  )

◆ i2c0_tx_byte()

void i2c0_tx_byte ( uint8_t  byte)

◆ i2c0_tx_start()

void i2c0_tx_start ( void  )