/* * c't-Sim - Robotersimulator fuer den c't-Bot * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your * option) any later version. * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307, USA. * */ /*! @file TWI_driver.c * @brief TWI-Treiber (I2C) * @author Chris efstathiou hendrix@otenet.gr & Carsten Giesen (info@cnau.de) * @date 08.04.06 */ #ifdef MCU #include #include "TWI_driver.h" #include "global.h" /*! * TWI Bus initialsieren * @return Resultat der Aktion */ int8 Init_TWI(void){ TWAR = OWN_ADR; /*!< Eigenen Slave Adresse setzen */ TWBR = 12; /*!< Setze Baudrate auf 100 KHz */ /*!< 4 MHz xtal */ TWCR = (1< error und Rueckgabe TWSR. */ return SUCCESS; /*!< wenn OK Rueckgabe SUCCESS */ } /*! * Sende Stop Sequence */ void Send_stop(void){ TWCR = ((1<