#include <avr/io.h>Go to the source code of this file.
Defines | |
| #define | TW_START 0x08 |
| #define | TW_REP_START 0x10 |
| #define | TW_MT_SLA_ACK 0x18 |
| #define | TW_MT_SLA_NACK 0x20 |
| #define | TW_MT_DATA_ACK 0x28 |
| #define | TW_MT_DATA_NACK 0x30 |
| #define | TW_MT_ARB_LOST 0x38 |
| #define | TW_MR_ARB_LOST 0x38 |
| #define | TW_MR_SLA_ACK 0x40 |
| #define | TW_MR_SLA_NACK 0x48 |
| #define | TW_MR_DATA_ACK 0x50 |
| #define | TW_MR_DATA_NACK 0x58 |
| #define | TW_ST_SLA_ACK 0xA8 |
| #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_SR_SLA_ACK 0x60 |
| #define | TW_SR_ARB_LOST_SLA_ACK 0x68 |
| #define | TW_SR_GCALL_ACK 0x70 |
| #define | TW_SR_ARB_LOST_GCALL_ACK 0x78 |
| #define | TW_SR_DATA_ACK 0x80 |
| #define | TW_SR_DATA_NACK 0x88 |
| #define | TW_SR_GCALL_DATA_ACK 0x90 |
| #define | TW_SR_GCALL_DATA_NACK 0x98 |
| #define | TW_SR_STOP 0xA0 |
| #define | TW_NO_INFO 0xF8 |
| #define | TW_BUS_ERROR 0x00 |
Functions | |
| uint8_t | read_i2c_device (uint8_t address, uint8_t bytes, uint8_t *data) |
| Read 1 or more bytes from an I2C device to memory. | |
| uint8_t | write_i2c_device (uint8_t address, uint8_t bytes, uint8_t *data) |
| Write 1 or more bytes to an I2C device from memory. | |
| #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_NO_INFO 0xF8 |
| #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_SR_STOP 0xA0 |
| #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 |
| #define TW_START 0x08 |
| uint8_t read_i2c_device | ( | uint8_t | address, | |
| uint8_t | bytes, | |||
| uint8_t * | data | |||
| ) |
Read 1 or more bytes from an I2C device to memory.
| address | Address if I2C device. The bottom bit is set to enfoce an I2C read. | |
| bytes | Number of bytes to be returned. | |
| *data | Pointer to location to store values returned. |
| uint8_t write_i2c_device | ( | uint8_t | address, | |
| uint8_t | bytes, | |||
| uint8_t * | data | |||
| ) |
Write 1 or more bytes to an I2C device from memory.
| address | Address if I2C device. The bottom bit is cleared to enforce an I2C write. | |
| bytes | Number of bytes to be sent. | |
| *data | Pointer to location in memory of first byte of set of data. |
1.5.8