Treehopper Java API
io.treehopper.SMBusDevice Class Reference

Device class used to abstract SMBus-compliant peripherals. More...

Public Member Functions

 SMBusDevice (byte address, I2c I2CModule)
 Construct an SMBus peripheral with a communication rate of 100 kHz. More...
 
 SMBusDevice (byte address, I2c I2cModule, int rateKHz)
 Construct an SMBus peripheral. More...
 
byte readByte ()
 Read a single byte from the device. More...
 
void writeByte (byte data)
 Write a byte to the device. More...
 
short readWord ()
 Read a little-endian 16-bit word from the device. More...
 
void writeWord (short data)
 Write a little-endian 16-bit word to the device. More...
 
short readWordBE ()
 Read a big-endian 16-bit word from the device. More...
 
void writeWordBE (short data)
 Write a big-endian 16-bit word to the device. More...
 
byte [] readData (byte numBytesToRead)
 Read data directly from the device. More...
 
void writeData (byte[] data)
 Write data directly to the device. More...
 
byte readByteData (byte register)
 Read a byte from the specified register. More...
 
void writeByteData (byte register, byte data)
 Write a byte to the specified register. More...
 
short readWordData (byte register)
 Read a little-endian 16-bit word from the given register. More...
 
void writeWordData (byte register, int data)
 Write a little-endian 16-bit word to the given register. More...
 
short readWordDataBE (byte register)
 Read a big-endian 16-bit word from the given register. More...
 
void writeWordDataBE (byte register, int data)
 Write a big-endian 16-bit word to the given register. More...
 
byte [] readBufferData (byte register, int numBytes)
 Read a byte array from the given register. More...
 
void writeBufferData (byte register, byte[] buffer)
 Write a byte array to the given register. More...
 

Detailed Description

Device class used to abstract SMBus-compliant peripherals.

Constructor & Destructor Documentation

◆ SMBusDevice() [1/2]

io.treehopper.SMBusDevice.SMBusDevice ( byte  address,
I2c  I2CModule 
)

Construct an SMBus peripheral with a communication rate of 100 kHz.

Parameters
addressthe address of the peripheral
I2CModulethe I2c module to use

◆ SMBusDevice() [2/2]

io.treehopper.SMBusDevice.SMBusDevice ( byte  address,
I2c  I2cModule,
int  rateKHz 
)

Construct an SMBus peripheral.

Parameters
addressthe address of the peripheral
I2cModulethe I2c module to use
rateKHzthe data rate, in kHz, to use

Member Function Documentation

◆ readBufferData()

byte [] io.treehopper.SMBusDevice.readBufferData ( byte  register,
int  numBytes 
)

Read a byte array from the given register.

Parameters
registerthe register to read from
numBytesthe number of bytes to read
Returns
the data read

◆ readByte()

byte io.treehopper.SMBusDevice.readByte ( )

Read a single byte from the device.

Returns
the byte read

◆ readByteData()

byte io.treehopper.SMBusDevice.readByteData ( byte  register)

Read a byte from the specified register.

Parameters
registerthe register to read from
Returns
the byte read

◆ readData()

byte [] io.treehopper.SMBusDevice.readData ( byte  numBytesToRead)

Read data directly from the device.

Parameters
numBytesToReadthe number of bytes to read
Returns
the read data

◆ readWord()

short io.treehopper.SMBusDevice.readWord ( )

Read a little-endian 16-bit word from the device.

Returns
the 16-bit value read from the device

◆ readWordBE()

short io.treehopper.SMBusDevice.readWordBE ( )

Read a big-endian 16-bit word from the device.

Returns
the 16-bit value read from the device

◆ readWordData()

short io.treehopper.SMBusDevice.readWordData ( byte  register)

Read a little-endian 16-bit word from the given register.

Parameters
registerthe register to read from
Returns
the 16-bit word

◆ readWordDataBE()

short io.treehopper.SMBusDevice.readWordDataBE ( byte  register)

Read a big-endian 16-bit word from the given register.

Parameters
registerthe register to read from
Returns
the 16-bit word

◆ writeBufferData()

void io.treehopper.SMBusDevice.writeBufferData ( byte  register,
byte []  buffer 
)

Write a byte array to the given register.

Parameters
registerthe register to write to
bufferthe byte array to write

◆ writeByte()

void io.treehopper.SMBusDevice.writeByte ( byte  data)

Write a byte to the device.

Parameters
datathe byte to write

◆ writeByteData()

void io.treehopper.SMBusDevice.writeByteData ( byte  register,
byte  data 
)

Write a byte to the specified register.

Parameters
registerthe register to write to
datathe data to write

◆ writeData()

void io.treehopper.SMBusDevice.writeData ( byte []  data)

Write data directly to the device.

Parameters
datathe data to write to the device

◆ writeWord()

void io.treehopper.SMBusDevice.writeWord ( short  data)

Write a little-endian 16-bit word to the device.

Parameters
datathe 16-bit value to write to the device

◆ writeWordBE()

void io.treehopper.SMBusDevice.writeWordBE ( short  data)

Write a big-endian 16-bit word to the device.

Parameters
datathe 16-bit value to write to the device

◆ writeWordData()

void io.treehopper.SMBusDevice.writeWordData ( byte  register,
int  data 
)

Write a little-endian 16-bit word to the given register.

Parameters
registerthe register to write to
datathe data to write

◆ writeWordDataBE()

void io.treehopper.SMBusDevice.writeWordDataBE ( byte  register,
int  data 
)

Write a big-endian 16-bit word to the given register.

Parameters
registerthe register to write the word to
datathe data to write

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