Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

twi.h

00001 /* Copyright (c) 2002, Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright
00010      notice, this list of conditions and the following disclaimer in
00011      the documentation and/or other materials provided with the
00012      distribution.
00013 
00014   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00015   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00018   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00019   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00020   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00021   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00022   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00023   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024   POSSIBILITY OF SUCH DAMAGE. */
00025 
00026 /*
00027    avr/twi.h - definitions for TWI: Two-Wire Interface or Twi Was I2c(tm).
00028 
00029    Contributors:
00030      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00031 
00032    Based on advance information Atmel datasheet Rev. 1142A-10/00 (ATmega163).
00033  */
00034 
00035 #ifndef _AVR_TWI_H_
00036 #define _AVR_TWI_H_ 1
00037 
00038 /* TWSR values (not bits) */
00039 /* Master */
00040 #define TW_START                0x08
00041 #define TW_REP_START            0x10
00042 /* Master Transmitter */
00043 #define TW_MT_SLA_ACK           0x18
00044 #define TW_MT_SLA_NACK          0x20
00045 #define TW_MT_DATA_ACK          0x28
00046 #define TW_MT_DATA_NACK         0x30
00047 #define TW_MT_ARB_LOST          0x38
00048 /* Master Receiver */
00049 #define TW_MR_ARB_LOST          0x38
00050 #define TW_MR_SLA_ACK           0x40
00051 #define TW_MR_SLA_NACK          0x48
00052 #define TW_MR_DATA_ACK          0x50
00053 #define TW_MR_DATA_NACK         0x58
00054 /* Slave Transmitter */
00055 #define TW_ST_SLA_ACK           0xA8
00056 #define TW_ST_ARB_LOST_SLA_ACK  0xB0
00057 #define TW_ST_DATA_ACK          0xB8
00058 #define TW_ST_DATA_NACK         0xC0
00059 #define TW_ST_LAST_DATA         0xC8
00060 /* Slave Receiver */
00061 #define TW_SR_SLA_ACK           0x60
00062 #define TW_SR_ARB_LOST_SLA_ACK  0x68
00063 #define TW_SR_GCALL_ACK         0x70
00064 #define TW_SR_ARB_LOST_GCALL_ACK 0x78
00065 #define TW_SR_DATA_ACK          0x80
00066 #define TW_SR_DATA_NACK         0x88
00067 #define TW_SR_GCALL_DATA_ACK    0x90
00068 #define TW_SR_GCALL_DATA_NACK   0x98
00069 #define TW_SR_STOP              0xA0
00070 /* Misc */
00071 #define TW_NO_INFO              0xF8
00072 #define TW_BUS_ERROR            0x00
00073 
00074 #endif  /* _AVR_TWI_H_ */

Generated on Thu Jan 30 22:30:52 2003 for EduNet by doxygen1.2.18