00001 #include <avr/io.h>
00002
00003 #define TW_START 0x08
00004 #define TW_REP_START 0x10
00005 #define TW_MT_SLA_ACK 0x18
00006 #define TW_MT_SLA_NACK 0x20
00007 #define TW_MT_DATA_ACK 0x28
00008 #define TW_MT_DATA_NACK 0x30
00009 #define TW_MT_ARB_LOST 0x38
00010 #define TW_MR_ARB_LOST 0x38
00011 #define TW_MR_SLA_ACK 0x40
00012 #define TW_MR_SLA_NACK 0x48
00013 #define TW_MR_DATA_ACK 0x50
00014 #define TW_MR_DATA_NACK 0x58
00015 #define TW_ST_SLA_ACK 0xA8
00016 #define TW_ST_ARB_LOST_SLA_ACK 0xB0
00017 #define TW_ST_DATA_ACK 0xB8
00018 #define TW_ST_DATA_NACK 0xC0
00019 #define TW_ST_LAST_DATA 0xC8
00020 #define TW_SR_SLA_ACK 0x60
00021 #define TW_SR_ARB_LOST_SLA_ACK 0x68
00022 #define TW_SR_GCALL_ACK 0x70
00023 #define TW_SR_ARB_LOST_GCALL_ACK 0x78
00024 #define TW_SR_DATA_ACK 0x80
00025 #define TW_SR_DATA_NACK 0x88
00026 #define TW_SR_GCALL_DATA_ACK 0x90
00027 #define TW_SR_GCALL_DATA_NACK 0x98
00028 #define TW_SR_STOP 0xA0
00029 #define TW_NO_INFO 0xF8
00030 #define TW_BUS_ERROR 0x00
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00050 uint8_t read_i2c_device(uint8_t address,uint8_t bytes,uint8_t *data);
00051
00052
00053
00061 uint8_t write_i2c_device(uint8_t address,uint8_t bytes,uint8_t *data);
00062