Elisa3
twimaster.h
Go to the documentation of this file.
00001 #ifndef _I2CMASTER_H
00002 #define _I2CMASTER_H   1
00003 /************************************************************************* 
00004 * Title:    C include file for the I2C master interface 
00005 *           (i2cmaster.S or twimaster.c)
00006 * Author:   Peter Fleury <pfleury@gmx.ch>  http://jump.to/fleury
00007 * File:     $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $
00008 * Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
00009 * Target:   any AVR device
00010 * Usage:    see Doxygen manual
00011 **************************************************************************/
00012 
00013 #ifdef DOXYGEN
00014 
00080 #endif /* DOXYGEN */
00081 
00084 #if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
00085 #error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
00086 #endif
00087 
00088 #include <avr/io.h>
00089 
00091 #define I2C_READ    1
00092 
00094 #define I2C_WRITE   0
00095 
00096 
00102 extern void i2c_init(void);
00103 
00104 
00110 extern void i2c_stop(void);
00111 
00112 
00120 extern unsigned char i2c_start(unsigned char addr);
00121 
00122 
00130 extern unsigned char i2c_rep_start(unsigned char addr);
00131 
00132 
00140 extern void i2c_start_wait(unsigned char addr);
00141 
00142  
00149 extern unsigned char i2c_write(unsigned char data);
00150 
00151 
00156 extern unsigned char i2c_readAck(void);
00157 
00162 extern unsigned char i2c_readNak(void);
00163 
00173 extern unsigned char i2c_read(unsigned char ack);
00174 #define i2c_read(ack)  (ack) ? i2c_readAck() : i2c_readNak(); 
00175 
00176 extern void i2c_close();
00177 
00179 #endif
 All Files Functions Variables Defines