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