Loading...
Searching...
No Matches
uhd::i2c_iface Class Referenceabstract

`#include <uhd/types/serial.hpp>`

Inheritance diagram for uhd::i2c_iface:
[legend]

## Public Types

typedef std::shared_ptr< i2c_iface > | sptr

## Public Member Functions

virtual | ~i2c_iface (void)
i2c_iface::sptr | eeprom16 (void)
| Create an i2c_iface than can talk to 16 bit addressable EEPROMS.
virtual void | write_i2c (uint16_t addr, const byte_vector_t &buf)=0
virtual byte_vector_t | read_i2c (uint16_t addr, size_t num_bytes)=0
virtual void | write_eeprom (uint16_t addr, uint16_t offset, const byte_vector_t &buf)
virtual byte_vector_t | read_eeprom (uint16_t addr, uint16_t offset, size_t num_bytes)

## Detailed Description

The i2c interface class: Provides i2c and eeprom functionality. A subclass should only have to implement the i2c routines. An eeprom implementation comes for free with the interface.

The eeprom routines are implemented on top of i2c. The built in eeprom implementation only does single byte reads and byte writes over the i2c interface, so it should be portable across multiple eeproms. Override the eeprom routines if this is not acceptable.

## Member Typedef Documentation

## sptr

typedef std::shared_ptr<i2c_iface> uhd::i2c_iface::sptr

## Constructor & Destructor Documentation

## ~i2c_iface()

virtual uhd::i2c_iface::~i2c_iface | ( | void |  | ) |

virtual

## Member Function Documentation

## eeprom16()

i2c_iface::sptr uhd::i2c_iface::eeprom16 | ( | void |  | ) |

Create an i2c_iface than can talk to 16 bit addressable EEPROMS.

## read_eeprom()

virtual byte_vector_t uhd::i2c_iface::read_eeprom | ( | uint16_t | addr,
|  | uint16_t | offset,
|  | size_t | num_bytes )

virtual

Read bytes from an eeprom.

Parameters

  addr | the address
  offset | byte offset
  num_bytes | number of bytes to read

Returns
  a vector of bytes

## read_i2c()

virtual byte_vector_t uhd::i2c_iface::read_i2c | ( | uint16_t | addr,
|  | size_t | num_bytes )

pure virtual

Read bytes over the i2c.

Parameters

  addr | the address
  num_bytes | number of bytes to read

Returns
  a vector of bytes

## write_eeprom()

virtual void uhd::i2c_iface::write_eeprom | ( | uint16_t | addr,
|  | uint16_t | offset,
|  | const byte_vector_t & | buf )

virtual

Write bytes to an eeprom.

Parameters

  addr | the address
  offset | byte offset
  buf | the vector of bytes

## write_i2c()

virtual void uhd::i2c_iface::write_i2c | ( | uint16_t | addr,
|  | const byte_vector_t & | buf )

pure virtual

Write bytes over the i2c.

Parameters

  addr | the address
  buf | the vector of bytes

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

- serial.hpp