i2c.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *   i2c.h:  Header file for NXP LPC23xx/24xx Family Microprocessors
00003  *
00004  *   Copyright(C) 2006, NXP Semiconductor
00005  *   All rights reserved.
00006  *
00007  *   History
00008  *   2006.07.19  ver 1.00    Prelimnary version, first Release
00009  *
00010 ******************************************************************************/
00011 #ifndef __I2C_H 
00012 #define __I2C_H
00013 
00014 #define BUFSIZE                 0x20
00015 #define MAX_TIMEOUT             0x00FFFFFF
00016 
00017 #define I2CMASTER               0x01
00018 #define I2CSLAVE                0x02
00019 
00020 /* For more info, read Philips's SE95 datasheet */
00021 #define LM75_ADDR               0x90
00022 #define LM75_TEMP               0x00
00023 #define LM75_CONFIG             0x01
00024 #define LM75_THYST              0x02
00025 #define LM75_TOS                0x03
00026 
00027 #define RD_BIT                  0x01
00028 
00029 #define I2C_IDLE                        0
00030 #define I2C_STARTED                     1
00031 #define I2C_RESTARTED           2
00032 #define I2C_REPEATED_START      3
00033 #define DATA_ACK                        4
00034 #define DATA_NACK                       5
00035 
00036 #define I2CONSET_I2EN           0x00000040  /* I2C Control Set Register */
00037 #define I2CONSET_AA                     0x00000004
00038 #define I2CONSET_SI                     0x00000008
00039 #define I2CONSET_STO            0x00000010
00040 #define I2CONSET_STA            0x00000020
00041 
00042 #define I2CONCLR_AAC            0x00000004  /* I2C Control clear Register */
00043 #define I2CONCLR_SIC            0x00000008
00044 #define I2CONCLR_STAC           0x00000020
00045 #define I2CONCLR_I2ENC          0x00000040
00046 
00047 #define I2DAT_I2C                       0x00000000  /* I2C Data Reg */
00048 #define I2ADR_I2C                       0x00000000  /* I2C Slave Address Reg */
00049 #define I2SCLH_SCLH                     0x00000080  /* I2C SCL Duty Cycle High Reg */
00050 #define I2SCLL_SCLL                     0x00000080  /* I2C SCL Duty Cycle Low Reg */
00051 
00052 extern int I2CInit( int I2cMode );
00053 extern int I2CStart( void );
00054 extern int I2CStop( void );
00055 extern int I2CEngine( void );
00056 
00057 #endif /* end __I2C_H */
00058 /****************************************************************************
00059 **                            End Of File
00060 *****************************************************************************/