I2C.h 1.1 KB

12345678910111213141516171819202122232425262728
  1. /*
  2. * I2C.h
  3. * k4be 2022
  4. * License: BSD
  5. */
  6. #ifndef I2C_H_
  7. #define I2C_H_
  8. #define MAX_REPEAT_I2C 3
  9. #include <avr/io.h>
  10. #include <util/delay.h>
  11. #include "I2C.h"
  12. #include "main.h"
  13. void I2C_init(void);
  14. unsigned int I2C_SendCommand(unsigned char address, unsigned char command, unsigned char data);
  15. unsigned int I2C_SendCommand3byte(unsigned char address,unsigned char command, unsigned char data0, unsigned char data1);
  16. unsigned int I2C_ReceiveCommand(unsigned char address,unsigned char command, unsigned char *data);
  17. unsigned int I2C_ReceiveCommand3byte(unsigned char address, unsigned char command, unsigned char *data0, unsigned char *data1);
  18. unsigned int I2C_SendOneCommandByte(unsigned char command);
  19. unsigned int I2C_ReceiveOneCommandByte(unsigned char *command, unsigned char ack);
  20. unsigned int I2C_WaitForTWInt(void);
  21. unsigned int I2C_Receive_n_bytes(unsigned char address, unsigned char command, unsigned char *data, unsigned int length);
  22. unsigned int I2C_Send_n_bytes(unsigned char address,unsigned char command, const unsigned char *data, unsigned int length);
  23. #endif /* I2C_H_ */