i2c.h 457 B

1234567891011121314151617181920
  1. #pragma once
  2. #ifndef I2C_H
  3. #define I2C_H
  4. /* I2C Status */
  5. #define I2C_RET_OK (int8_t)0
  6. #define I2C_RET_NACK (int8_t)-1
  7. #define I2C_RET_ERR (int8_t)-2
  8. typedef enum {
  9. I2C_Ret_OK = 0,
  10. I2C_Ret_NACK = -1,
  11. I2C_Ret_ERR = -2
  12. } i2c_status_t;
  13. int8_t i2c_check_err(void);
  14. int8_t user_i2c_read(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len);
  15. int8_t user_i2c_write(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len);
  16. #endif // I2C_H