diff options
author | Ryan Caltabiano <rcalt2vt@gmail.com> | 2019-04-15 22:32:57 -0500 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-04-22 09:55:39 -0700 |
commit | 95f8ac3424871c1ffed11e51f5fba66a192daeb0 (patch) | |
tree | c24fdff8dd91915679ecf8e5d1537698bc883275 /drivers/arm/i2c_master.h | |
parent | 0a04a0e4191419455fadfeadaaec6696d9dea890 (diff) |
OLED Driver Feature
Diffstat (limited to 'drivers/arm/i2c_master.h')
-rw-r--r-- | drivers/arm/i2c_master.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h index 4ab2301f8c..a15f1702dd 100644 --- a/drivers/arm/i2c_master.h +++ b/drivers/arm/i2c_master.h @@ -40,11 +40,17 @@ #define I2C_DRIVER I2CD1 #endif +typedef int16_t i2c_status_t; + +#define I2C_STATUS_SUCCESS (0) +#define I2C_STATUS_ERROR (-1) +#define I2C_STATUS_TIMEOUT (-2) + void i2c_init(void); -uint8_t i2c_start(uint8_t address); -uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); -uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -uint8_t i2c_stop(void); +i2c_status_t i2c_start(uint8_t address); +i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_transmit_receive(uint8_t address, uint8_t * tx_body, uint16_t tx_length, uint8_t * rx_body, uint16_t rx_length); +i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); +i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t* regaddr, uint8_t* data, uint16_t length, uint16_t timeout); +void i2c_stop(void); |