#include <avr/io.h>
#include <config.h>
Go to the source code of this file.
Define Documentation
#define TW_BUS_ERROR 0x00 |
#define TW_MR_ARB_LOST 0x38 |
#define TW_MR_DATA_ACK 0x50 |
#define TW_MR_DATA_NACK 0x58 |
#define TW_MR_SLA_ACK 0x40 |
#define TW_MR_SLA_NACK 0x48 |
#define TW_MT_ARB_LOST 0x38 |
#define TW_MT_DATA_ACK 0x28 |
#define TW_MT_DATA_NACK 0x30 |
#define TW_MT_SLA_ACK 0x18 |
#define TW_MT_SLA_NACK 0x20 |
#define TW_REP_START 0x10 |
#define TW_SR_ARB_LOST_GCALL_ACK 0x78 |
#define TW_SR_ARB_LOST_SLA_ACK 0x68 |
#define TW_SR_DATA_ACK 0x80 |
#define TW_SR_DATA_NACK 0x88 |
#define TW_SR_GCALL_ACK 0x70 |
#define TW_SR_GCALL_DATA_ACK 0x90 |
#define TW_SR_GCALL_DATA_NACK 0x98 |
#define TW_SR_SLA_ACK 0x60 |
#define TW_ST_ARB_LOST_SLA_ACK 0xB0 |
#define TW_ST_DATA_ACK 0xB8 |
#define TW_ST_DATA_NACK 0xC0 |
#define TW_ST_LAST_DATA 0xC8 |
#define TW_ST_SLA_ACK 0xA8 |
Function Documentation
void i2c_timerproc |
( |
void |
|
) |
|
uint8_t read_i2c_device |
( |
uint8_t |
address, |
|
|
uint8_t |
bytes, |
|
|
uint8_t * |
rdata | |
|
) |
| | |
Read 1 or more bytes from an I2C device to memory.
- Parameters:
-
| address | Address if I2C device. The bottom bit is set to enforce an I2C read. |
| bytes | Number of bytes to be returned. |
| *rdata | Pointer to location to store values returned. |
- Returns:
- returns error code generated from I2C transaction, or 0 for success
uint8_t write_i2c_device |
( |
uint8_t |
address, |
|
|
uint8_t |
bytes, |
|
|
uint8_t * |
wdata | |
|
) |
| | |
Write 1 or more bytes to an I2C device from memory.
- Parameters:
-
| address | Address if I2C device. The bottom bit is cleared to enforce an I2C write. |
| bytes | Number of data bytes to be sent. |
| *wdata | Pointer to location in memory of first byte of set of data. |
- Returns:
- returns error code generated from I2C transaction, or 0 for success
uint8_t write_read_i2c_device |
( |
uint8_t |
address, |
|
|
uint8_t |
wbytes, |
|
|
uint8_t * |
wdata, |
|
|
uint8_t |
rbytes, |
|
|
uint8_t * |
rdata | |
|
) |
| | |
Write 1 or more bytes to an I2C device followed by a read without releasing the bus.
- Parameters:
-
| address | Address if I2C device. The bottom bit is manipulated as appropriate for R/W |
| wbytes | Number of bytes to write. |
| *wdata | Pointer to location in memory of first byte to write. |
| rbytes | Number of bytes to read. |
| *rdata | Pointer to location in memory of first byte of set of data. |
- Returns:
- returns error code generated from I2C transaction, or 0 for success