#pragma once #ifndef I2C_H #define I2C_H /* I2C Status */ #define I2C_RET_OK (int8_t)0 #define I2C_RET_NACK (int8_t)-1 #define I2C_RET_ERR (int8_t)-2 typedef enum { I2C_Ret_OK = 0, I2C_Ret_NACK = -1, I2C_Ret_ERR = -2 } i2c_status_t; int8_t i2c_check_err(void); int8_t user_i2c_read(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len); int8_t user_i2c_write(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len); #endif // I2C_H