/*************************************************************************************/
/*                                                                                   */
/* Header für Software I2C Routinen auf GP32                                         */
/* Zwobot hat eine Porterweitrung mit PCF8574 I2C 8 Bit Port Expander                */
/*                                                                                   */
/*                                                                                   */
/*                                                                                   */
/*************************************************************************************/

#ifndef __I2C_H_
#define __I2C_H_

/***************/
/* I2C defines */
/***************/


/* data	 is auf PortC Bit 0 */

#define SET_DATA_TO_OUTPUT DDRC_DDRC0 = 1
#define SET_DATA_TO_INPUT  DDRC_DDRC0 = 0
#define RESET_SDA PTC_PTC0 = 0
#define SET_SDA PTC_PTC0 = 1
#define READ_SDA PTC_PTC0

/* clock ist PortC Bit 1 */

#define SET_CLOCK_TO_OUTPUT DDRC_DDRC1 = 1
#define RESET_SCL PTC_PTC1 = 0
#define SET_SCL PTC_PTC1 = 1



#define BASE_ADDRESS_0 0x40
#define BASE_ADDRESS_1 0x41

void SetUpAndHoldTimingDelay( void );
unsigned char WaitForI2CAcknowledge( void );
void SendI2CAcknowledge( void );
unsigned char CarryFlagCheck( void );
void SendI2CByte( unsigned char );
unsigned char GetI2CByte( void );
void OutClock( void );
void StartBit( void );
unsigned char InClock( void );
void StopBit( void );
unsigned char PCF8574Read(void);
#endif

