Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LT_I2CBus Class Reference

Detailed Description

Definition at line 50 of file LT_I2CBus.h.

Public Member Functions

 LT_I2CBus ()
 
 LT_I2CBus (uint32_t speed)
 
void changeSpeed (uint32_t speed)
 Change the speed of the bus. More...
 
uint32_t getSpeed ()
 Get the speed of the bus. More...
 
int8_t readByte (uint8_t address, uint8_t *value)
 Read a byte, store in "value". More...
 
int8_t writeByte (uint8_t address, uint8_t value)
 Write "value" byte to device at "address". More...
 
int8_t readByteData (uint8_t address, uint8_t command, uint8_t *value)
 Read a byte of data at register specified by "command", store in "value". More...
 
int8_t writeByteData (uint8_t address, uint8_t command, uint8_t value)
 Write a byte of data to register specified by "command". More...
 
int8_t readWordData (uint8_t address, uint8_t command, uint16_t *value)
 Read a 16-bit word of data from register specified by "command". More...
 
int8_t writeWordData (uint8_t address, uint8_t command, uint16_t value)
 Write a 16-bit word of data to register specified by "command". More...
 
int8_t readBlockData (uint8_t address, uint8_t command, uint16_t length, uint8_t *values)
 Read a block of data, starting at register specified by "command" and ending at (command + length - 1) More...
 
int8_t readBlockDataPec (uint8_t address, uint8_t command, uint16_t length, uint8_t *values)
 Read a block of data, starting at register specified by "command" and ending at (command + length - 1) More...
 
int8_t readBlockData (uint8_t address, uint16_t length, uint8_t *values)
 Read a block of data, no command byte, reads length number of bytes and stores it in values. More...
 
int8_t readBlockDataPec (uint8_t address, uint16_t length, uint8_t *values)
 Read a block of data, no command byte, reads length number of bytes and stores it in values. More...
 
int8_t writeBlockData (uint8_t address, uint8_t command, uint16_t length, uint8_t *values)
 Write a block of data, starting at register specified by "command" and ending at (command + length - 1) More...
 
int8_t twoByteCommandReadBlock (uint8_t address, uint16_t command, uint16_t length, uint8_t *values)
 Write a two command bytes, then receive a block of data. More...
 
void quikevalI2CInit (void)
 Initializes Linduino I2C port. More...
 
void quikevalI2CConnect (void)
 Switch MUX to connect I2C pins to QuikEval connector. More...
 
void startGroupProtocol (void)
 starts group protocol so I2CBus knows to repeat START instead of STOP. More...
 
void endGroupProtocol (void)
 ends group protocol so I2CBus knows to send STOPs again. More...
 

Member Function Documentation

◆ changeSpeed()

void LT_I2CBus::changeSpeed ( uint32_t  speed)

Change the speed of the bus.

Parameters
speedthe speed

Definition at line 73 of file LT_I2CBus.cpp.

◆ endGroupProtocol()

void LT_I2CBus::endGroupProtocol ( void  )

ends group protocol so I2CBus knows to send STOPs again.

Definition at line 244 of file LT_I2CBus.cpp.

◆ getSpeed()

uint32_t LT_I2CBus::getSpeed ( )

Get the speed of the bus.

Definition at line 78 of file LT_I2CBus.cpp.

◆ quikevalI2CConnect()

void LT_I2CBus::quikevalI2CConnect ( void  )

Switch MUX to connect I2C pins to QuikEval connector.

This will disconnect SPI pins.

Definition at line 232 of file LT_I2CBus.cpp.

◆ quikevalI2CInit()

void LT_I2CBus::quikevalI2CInit ( void  )

Initializes Linduino I2C port.

Before communicating to the I2C port through the QuikEval connector, you must also run quikeval_I2C_connect to connect the I2C port to the QuikEval connector through the QuikEval MUX (and disconnect SPI).

Definition at line 225 of file LT_I2CBus.cpp.

◆ readBlockData() [1/2]

int8_t LT_I2CBus::readBlockData ( uint8_t  address,
uint8_t  command,
uint16_t  length,
uint8_t *  values 
)

Read a block of data, starting at register specified by "command" and ending at (command + length - 1)

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
lengthLength of array
valuesByte array to be read

Definition at line 161 of file LT_I2CBus.cpp.

◆ readBlockData() [2/2]

int8_t LT_I2CBus::readBlockData ( uint8_t  address,
uint16_t  length,
uint8_t *  values 
)

Read a block of data, no command byte, reads length number of bytes and stores it in values.

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
lengthLength of array
valuesByte array to be read

Definition at line 175 of file LT_I2CBus.cpp.

◆ readBlockDataPec() [1/2]

int8_t LT_I2CBus::readBlockDataPec ( uint8_t  address,
uint8_t  command,
uint16_t  length,
uint8_t *  values 
)

Read a block of data, starting at register specified by "command" and ending at (command + length - 1)

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
lengthLength of array
valuesByte array to be read

◆ readBlockDataPec() [2/2]

int8_t LT_I2CBus::readBlockDataPec ( uint8_t  address,
uint16_t  length,
uint8_t *  values 
)

Read a block of data, no command byte, reads length number of bytes and stores it in values.

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
lengthLength of array
valuesByte array to be read

◆ readByte()

int8_t LT_I2CBus::readByte ( uint8_t  address,
uint8_t *  value 
)

Read a byte, store in "value".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
valueByte to be read

Definition at line 84 of file LT_I2CBus.cpp.

◆ readByteData()

int8_t LT_I2CBus::readByteData ( uint8_t  address,
uint8_t  command,
uint8_t *  value 
)

Read a byte of data at register specified by "command", store in "value".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
valueByte to be read

Definition at line 106 of file LT_I2CBus.cpp.

◆ readWordData()

int8_t LT_I2CBus::readWordData ( uint8_t  address,
uint8_t  command,
uint16_t *  value 
)

Read a 16-bit word of data from register specified by "command".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
valueWord to be read

Definition at line 131 of file LT_I2CBus.cpp.

◆ startGroupProtocol()

void LT_I2CBus::startGroupProtocol ( void  )

starts group protocol so I2CBus knows to repeat START instead of STOP.

Definition at line 240 of file LT_I2CBus.cpp.

◆ twoByteCommandReadBlock()

int8_t LT_I2CBus::twoByteCommandReadBlock ( uint8_t  address,
uint16_t  command,
uint16_t  length,
uint8_t *  values 
)

Write a two command bytes, then receive a block of data.

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand word
lengthLength of array
valuesByte array to be read

Definition at line 206 of file LT_I2CBus.cpp.

◆ writeBlockData()

int8_t LT_I2CBus::writeBlockData ( uint8_t  address,
uint8_t  command,
uint16_t  length,
uint8_t *  values 
)

Write a block of data, starting at register specified by "command" and ending at (command + length - 1)

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
lengthLength of array
valuesByte array to be written

Definition at line 187 of file LT_I2CBus.cpp.

◆ writeByte()

int8_t LT_I2CBus::writeByte ( uint8_t  address,
uint8_t  value 
)

Write "value" byte to device at "address".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
valueByte to be written

Definition at line 95 of file LT_I2CBus.cpp.

◆ writeByteData()

int8_t LT_I2CBus::writeByteData ( uint8_t  address,
uint8_t  command,
uint8_t  value 
)

Write a byte of data to register specified by "command".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
valueByte to be written

Definition at line 119 of file LT_I2CBus.cpp.

◆ writeWordData()

int8_t LT_I2CBus::writeWordData ( uint8_t  address,
uint8_t  command,
uint16_t  value 
)

Write a 16-bit word of data to register specified by "command".

Returns
0 on success, 1 on failure
Parameters
address7-bit I2C address
commandCommand byte
valueWord to be written

Definition at line 148 of file LT_I2CBus.cpp.

Constructor & Destructor Documentation

◆ LT_I2CBus() [1/2]

LT_I2CBus::LT_I2CBus ( )

Definition at line 59 of file LT_I2CBus.cpp.

◆ LT_I2CBus() [2/2]

LT_I2CBus::LT_I2CBus ( uint32_t  speed)

Definition at line 66 of file LT_I2CBus.cpp.


The documentation for this class was generated from the following files: