DUNE: Uniform Navigational Environment  2.6.0-rc1
DUNE::Hardware::I2C Class Reference

Classes

class  Error
 

Public Member Functions

 I2C (const std::string &bus_dev)
 
 ~I2C (void)
 
int transfer (uint8_t adr, uint8_t cmd, const uint8_t *wdata, uint8_t wlen, uint8_t *rdata, uint8_t rlen, uint8_t *bytes_read)
 
unsigned read (uint8_t adr, uint8_t *bfr, unsigned bfr_len)
 
void connect (uint8_t addr)
 
unsigned read (uint8_t *bfr, unsigned bfr_len)
 
unsigned write (const uint8_t *bfr, unsigned bfr_len)
 

Constructor & Destructor Documentation

DUNE::Hardware::I2C::I2C ( const std::string &  bus_dev)
DUNE::Hardware::I2C::~I2C ( void  )

I2C destructor.

Member Function Documentation

void DUNE::Hardware::I2C::connect ( uint8_t  addr)

Connect to slave address.

Parameters
addrslave address.

References DUNE::System::Error::getLastMessage().

Referenced by Power::MCBv2::MCP23017::MCP23017(), and DUNE::Hardware::LUCL::Protocol::open().

unsigned DUNE::Hardware::I2C::read ( uint8_t  adr,
uint8_t *  bfr,
unsigned  bfr_len 
)
unsigned DUNE::Hardware::I2C::read ( uint8_t *  bfr,
unsigned  bfr_len 
)
int DUNE::Hardware::I2C::transfer ( uint8_t  adr,
uint8_t  cmd,
const uint8_t *  wdata,
uint8_t  wlen,
uint8_t *  rdata,
uint8_t  rlen,
uint8_t *  bytes_read 
)

Initialize an I2C transfer.

Parameters
adrslave address.
cmdcommand to send.
wdatadata to write.
wlennumber of bytes to write (or in 0x80 for a block write).
rdataplace to store data read.
rlennumber of bytes to read (or in 0x80 for a block read).
bytes_readplace to store number of bytes read.
unsigned DUNE::Hardware::I2C::write ( const uint8_t *  bfr,
unsigned  bfr_len 
)
Collaboration diagram for DUNE::Hardware::I2C:
Collaboration graph