#include <I2Cdev.h>
List of all members.
Public Member Functions |
| I2Cdev () |
Static Public Member Functions |
static int8_t | readBit (uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout) |
static int8_t | readBits (uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout) |
static int8_t | readByte (uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout) |
static int8_t | readBytes (uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout) |
static bool | writeBit (uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data) |
static bool | writeBits (uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data) |
static bool | writeByte (uint8_t devAddr, uint8_t regAddr, uint8_t data) |
static bool | writeBytes (uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data) |
static bool | writeWord (uint8_t devAddr, uint8_t regAddr, uint16_t data) |
static bool | writeWords (uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data) |
Static Public Attributes |
static uint16_t | readTimeout = I2CDEV_DEFAULT_READ_TIMEOUT |
Detailed Description
Definition at line 72 of file I2Cdev.h.
Constructor & Destructor Documentation
Default constructor.
Definition at line 48 of file I2Cdev.cpp.
Member Function Documentation
Read a single bit from an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
bitNum | Bit position to read (0-7) |
data | Container for single bit value |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (true = success)
Definition at line 59 of file I2Cdev.cpp.
Read a single bit from a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
bitNum | Bit position to read (0-15) |
data | Container for single bit value |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (true = success) Read multiple bits from an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
bitStart | First bit position to read (0-7) |
length | Number of bits to read (not more than 8) |
data | Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05) |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (true = success)
Definition at line 92 of file I2Cdev.cpp.
Read multiple bits from a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
bitStart | First bit position to read (0-15) |
length | Number of bits to read (not more than 16) |
data | Container for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05) |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (1 = success, 0 = failure, -1 = timeout) Read single byte from an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
data | Container for byte value read from device |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (true = success)
Definition at line 146 of file I2Cdev.cpp.
Read single word from a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to read from |
data | Container for word value read from device |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Status of read operation (true = success) Read multiple bytes from an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | First register regAddr to read from |
length | Number of bytes to read |
data | Buffer to store read data in |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Number of bytes read (-1 indicates failure)
Definition at line 172 of file I2Cdev.cpp.
bool I2Cdev::writeBit |
( |
uint8_t |
devAddr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
bitNum, |
|
|
uint8_t |
data |
|
) |
| [static] |
Read multiple words from a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | First register regAddr to read from |
length | Number of words to read |
data | Buffer to store read data in |
timeout | Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) |
- Returns:
- Number of words read (0 indicates failure) write a single bit in an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to write to |
bitNum | Bit position to write (0-7) |
value | New bit value to write |
- Returns:
- Status of operation (true = success)
Definition at line 311 of file I2Cdev.cpp.
bool I2Cdev::writeBits |
( |
uint8_t |
devAddr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
bitStart, |
|
|
uint8_t |
length, |
|
|
uint8_t |
data |
|
) |
| [static] |
write a single bit in a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to write to |
bitNum | Bit position to write (0-15) |
value | New bit value to write |
- Returns:
- Status of operation (true = success) Write multiple bits in an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to write to |
bitStart | First bit position to write (0-7) |
length | Number of bits to write (not more than 8) |
data | Right-aligned value to write |
- Returns:
- Status of operation (true = success)
Definition at line 342 of file I2Cdev.cpp.
Write multiple bits in a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register regAddr to write to |
bitStart | First bit position to write (0-15) |
length | Number of bits to write (not more than 16) |
data | Right-aligned value to write |
- Returns:
- Status of operation (true = success) Write single byte to an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register address to write to |
data | New byte value to write |
- Returns:
- Status of operation (true = success)
Definition at line 405 of file I2Cdev.cpp.
bool I2Cdev::writeBytes |
( |
uint8_t |
devAddr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
length, |
|
|
uint8_t * |
data |
|
) |
| [static] |
Write multiple bytes to an 8-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | First register address to write to |
length | Number of bytes to write |
data | Buffer to copy new data from |
- Returns:
- Status of operation (true = success)
Definition at line 428 of file I2Cdev.cpp.
Write single word to a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | Register address to write to |
data | New word value to write |
- Returns:
- Status of operation (true = success)
Definition at line 416 of file I2Cdev.cpp.
bool I2Cdev::writeWords |
( |
uint8_t |
devAddr, |
|
|
uint8_t |
regAddr, |
|
|
uint8_t |
length, |
|
|
uint16_t * |
data |
|
) |
| [static] |
Write multiple words to a 16-bit device register.
- Parameters:
-
devAddr | I2C slave device address |
regAddr | First register address to write to |
length | Number of words to write |
data | Buffer to copy new data from |
- Returns:
- Status of operation (true = success)
Definition at line 474 of file I2Cdev.cpp.
Member Data Documentation
Default timeout value for read operations. Set this to 0 to disable timeout detection.
Definition at line 94 of file I2Cdev.h.
The documentation for this class was generated from the following files: