00001 /* 00002 * This file is part of AvrTherm. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published 00006 * by the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 * See the GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 * 00018 * Copyright (C) 2004 Andreas Schroeder <andreas@a-netz.de> 00019 */ 00020 00033 #ifndef I2C_H 00034 #define I2C_H 00035 00036 #include "globals.h" 00037 00041 #define I2C_ACK 1 00042 00046 #define I2C_NO_ACK 0 00047 00053 #define I2C_MASK_WRITE 0xfe 00054 00060 #define I2C_MASK_READ 0x01 00061 00068 #define I2C_READ(ADDRESS) (ADDRESS | I2C_MASK_READ) 00069 00076 #define I2C_WRITE(ADDRESS) (ADDRESS & I2C_MASK_WRITE) 00077 00085 void i2c_init(void); 00086 00090 void i2c_start(void); 00091 00095 void i2c_stop(void); 00096 00112 u08 i2c_send_byte(u08 data); 00113 00114 00121 u08 i2c_read_byte(void); 00122 00126 void i2c_send_ack(u08 ack); 00127 00128 #endif