i2c_transfer.h 489 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __i2c_transfer_h__
  2. #define __i2c_transfer_h__
  3. #include "gpio_i2c.h"
  4. #define I2C_WRTIE 0
  5. #define I2C_READ 1
  6. typedef struct
  7. {
  8. int speed;
  9. } i2cConfig_t;
  10. typedef struct
  11. {
  12. int addr;
  13. int flags;
  14. int *buf;
  15. int len;
  16. } I2cMsg_t;
  17. typedef struct
  18. {
  19. int client_id;
  20. i2cConfig_t i2cConfig;
  21. }i2c_client_t;
  22. extern int i2cTransfer(const i2c_client_t i2cClient,const I2cMsg_t *i2cMsg);
  23. extern bool i2cProb(const i2c_port_t i2cPort,i2c_client_t i2cClient);
  24. #endif