

/***********************************************************************
MODULE:    I2C Callback
VERSION:   1.03
CONTAINS:  Routines for controlling the I2C Peripheral on the Philips
           P89LPC936
COPYRIGHT: Embedded Systems Academy, Inc. - www.esacademy.com
LICENSE:   May be freely used in commercial and non-commercial code
           without royalties provided this copyright notice remains
           in this file and unaltered
WARNING:   IF THIS FILE IS REGENERATED BY CODE ARCHITECT ANY CHANGES
           MADE WILL BE LOST. WHERE POSSIBLE USE ONLY CODE ARCHITECT
           TO CHANGE THE CONTENTS OF THIS FILE
GENERATED: On "Jun 09 2008" at "11:54:02" by Code Architect 2.12
***********************************************************************/

#ifndef _I2CCALLBACKH_
#define _I2CCALLBACKH_

/***********************************************************************
DESC:    gets the next byte to be transmitted when operating as
         a master
RETURNS: byte to transmit
************************************************************************/
extern unsigned char i2c_master_getbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    processes the bytes received when operating as a master
RETURNS: Nothing
************************************************************************/
extern void i2c_master_receivedbyte
  (
  unsigned int bytenum,    // number of the byte in this transfer
                           // (0 = first byte)
  unsigned char value      // value of byte received
  );

/***********************************************************************
DESC:    determines if a byte will be the last one to be
         transmitted when operating as a master
         called before i2c_master_getbyte for each byte
RETURNS: return 1 if the byte will be the last one to transmit
         return 0 if the byte will not be the last one to transmit
************************************************************************/
extern unsigned char i2c_master_islasttxbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    determines if a byte will be the last one to be
         received when operating as a master
         called before i2c_master_receivedbyte for each byte
RETURNS: return 1 if the byte will be the last one to receive
         return 0 if the byte will not be the last one to receive
************************************************************************/
extern unsigned char i2c_master_islastrxbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    gets the next byte to be transmitted when operating as
         a slave
RETURNS: byte to transmit
************************************************************************/
extern unsigned char i2c_slave_getbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    processes the bytes received when operating as a slave
RETURNS: Nothing
************************************************************************/
extern void i2c_slave_receivedbyte
  (
  unsigned int bytenum,    // number of the byte in this transfer
                           // (0 = first byte)
  unsigned char value      // value of byte received
  );

/***********************************************************************
DESC:    determines if a byte will be the last one to be
         transmitted when operating as a slave
         called after i2c_slave_getbyte for each byte
RETURNS: return 1 if the byte will be the last one to transmit
         return 0 if the byte will not be the last one to transmit
************************************************************************/
extern unsigned char i2c_slave_islasttxbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    determines if a byte will be the last one to be
         received when operating as a slave
         called before i2c_slave_receivedbyte for each byte
RETURNS: return 1 if the byte will be the last one to receive
         return 0 if the byte will not be the last one to receive
************************************************************************/
extern unsigned char i2c_slave_islastrxbyte
  (
  unsigned int bytenum    // number of the byte in this transfer
                          // (0 = first byte)
  );

/***********************************************************************
DESC:    called when an I2C transfer is finished
         mi2cstatus may be read to determine if the transfer was
         successful (I2C_OK) or failed (I2C_ERROR)
RETURNS: Nothing
************************************************************************/
extern void i2c_transfer_finished
  (
  void
  );

#endif // _I2CCALLBACKH_

