Go to the documentation of this file.00001
00002 #ifndef I2C_H
00003 #define I2C_H
00004
00005
00006
00007 #include <avr/io.h>
00008 #include <config.h>
00009
00010
00011
00012
00013 #define TW_START 0x08
00014 #define TW_REP_START 0x10
00015 #define TW_MT_SLA_ACK 0x18
00016 #define TW_MT_SLA_NACK 0x20
00017 #define TW_MT_DATA_ACK 0x28
00018 #define TW_MT_DATA_NACK 0x30
00019 #define TW_MT_ARB_LOST 0x38
00020 #define TW_MR_ARB_LOST 0x38
00021 #define TW_MR_SLA_ACK 0x40
00022 #define TW_MR_SLA_NACK 0x48
00023 #define TW_MR_DATA_ACK 0x50
00024 #define TW_MR_DATA_NACK 0x58
00025 #define TW_ST_SLA_ACK 0xA8
00026 #define TW_ST_ARB_LOST_SLA_ACK 0xB0
00027 #define TW_ST_DATA_ACK 0xB8
00028 #define TW_ST_DATA_NACK 0xC0
00029 #define TW_ST_LAST_DATA 0xC8
00030 #define TW_SR_SLA_ACK 0x60
00031 #define TW_SR_ARB_LOST_SLA_ACK 0x68
00032 #define TW_SR_GCALL_ACK 0x70
00033 #define TW_SR_ARB_LOST_GCALL_ACK 0x78
00034 #define TW_SR_DATA_ACK 0x80
00035 #define TW_SR_DATA_NACK 0x88
00036 #define TW_SR_GCALL_DATA_ACK 0x90
00037 #define TW_SR_GCALL_DATA_NACK 0x98
00038 #define TW_SR_STOP 0xA0
00039 #define TW_NO_INFO 0xF8
00040 #define TW_BUS_ERROR 0x00
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 void i2c_timerproc (void);
00081
00082
00092 uint8_t read_i2c_device(uint8_t address, uint8_t bytes, uint8_t *rdata);
00093
00094
00095
00105 uint8_t write_i2c_device(uint8_t address, uint8_t bytes, uint8_t *wdata);
00106
00107
00108
00120 uint8_t write_read_i2c_device(uint8_t address, uint8_t wbytes, uint8_t *wdata, uint8_t rbytes, uint8_t *rdata);
00121
00122 #endif
00123