i2c.h 493 B

12345678910111213141516171819202122
  1. #pragma once
  2. #ifndef _I2C_H_
  3. #define _I2C_H_
  4. /* Includes */
  5. #include "main.h"
  6. /* Exported typedefs */
  7. /** @brief I2C return Status */
  8. typedef enum t_i2c_status {
  9. I2C_Ret_OK = 0,
  10. I2C_Ret_NACK,
  11. I2C_Ret_Bsy,
  12. I2C_Ret_Tout,
  13. I2C_Ret_Err
  14. } i2c_status_t;
  15. /* Exported function prototypes */
  16. i2c_status_t user_i2c_read(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len);
  17. i2c_status_t user_i2c_write(uint8_t id, uint8_t reg_addr, uint8_t *data, uint16_t len);
  18. #endif /* _I2C_H_ */