#ifndef IS31_IIC_MASTER_H_
#define IS31_IIC_MASTER_H_

#include "gpio.h"
#define                 IS31_IIC_WaitOverTime                  50

#define  IIC_ACCESS_PORT_REG_DIRECT


#define SCL_LED_DRIVER_PORT PORT7
#define SCL_LED_DRIVER_PIN 	PIN5
#define SDA_LED_DRIVER_PORT PORT7
#define SDA_LED_DRIVER_PIN 	PIN4




/******************************************************************************

******************************************************************************/

//#define   IIC_SDAGet             PORT_GetBit(SEG_LED_SD);



//#define IS31_IIC_SCL_Dir_Out    PORT_Init(SEG_LED_SCL, OPENDRAIN_OUTPUT);
//#define IS31_IIC_SCL_Dir_In     PORT_Init(SEG_LED_SCL, INPUT);
//#define IS31_IIC_SDA_Dir_Out    PORT_Init(SEG_LED_SD, OPENDRAIN_OUTPUT);
//#define IS31_IIC_SDA_Dir_In     PORT_Init(SEG_LED_SD, INPUT);
//#define IS31_IIC_SDB_Dir_Out    PORT_Init(SEG_LED_CSB, OUTPUT);


//#define IS31_IIC_SCL_HIGH       PORT_SetBit(SEG_LED_SCL);  
//#define IS31_IIC_SCL_LOW        PORT_ClrBit(SEG_LED_SCL);
//#define IS31_IIC_SDA_HIGH       PORT_SetBit(SEG_LED_SD);  
//#define IS31_IIC_SDA_LOW        PORT_ClrBit(SEG_LED_SD);
//#define IS31_IIC_SDB_HIGH       PORT_SetBit(SEG_LED_CSB);
//#define IS31_IIC_SDB_LOW        PORT_ClrBit(SEG_LED_CSB);



extern uint8_t IIC_SDAGet (void);
extern void IS31_IIC_SCL_Dir_Out(void);
extern void IS31_IIC_SCL_Dir_In(void);
extern void IS31_IIC_SDA_Dir_Out(void);
extern void IS31_IIC_SDA_Dir_In(void);
extern void  bsp_IIC_SDA_out( uint8_t dat ) ;
extern void  bsp_IIC_SCL_out( uint8_t dat ); 





/******************************************************************************

******************************************************************************/
extern void      Simulated_IIC_2_Init(void);

extern void      IS31_IIC_delay(uint32_t time);
extern void      IS31_IIC_Start(void);
extern void      IS31_IIC_Stop(void);
extern void      IS31_IIC_NACK(void);
extern void      IS31_IIC_ACK(void);
extern void      IS31_IIC_SendByte(uint8_t Data);
extern uint8_t     IS31_IIC_ReadByte(void);
extern uint8_t     IS31_IIC_WaitAck(void);
extern void      Simulated_Release_SCL(void);
extern void 			bsp_IIC_nop(void);
#endif
