i2c_master_poll.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. ******************************************************************************
  3. * @file i2c_opt.h
  4. * @author MCD Application Team
  5. * @version V0.0.3
  6. * @date Feb 2010
  7. * @brief This file contains definitions for optimized I2C software
  8. ******************************************************************************
  9. *
  10. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  11. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  12. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  13. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  14. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  15. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  16. *
  17. * COPYRIGHT 2009 STMicroelectronics
  18. */
  19. /* Define to prevent recursive inclusion */
  20. #ifndef __I2C_OPT_H
  21. #define __I2C_OPT_H
  22. #include "stm8s.h"
  23. // ************************** I2C Configuration Variables **************************
  24. /* definition of fast or default standard mode (bus speed up to 400 or 100 kHz) */
  25. #define FAST_I2C_MODE
  26. /* uncomment next line when stop request is required between device address sent and read data */
  27. //#define NO_RESTART
  28. #define SLAVE_ADDRESS 0x40
  29. // ************************* Function Declaration ***************************
  30. void I2C_Init(void);
  31. void I2C_ReadRegister(u8 u8_regAddr, u8 u8_NumByteToRead, u8 *u8_ReadBuffer);
  32. void I2C_WriteRegister(u8 u8_regAddr, u8 u8_NumByteToWrite, u8 *u8_DataBuffer);
  33. void I2C_ReadBytes(u8 Addr, u8 NumByteToRead, u8 *ReadBuffer);
  34. void I2C_WriteBytes(u8 Addr, u8 NumByteToWrite, u8 *DataBuffer);
  35. #endif /* __I2C_OPT_H */
  36. /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/