i2c.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. \file i2c.h
  3. \author G. Icking-Konert
  4. \date 2013-11-22
  5. \version 0.1
  6. \brief declaration of I2C functions/macros
  7. declaration of functions for I2C bus communication
  8. For I2C bus, see http://en.wikipedia.org/wiki/I2C
  9. */
  10. /*-----------------------------------------------------------------------------
  11. MODULE DEFINITION FOR MULTIPLE INCLUSION
  12. -----------------------------------------------------------------------------*/
  13. #ifndef _I2C_H_
  14. #define _I2C_H_
  15. /*-----------------------------------------------------------------------------
  16. DECLARATION OF GLOBAL FUNCTIONS
  17. -----------------------------------------------------------------------------*/
  18. /// configure I2C bus as master in standard mode
  19. void i2c_init(void);
  20. /// wait until bus is free
  21. uint8_t i2c_waitFree(void);
  22. /// generate I2C start condition
  23. uint8_t i2c_start(void);
  24. /// generate I2C stop condition
  25. uint8_t i2c_stop(void);
  26. /// write data via I2C
  27. uint8_t i2c_send(uint8_t addr, uint8_t numTx, uint8_t *Tx);
  28. /// request data via I2C as master
  29. uint8_t i2c_request(uint8_t addr, uint8_t numRx, uint8_t *Rx);
  30. /*-----------------------------------------------------------------------------
  31. END OF MODULE DEFINITION FOR MULTIPLE INLUSION
  32. -----------------------------------------------------------------------------*/
  33. #endif // _I2C_H_