mos/dev/include/avr-i2c.h File Reference

I2C driver for AVR. More...

Go to the source code of this file.

Defines

#define avr_i2c_set_brr(new_twbr)   TWBR = new_twbr
#define avr_i2c_start_condition()   TWCR |= (1 << TWSTA)
#define avr_i2c_stop_condition()   TWCR |= (1 << TWSTO)
#define avr_i2c_interrupt_enable()   TWCR |= (1 << TWIE)
#define avr_i2c_interrupt_disable()   TWCR &= ~(1 << TWIE)
#define avr_i2c_enable()   TWCR |= (1 << TWEN)
#define avr_i2c_disable()   TWCR &= ~(1 << TWEN)
#define avr_i2c_get_status()   (TWSR & ~3)
#define avr_i2c_put_byte(new_byte)   TWDR = new_byte
#define avr_i2c_get_byte()   TWDR
#define avr_i2c_set_slave_addr(new_slave)   TWAR = (new_slave << 1)
#define avr_i2c_clear_int_flag()   TWCR |= (1 << TWINT)
#define avr_i2c_check_int_flag()   TWCR & (1 << TWINT)
#define avr_i2c_enable_general_call()   TWAR |= (1 << TWGCE)
#define avr_i2c_disable_general_call()   TWAR &= ~(1 << TWGCE)
#define I2C_ENABLE_ACK   0
#define I2C_DISABLE_ACK   1
#define I2C_DEST_ADDR   3
#define I2C_SLAVE_ADDR   4
#define I2C_SET_BRR   5
#define I2C_IDLE   0
#define I2C_READING   1
#define I2C_WRITING   2
#define START   0x08
#define START_REPEAT   0x10
#define MT_SLA_ACK   0x18
#define MT_SLA_NACK   0x20
#define MT_DATA_ACK   0x28
#define MT_DATA_NACK   0x30
#define MT_ARB_LOST   0x38
#define MT_DATA_DONE   0x01
#define MR_SLA_ACK   0x40
#define MR_SLA_NACK   0x48
#define MR_DATA_ACK   0x50
#define MR_DATA_NACK   0x58
#define OWN_SLAW_RECEIVED_ACK   0x60
#define ARBITRATION_LOST_SLARW   0x68
#define GENERAL_ADDR_RECEIVED   0x70
#define ARBITRATION_LOST_SLARW_GEN   0x78
#define PREV_ADDR_DATA_RECEIVED_ACK   0x80
#define PREV_ADDR_DATA_RECEIVED_NACK   0x88
#define PREV_GENERAL_ADDR_DATA_RECEIVED_ACK   0x90
#define PREV_GENERAL_ADDR_DATA_RECEIVED_NACK   0x98
#define STOP_REPEATED_START   0xA0
#define SLAR_RECEIVED_ACK   0xA8
#define ARBITRATION_LOST_SLARW_ACK   0xB0
#define SLAVE_DATA_XMITTED_ACK   0xB8
#define SLAVE_DATA_XMITTED_NACK   0xC0
#define LAST_BYTE_XMITTED   0xC8
#define NO_RELEVANT_STATE   0xF8
#define BUS_ERROR   0x00
#define I2C_MT   0
#define I2C_MR   1
#define I2C_ST   2
#define I2C_SR   3

Functions

void avr_i2c_init ()
 Initialize the eeprom driver.


Detailed Description

Author:
Charles Gruenwald III
Date:
Created: 11/23/2004

Definition in file avr-i2c.h.


Generated on Mon Nov 23 06:25:59 2009 for MANTIS by  doxygen 1.4.6