aboutsummaryrefslogtreecommitdiff
path: root/include/libopencm3/lpc43xx/i2c.h
diff options
context:
space:
mode:
authorMichael Ossmann2012-06-04 17:30:08 -0600
committerMichael Ossmann2012-06-04 17:30:08 -0600
commit569801687744d5f4f4157ea186a8a6c1d159d285 (patch)
tree4d08d392f4df95d7a1a6cd7350091d12b0c05478 /include/libopencm3/lpc43xx/i2c.h
parent44db38301c2a6f7eefa8b7acc68eb0a5e46ec4d5 (diff)
moved stuff out of i2cdemo.c and into drivers/headers
Diffstat (limited to 'include/libopencm3/lpc43xx/i2c.h')
-rw-r--r--include/libopencm3/lpc43xx/i2c.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/include/libopencm3/lpc43xx/i2c.h b/include/libopencm3/lpc43xx/i2c.h
index 1fe7655..249962c 100644
--- a/include/libopencm3/lpc43xx/i2c.h
+++ b/include/libopencm3/lpc43xx/i2c.h
@@ -29,7 +29,6 @@
#define I2C0 I2C0_BASE
#define I2C1 I2C1_BASE
-
/* --- I2C registers ------------------------------------------------------- */
/* I2C Control Set Register */
@@ -112,4 +111,32 @@
#define I2C0_MASK3 I2C_MASK3(I2C0)
#define I2C1_MASK3 I2C_MASK3(I2C1)
+/* --- I2Cx_CONCLR values -------------------------------------------------- */
+
+#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 */
+
+/* --- I2Cx_CONSET values -------------------------------------------------- */
+
+#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 */
+
+/* --- I2C const definitions ----------------------------------------------- */
+
+#define I2C_WRITE 0
+#define I2C_READ 1
+
+/* --- I2C funtion prototypes----------------------------------------------- */
+
+void i2c0_init(void);
+void i2c0_tx_start(void);
+void i2c0_tx_byte(u8 byte);
+u8 i2c0_rx_byte(void);
+void i2c0_stop(void);
+
#endif