From 7b006d6f2032ac46074d693ae59a971bee327ace Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Fri, 9 Sep 2022 18:33:15 -0500 Subject: init --- src/i2c.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/i2c.h (limited to 'src/i2c.h') 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 +#include + +#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 -- cgit v1.2.3