Public Member Functions | Static Public Member Functions | Static Public Attributes
I2Cdev Class Reference

#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

int8_t I2Cdev::readBit ( uint8_t  devAddr,
uint8_t  regAddr,
uint8_t  bitNum,
uint8_t *  data,
uint16_t  timeout = I2Cdev::readTimeout 
) [static]

Read a single bit from an 8-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to read from
bitNumBit position to read (0-7)
dataContainer for single bit value
timeoutOptional 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.

int8_t I2Cdev::readBits ( uint8_t  devAddr,
uint8_t  regAddr,
uint8_t  bitStart,
uint8_t  length,
uint8_t *  data,
uint16_t  timeout = I2Cdev::readTimeout 
) [static]

Read a single bit from a 16-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to read from
bitNumBit position to read (0-15)
dataContainer for single bit value
timeoutOptional 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:
devAddrI2C slave device address
regAddrRegister regAddr to read from
bitStartFirst bit position to read (0-7)
lengthNumber of bits to read (not more than 8)
dataContainer for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05)
timeoutOptional 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.

int8_t I2Cdev::readByte ( uint8_t  devAddr,
uint8_t  regAddr,
uint8_t *  data,
uint16_t  timeout = I2Cdev::readTimeout 
) [static]

Read multiple bits from a 16-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to read from
bitStartFirst bit position to read (0-15)
lengthNumber of bits to read (not more than 16)
dataContainer for right-aligned value (i.e. '101' read from any bitStart position will equal 0x05)
timeoutOptional 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:
devAddrI2C slave device address
regAddrRegister regAddr to read from
dataContainer for byte value read from device
timeoutOptional 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.

int8_t I2Cdev::readBytes ( uint8_t  devAddr,
uint8_t  regAddr,
uint8_t  length,
uint8_t *  data,
uint16_t  timeout = I2Cdev::readTimeout 
) [static]

Read single word from a 16-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to read from
dataContainer for word value read from device
timeoutOptional 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:
devAddrI2C slave device address
regAddrFirst register regAddr to read from
lengthNumber of bytes to read
dataBuffer to store read data in
timeoutOptional 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:
devAddrI2C slave device address
regAddrFirst register regAddr to read from
lengthNumber of words to read
dataBuffer to store read data in
timeoutOptional 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:
devAddrI2C slave device address
regAddrRegister regAddr to write to
bitNumBit position to write (0-7)
valueNew 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:
devAddrI2C slave device address
regAddrRegister regAddr to write to
bitNumBit position to write (0-15)
valueNew bit value to write
Returns:
Status of operation (true = success) Write multiple bits in an 8-bit device register.
Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to write to
bitStartFirst bit position to write (0-7)
lengthNumber of bits to write (not more than 8)
dataRight-aligned value to write
Returns:
Status of operation (true = success)

Definition at line 342 of file I2Cdev.cpp.

bool I2Cdev::writeByte ( uint8_t  devAddr,
uint8_t  regAddr,
uint8_t  data 
) [static]

Write multiple bits in a 16-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister regAddr to write to
bitStartFirst bit position to write (0-15)
lengthNumber of bits to write (not more than 16)
dataRight-aligned value to write
Returns:
Status of operation (true = success) Write single byte to an 8-bit device register.
Parameters:
devAddrI2C slave device address
regAddrRegister address to write to
dataNew 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:
devAddrI2C slave device address
regAddrFirst register address to write to
lengthNumber of bytes to write
dataBuffer to copy new data from
Returns:
Status of operation (true = success)

Definition at line 428 of file I2Cdev.cpp.

bool I2Cdev::writeWord ( uint8_t  devAddr,
uint8_t  regAddr,
uint16_t  data 
) [static]

Write single word to a 16-bit device register.

Parameters:
devAddrI2C slave device address
regAddrRegister address to write to
dataNew 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:
devAddrI2C slave device address
regAddrFirst register address to write to
lengthNumber of words to write
dataBuffer 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:


segbot_firmware
Author(s): Jose Bigio, Jack O'Quin, Tim Eckel (NewPing library)
autogenerated on Thu Jun 6 2019 21:37:01