summaryrefslogtreecommitdiff
path: root/src/i2c.h
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2022-09-09 18:33:15 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2022-09-09 18:33:15 -0500
commit7b006d6f2032ac46074d693ae59a971bee327ace (patch)
tree60963598d99001e0850e34d6271db8bd65e04fa4 /src/i2c.h
init
Diffstat (limited to 'src/i2c.h')
-rw-r--r--src/i2c.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/i2c.h b/src/i2c.h
new file mode 100644
index 0000000..c5d5034
--- /dev/null
+++ b/src/i2c.h
@@ -0,0 +1,25 @@
+#ifndef __I2C_H
+#define __I2C_H
+
+#include <stddef.h>
+#include <stdbool.h>
+
+#define I2C_WRITE 0
+#define I2C_READ 1
+
+//higher level functions write registers
+//TODO rename if we end up only using for screen
+void i2c_write_reg(uint8_t device_addr, uint8_t device_reg, uint8_t value);
+void i2c_write_reg_multi(uint8_t device_addr, uint8_t device_reg, size_t len, uint8_t *values);
+
+//for drivers with weird i2c processes
+void i2c_send(uint8_t byte);
+uint8_t i2c_recv();
+void i2c_stop();
+void i2c_start(uint8_t addr, bool rw);
+uint8_t i2c_read_reg_addr16(uint8_t device, uint16_t addr);
+
+void i2c_init();
+
+
+#endif