00001 /*! \file i2csw.h \brief Software I2C interface using port pins. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'i2csw.h' 00005 // Title : Software I2C interface using port pins 00006 // Author : Pascal Stang 00007 // Created : 11/22/2000 00008 // Revised : 5/2/2002 00009 // Version : 1.1 00010 // Target MCU : Atmel AVR series 00011 // Editor Tabs : 4 00012 // 00013 /// \ingroup driver_sw 00014 /// \defgroup i2csw Software I2C Serial Interface Function Library (i2csw.c) 00015 /// \code #include "i2csw.h" \endcode 00016 /// \par Overview 00017 /// This library provides a very simple bit-banged I2C serial interface. 00018 /// The library supports MASTER mode send and receive of single or multiple 00019 /// bytes. Thanks to the standardization of the I2C protocol and register 00020 /// access, the send and receive commands are everything you need to talk to 00021 /// thousands of different I2C devices including: EEPROMS, Flash memory, 00022 /// MP3 players, A/D and D/A converters, electronic potentiometers, etc. 00023 /// 00024 /// Although some AVR processors have built-in hardware to help create an I2C 00025 /// interface, this library does not require or use that hardware. 00026 /// 00027 /// For general information about I2C, see the i2c library. 00028 // 00029 // This code is distributed under the GNU Public License 00030 // which can be found at http://www.gnu.org/licenses/gpl.txt 00031 // 00032 //***************************************************************************** 00033 00034 #ifndef I2CSW_H 00035 #define I2CSW_H 00036 00037 #include "global.h" 00038 00039 // include project-dependent settings 00040 #include "i2cswconf.h" 00041 00042 // defines and constants 00043 #define READ 0x01 // I2C READ bit 00044 00045 // functions 00046 00047 // initialize I2C interface pins 00048 void i2cInit(void); 00049 00050 // send I2C data to <device> register <sub> 00051 void i2cSend(BYTE device, BYTE sub, BYTE length, BYTE *data); 00052 00053 // receive I2C data from <device> register <sub> 00054 void i2cReceive(BYTE device, BYTE sub, BYTE length, BYTE *data); 00055 00056 #endif