/***************************************************************************/
/*  Name      : P.H. Seerden                                               */
/*                                                                         */
/*            (C) Copyright 2010 NXP Semiconductors B.V.                   */
/*                                                                         */
/***************************************************************************/
/*                                                                         */
/*  Description:                                                           */
/*                                                                         */
/*  This module consists a number of exported declarations of the I2C      */
/*  driver package. Include this module in your source file if you want    */
/*  to make use of one of the interface functions of the package.          */
/*                                                                         */
/***************************************************************************/

#define SLA_PCA9500_IO         0x40    // I2C address of PCA9500 I/O port

typedef unsigned char          BYTE;
typedef unsigned short         WORD;
typedef unsigned long          LONG;

typedef struct
{
    BYTE   address;                    // slave address to sent/receive message
    BYTE   nrBytes;                    // number of bytes in message buffer
    BYTE   *buf;                       // pointer to I2C message buffer
    LONG   next;                       // address of next I2C message in chain
} I2C_MSG;

#define I2C_OK                 0       // transfer ended No Errors
#define I2C_BUSY               1       // transfer busy
#define I2C_ERR                2       // err: general error
#define I2C_NO_DATA            3       // err: No data in block
#define I2C_NACK_ON_DATA       4       // err: No ack on data
#define I2C_NACK_ON_ADDRESS    5       // err: No ack on address
#define I2C_DEVICE_NOT_PRESENT 6       // err: Device not present
#define I2C_ARBITRATION_LOST   7       // err: Arbitration lost
#define I2C_TIME_OUT           8       // err: Time out occurred
#define I2C_SLAVE_ERROR        9       // err: slave mode error
#define I2C_INIT_ERROR         10      // err: Initialization (not done)

extern BYTE I2C_Transfer(I2C_MSG *p);
extern void I2C_Init(void);
extern LONG SystemFrequency;
