| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Functions
LT_I2C_Wire.cpp File Reference

Go to the source code of this file.

## Functions
int8_t | i2c_read_byte (uint8_t address, uint8_t *value)
| LT_I2C_Wire: I2C Routines based on Wire library to communicate with Arduino based boards. More...
int8_t | i2c_write_byte (uint8_t address, uint8_t value)
| Write "value" byte to device at "address". More...
int8_t | i2c_read_byte_data (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 | i2c_write_byte_data (uint8_t address, uint8_t command, uint8_t value)
| Write a byte of data to register specified by "command". More...
int8_t | i2c_read_word_data (uint8_t address, uint8_t command, uint16_t *value)
| Read a 16-bit word of data from register specified by "command". More...
int8_t | i2c_write_word_data (uint8_t address, uint8_t command, uint16_t value)
| Write a 16-bit word of data to register specified by "command". More...
int8_t | i2c_read_block_data (uint8_t address, uint8_t command, uint8_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 | i2c_read_block_data (uint8_t address, uint8_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 | i2c_write_block_data (uint8_t address, uint8_t command, uint8_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 | i2c_two_byte_command_read_block (uint8_t address, uint16_t command, uint8_t length, uint8_t *values)
| Write a two command bytes, then receive a block of data. More...
void | quikeval_I2C_init (void)
| Initializes Linduino I2C port. More...
void | quikeval_I2C_connect (void)
| Switch MUX to connect I2C pins to QuikEval connector. More...
void | i2c_enable ()
| i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines. More...

## Function Documentation

## ◆ i2c_enable()

void i2c_enable | ( | void |  | ) |

i2c_enable or quikeval_I2C_init must be called before using any of the other I2C routines.

Definition at line 344 of file LT_I2C_Wire.cpp.

## ◆ i2c_read_block_data() [1/2]

int8_t i2c_read_block_data | ( | uint8_t | address,
|  | uint8_t | command,
|  | uint8_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

  address | 7-bit I2C address
  command | Command byte
  length | Length of array
  values | Byte array to be read

Definition at line 200 of file LT_I2C_Wire.cpp.

## ◆ i2c_read_block_data() [2/2]

int8_t i2c_read_block_data | ( | uint8_t | address,
|  | uint8_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

  address | 7-bit I2C address
  length | Length of array
  values | Byte array to be read

Definition at line 230 of file LT_I2C_Wire.cpp.

## ◆ i2c_read_byte()

int8_t i2c_read_byte | ( | uint8_t | address,
|  | uint8_t * | value
| ) |  |

LT_I2C_Wire: I2C Routines based on Wire library to communicate with Arduino based boards.

Read a byte, store in "value".

      Wire.endTransmission() returns 0, 1, 2, 3, or 4. To maintain consistency with our Legacy LT_I2C library,
      a zero(false) or a non-zero(true) is tested.

      0 .. success
      1 .. length to long for buffer
      2 .. address send, NACK received
      3 .. data send, NACK received
      4 .. other twi error (lost bus arbitration, bus error, ..)

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
- Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Parameters

  address | 7-bit I2C address
  value | Byte to be read

Definition at line 72 of file LT_I2C_Wire.cpp.

## ◆ i2c_read_byte_data()

int8_t i2c_read_byte_data | ( | 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

  address | 7-bit I2C address
  command | Command byte
  value | Byte to be read

Definition at line 104 of file LT_I2C_Wire.cpp.

## ◆ i2c_read_word_data()

int8_t i2c_read_word_data | ( | 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

  address | 7-bit I2C address
  command | Command byte
  value | Word to be read

Definition at line 141 of file LT_I2C_Wire.cpp.

## ◆ i2c_two_byte_command_read_block()

int8_t i2c_two_byte_command_read_block | ( | uint8_t | address,
|  | uint16_t | command,
|  | uint8_t | length,
|  | uint8_t * | values
| ) |  |

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

Returns
  0 on success, 1 on failure

Parameters

  address | 7-bit I2C address
  command | Command word
  length | Length of array
  values | Byte array to be read

Definition at line 274 of file LT_I2C_Wire.cpp.

## ◆ i2c_write_block_data()

int8_t i2c_write_block_data | ( | uint8_t | address,
|  | uint8_t | command,
|  | uint8_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

  address | 7-bit I2C address
  command | Command byte
  length | Length of array
  values | Byte array to be written

Definition at line 253 of file LT_I2C_Wire.cpp.

## ◆ i2c_write_byte()

int8_t i2c_write_byte | ( | uint8_t | address,
|  | uint8_t | value
| ) |  |

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

Returns
  0 on success, 1 on failure

Parameters

  address | 7-bit I2C address
  value | Byte to be written

Definition at line 91 of file LT_I2C_Wire.cpp.

## ◆ i2c_write_byte_data()

int8_t i2c_write_byte_data | ( | 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

  address | 7-bit I2C address
  command | Command byte
  value | Byte to be written

Definition at line 127 of file LT_I2C_Wire.cpp.

## ◆ i2c_write_word_data()

int8_t i2c_write_word_data | ( | 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

  address | 7-bit I2C address
  command | Command byte
  value | Word to be written

Definition at line 176 of file LT_I2C_Wire.cpp.

## ◆ quikeval_I2C_connect()

void quikeval_I2C_connect | ( | void |  | ) |

Switch MUX to connect I2C pins to QuikEval connector.

This will disconnect SPI pins.

Definition at line 331 of file LT_I2C_Wire.cpp.

## ◆ quikeval_I2C_init()

void quikeval_I2C_init | ( | 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 324 of file LT_I2C_Wire.cpp.