i2c.h 421 B

123456789101112131415161718192021222324252627
  1. #ifndef _I2C_H
  2. #define _I2C_H
  3. #include <avr/io.h>
  4. #define TRUE 1
  5. #define FALSE 0
  6. typedef enum {
  7. TWI_SUCCESS = 0,
  8. TWI_TIMEOUT,
  9. TWI_ERROR
  10. } twi_stats_t;
  11. typedef enum {
  12. TWI_ACK = 0,
  13. TWI_NACK
  14. } twi_ask_t;
  15. void I2C_Init(void);
  16. void I2C_Close(void);
  17. twi_stats_t I2C_Start(void);
  18. twi_stats_t I2C_Stop(void);
  19. twi_stats_t I2C_WriteByte(uint8_t data);
  20. twi_stats_t I2C_ReadByte(uint8_t *data, twi_ask_t ack);
  21. #endif