i2c.h 409 B

123456789101112131415161718192021
  1. #ifndef _I2C_H_
  2. #define _I2C_H_
  3. #define F_TWI 400000
  4. /* I2C Status */
  5. typedef enum {
  6. I2C_Ret_OK = 0,
  7. I2C_Ret_NACK = -1,
  8. I2C_Ret_ERR = -2,
  9. I2C_Ret_TOut = -3
  10. } i2c_status_t;
  11. void I2C_Init(void);
  12. void I2C_Close(void);
  13. void I2C_Start(void);
  14. void I2C_Stop(void);
  15. i2c_status_t I2C_WriteByte(const uint8_t data);
  16. i2c_status_t I2C_ReadByte(uint8_t *data, const uint8_t ack);
  17. #endif /* _I2C_H_ */