swi2c.h 815 B

12345678910111213141516171819202122
  1. #ifndef SWI2C_H
  2. #define SWI2C_H
  3. //initialize
  4. extern void swi2c_init(unsigned char sda, unsigned char scl, unsigned char cfg);
  5. //check device address acknowledge
  6. extern int swi2c_check(unsigned char dev_addr);
  7. //read write functions - 8bit address (most i2c chips)
  8. #ifdef SWI2C_A8
  9. extern int swi2c_readByte_A8(unsigned char dev_addr, unsigned char addr, unsigned char* pbyte);
  10. extern int swi2c_writeByte_A8(unsigned char dev_addr, unsigned char addr, unsigned char* pbyte);
  11. #endif //SWI2C_A8
  12. //read write functions - 16bit address (e.g. serial eeprom AT24C256)
  13. #ifdef SWI2C_A16
  14. extern int swi2c_readByte_A16(unsigned char dev_addr, unsigned short addr, unsigned char* pbyte);
  15. extern int swi2c_writeByte_A16(unsigned char dev_addr, unsigned short addr, unsigned char* pbyte);
  16. #endif //SWI2C_A16
  17. #endif //SWI2C_H