Main Page   Data Structures   File List   Data Fields   Globals  

i2c.h

Go to the documentation of this file.
00001 /*! \file i2c.h \brief I2C interface using AVR Two-Wire Interface (TWI) hardware. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'i2c.h'
00005 // Title        : I2C interface using AVR Two-Wire Interface (TWI) hardware
00006 // Author       : Pascal Stang
00007 // Created      : 2002.06.25
00008 // Revised      : 2002.08.22
00009 // Version      : 1.1
00010 // Target MCU   : Atmel AVR series
00011 // Editor Tabs  : 4
00012 //
00013 // This code is distributed under the GNU Public License
00014 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00015 //
00016 //*****************************************************************************
00017 
00018 #ifndef I2C_H
00019 #define I2C_H
00020 
00021 #include "global.h"
00022 
00023 // defines and constants
00024 #define TWCR_CMD_MASK       0x0F
00025 #define TWSR_STATUS_MASK    0xF8
00026 
00027 // functions
00028 
00029 // initialize I2C interface
00030 void i2cInit(void);
00031 void i2cSetBitrate(u16 bitrateKHz);
00032 
00033 void i2cSetLocalDeviceAddr(u08 deviceAddr, u08 genCallEn);
00034 void i2cSetReceiveHandler(void (*i2cRx_func)(u08 data));
00035 
00036 // send I2C data to a device on the bus
00037 void i2cSend(u08 deviceAddr, u08 length, u08 *data);
00038 void i2cSendNI(u08 deviceAddr, u08 length, u08* data);
00039 
00040 // receive I2C data from a device on the bus
00041 void i2cReceive(u08 deviceAddr, u08 length, u08* data);
00042 void i2cReceiveNI(u08 deviceAddr, u08 length, u08 *data);
00043 
00044 #endif

Generated on Tue Feb 4 20:18:37 2003 for Procyon AVRlib by doxygen1.3-rc2