SparkFun Toolkit  v1.0.5-6-g34ffa30
Core Functionality Library
Loading...
Searching...
No Matches
sfTkIBus Class Referenceabstract

Interface that defines the communication bus for the SparkFun Electronics Toolkit. More...

#include <sfTkIBus.h>

Inheritance diagram for sfTkIBus:

Public Member Functions

 sfTkIBus ()
 Constructor. More...
 
virtual sfTkError_t writeRegister (uint8_t *devReg, size_t regLength, const uint8_t *data, size_t length)=0
 Writes an array of bytes to a register on the target address. Supports any address size. More...
 
virtual sfTkError_t writeData (uint8_t data)
 Writes a 8-bit data value. More...
 
sfTkError_t writeUInt8 (uint8_t data)
 Writes a 8-bit data value. More...
 
virtual sfTkError_t writeData (uint16_t data)
 Send a 16 bit value to the device. More...
 
sfTkError_t writeUInt16 (uint16_t data)
 Send a 16 bit value to the device. More...
 
virtual sfTkError_t writeData (uint32_t data)
 Writes a 32-bit data value. More...
 
sfTkError_t writeUInt32 (uint32_t data)
 Writes a 32-bit data value. More...
 
virtual sfTkError_t writeData (const uint8_t *data, size_t length)
 Writes an array. More...
 
sfTkError_t writeRegister (uint8_t devReg, uint8_t data)
 Write a single byte (8 bit) to the given register. More...
 
sfTkError_t writeRegisterUInt8 (uint8_t reg, uint8_t data)
 Write a single byte (8 bit) to the given register. More...
 
virtual sfTkError_t writeRegister (uint8_t devReg, const uint16_t data)
 Write a single word (16 bit) to the given register. More...
 
sfTkError_t writeRegisterUInt16 (uint8_t reg, uint16_t data)
 Write a single word (16 bit) to the given register. More...
 
virtual sfTkError_t writeRegister (uint8_t devReg, const uint32_t data)
 Writes a 32-bit data value to a specified device register. More...
 
sfTkError_t writeRegisterUInt32 (uint8_t reg, uint32_t data)
 Writes a 32-bit data value to a specified device register. More...
 
virtual sfTkError_t writeRegister (uint8_t devReg, const uint8_t *data, size_t length)
 Writes a number of bytes starting at the given register's address. More...
 
virtual sfTkError_t writeRegister (uint16_t devReg, const uint8_t *data, size_t length)
 Writes a number of bytes starting at the given register's 16-bit address. More...
 
virtual sfTkError_t writeRegister (uint16_t devReg, const uint8_t data)
 Writes a 8-bit data value to a specified device register. More...
 
sfTkError_t writeRegisterUInt8 (uint16_t reg, const uint8_t data)
 Writes a 8-bit data value to a specified device register. More...
 
virtual sfTkError_t writeRegister (uint16_t devReg, const uint16_t data)
 Writes a 16-bit data value to a specified device 16bit register. More...
 
sfTkError_t writeRegisterUInt16 (uint16_t reg, const uint16_t data)
 Writes a 16-bit data value to a specified device 16bit register. More...
 
virtual sfTkError_t writeRegister (uint16_t devReg, const uint32_t data)
 Writes a 32-bit data value to a specified device register. More...
 
sfTkError_t writeRegisterUInt32 (uint16_t reg, const uint32_t data)
 Writes a 32-bit data value to a specified device register. More...
 
virtual sfTkError_t writeRegister (uint16_t devReg, const uint16_t *data, size_t length)
 Writes a number of uint16's starting at the given register's 16-bit address. More...
 
virtual sfTkError_t readRegister (uint8_t *devReg, size_t regLength, uint8_t *data, size_t numBytes, size_t &readBytes, uint32_t read_delay=0)=0
 Reads an array of bytes to a register on the target address. Supports any address size. More...
 
virtual sfTkError_t readRegister (uint8_t devReg, uint8_t &data)
 Read a single byte from the given register. More...
 
sfTkError_t readRegisterUInt8 (uint8_t devReg, uint8_t &data)
 Read a single byte from the given register. More...
 
virtual sfTkError_t readRegister (uint8_t devReg, uint16_t &data)
 Read a single word (16 bit) from the given register. More...
 
sfTkError_t readRegisterUInt16 (uint8_t devReg, uint16_t &data)
 Read a single word (16 bit) from the given register. More...
 
virtual sfTkError_t readRegister (uint8_t devReg, uint32_t &data)
 Read a 32 bit value from the given register. More...
 
sfTkError_t readRegisterUInt32 (uint8_t devReg, uint32_t &data)
 Read a 32 bit value from the given register. More...
 
virtual sfTkError_t readRegister (uint8_t devReg, uint8_t *data, size_t numBytes, size_t &readBytes)
 Reads data from a specified register. More...
 
virtual sfTkError_t readRegister (uint16_t reg, uint8_t &value)
 Overloaded function to read a 8-bit value from the given 16-bit register address. More...
 
sfTkError_t readRegisterUInt8 (uint16_t devReg, uint8_t &data)
 Overloaded function to read a 8-bit value from the given 16-bit register address. More...
 
virtual sfTkError_t readRegister (uint16_t reg, uint16_t &value)
 Overloaded function to read a 16-bit value from the given 16-bit register address. More...
 
sfTkError_t readRegisterUInt16 (uint16_t devReg, uint16_t &data)
 Overloaded function to read a 16-bit value from the given 16-bit register address. More...
 
virtual sfTkError_t readRegister (uint16_t reg, uint32_t &value)
 Overloaded function to read a 32-bit value from the given 16-bit register address. More...
 
sfTkError_t readRegisterUInt32 (uint16_t devReg, uint32_t &data)
 Overloaded function to read a 32-bit value from the given 16-bit register address. More...
 
sfTkError_t readRegister (uint16_t devReg, uint8_t *data, size_t numBytes, size_t &readBytes)
 Reads a specified number of bytes from a given register with a 16bit address. More...
 
virtual sfTkError_t readRegister (uint16_t reg, uint16_t *data, size_t length, size_t &read16)
 Reads a 16-bit block of data from the given 16-bit register address. More...
 
virtual uint8_t type (void)
 Get the type of the object. More...
 
void setByteOrder (sfTkByteOrder order)
 Set the byte order for multi-byte data transfers. More...
 
sfTkByteOrder byteOrder (void)
 Get the current byte order. More...
 

Protected Attributes

sfTkByteOrder _byteOrder
 

Detailed Description

Interface that defines the communication bus for the SparkFun Electronics Toolkit.

The bus interface defines the basic methods for reading and writing data to a device. Specific bus implementations will extend this interface to provide the necessary functionality for the desired bus type.

Constructor & Destructor Documentation

◆ sfTkIBus()

sfTkIBus::sfTkIBus ( )
inline

Constructor.

Member Function Documentation

◆ byteOrder()

sfTkByteOrder sfTkIBus::byteOrder ( void  )
inline

Get the current byte order.

Return values
Thecurrent byte order

◆ readRegister() [1/10]

sfTkError_t sfTkIBus::readRegister ( uint16_t  devReg,
uint8_t *  data,
size_t  numBytes,
size_t &  readBytes 
)
inline

Reads a specified number of bytes from a given register with a 16bit address.

This function reads data from a 16-bit register and stores it in the provided buffer.

Parameters
devRegThe 16-bit register address to read from. Byteswapped if needed.
dataPointer to the buffer where the read data will be stored.
numBytesThe number of bytes to read from the register.
readBytesReference to a variable where the number of bytes actually read will be stored.
Returns
sfTkError_t Error code indicating the success or failure of the read operation.

◆ readRegister() [2/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint16_t  reg,
uint16_t &  value 
)
inlinevirtual

Overloaded function to read a 16-bit value from the given 16-bit register address.

This function reads a 16-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed.
[out]valueThe 16-bit value read from the register. The value is byte swapped if needed.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [3/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint16_t  reg,
uint16_t *  data,
size_t  length,
size_t &  read16 
)
inlinevirtual

Reads a 16-bit block of data from the given 16-bit register address.


Parameters
regThe device's 16 bit register's address. Byteswapped if needed
dataData area to read into - byteswapped if needed
length- length of data (16 bit element count)
[out]read16- number of 16 bit words read
Return values
intreturns ksfTkErrOk on success, or ksfTkErrFail code

Reimplemented in sfTkArdI2C, sfTkArdSPI, and sfTkArdSPI.

◆ readRegister() [4/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint16_t  reg,
uint32_t &  value 
)
inlinevirtual

Overloaded function to read a 32-bit value from the given 16-bit register address.

This function reads a 32-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed.
[out]valueThe 32-bit value read from the register. The value is byte swapped if needed.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [5/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint16_t  reg,
uint8_t &  value 
)
inlinevirtual

Overloaded function to read a 8-bit value from the given 16-bit register address.

This function reads a 8-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed
[out]valueThe 8-bit value read from the register.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [6/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint8_t *  devReg,
size_t  regLength,
uint8_t *  data,
size_t  numBytes,
size_t &  readBytes,
uint32_t  read_delay = 0 
)
pure virtual

Reads an array of bytes to a register on the target address. Supports any address size.

Parameters
devRegThe device's register's address - can be any size
regLengthThe length of the register address
dataThe data to buffer to read into
numBytesThe length of the data buffer
readBytes[out]The number of bytes read
read_delayAfter sending the address, delay in milliseconds before reading the data
Returns
sfTkError_t Returns ksfTkErrOk on success, or ksfTkErrFail code

Implemented in sfTkArdI2C, sfTkArdSPI, sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [7/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint8_t  devReg,
uint16_t &  data 
)
inlinevirtual

Read a single word (16 bit) from the given register.


Parameters
devRegThe device's register's address.
dataData to read.– the data value is byteswapped if needed
Return values
sfTkError_t- ksfTkErrOk on successful execution.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [8/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint8_t  devReg,
uint32_t &  data 
)
inlinevirtual

Read a 32 bit value from the given register.


Parameters
devRegThe device's register's address.
dataData to read. The data value is byteswapped if needed
Return values
sfTkError_t- ksfTkErrOk on successful execution.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [9/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint8_t  devReg,
uint8_t &  data 
)
inlinevirtual

Read a single byte from the given register.


Parameters
devRegThe device's register's address.
dataData to read.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegister() [10/10]

virtual sfTkError_t sfTkIBus::readRegister ( uint8_t  devReg,
uint8_t *  data,
size_t  numBytes,
size_t &  readBytes 
)
inlinevirtual

Reads data from a specified register.

This function reads a specified number of bytes from a given register and stores the data in the provided buffer.

Parameters
devRegThe register address to read from.
dataPointer to the buffer where the read data will be stored.
numBytesThe number of bytes to read from the register.
readBytesReference to a variable where the number of bytes actually read will be stored.
Returns
sfTkError_t Error code indicating the success or failure of the read operation.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ readRegisterUInt16() [1/2]

sfTkError_t sfTkIBus::readRegisterUInt16 ( uint16_t  devReg,
uint16_t &  data 
)
inline

Overloaded function to read a 16-bit value from the given 16-bit register address.

This function reads a 16-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed.
[out]valueThe 16-bit value read from the register. The value is byte swapped if needed.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

◆ readRegisterUInt16() [2/2]

sfTkError_t sfTkIBus::readRegisterUInt16 ( uint8_t  devReg,
uint16_t &  data 
)
inline

Read a single word (16 bit) from the given register.


Parameters
devRegThe device's register's address.
dataData to read.– the data value is byteswapped if needed
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ readRegisterUInt32() [1/2]

sfTkError_t sfTkIBus::readRegisterUInt32 ( uint16_t  devReg,
uint32_t &  data 
)
inline

Overloaded function to read a 32-bit value from the given 16-bit register address.

This function reads a 32-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed.
[out]valueThe 32-bit value read from the register. The value is byte swapped if needed.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

◆ readRegisterUInt32() [2/2]

sfTkError_t sfTkIBus::readRegisterUInt32 ( uint8_t  devReg,
uint32_t &  data 
)
inline

Read a 32 bit value from the given register.


Parameters
devRegThe device's register's address.
dataData to read. The data value is byteswapped if needed
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ readRegisterUInt8() [1/2]

sfTkError_t sfTkIBus::readRegisterUInt8 ( uint16_t  devReg,
uint8_t &  data 
)
inline

Overloaded function to read a 8-bit value from the given 16-bit register address.

This function reads a 8-bit value from the specified 16-bit register address.

Parameters
regThe device's 16-bit register's address. The address is byteswapped if needed
[out]valueThe 8-bit value read from the register.
Returns
sfTkError_t Returns ksfTkErrOk on success, or an error code on failure.

◆ readRegisterUInt8() [2/2]

sfTkError_t sfTkIBus::readRegisterUInt8 ( uint8_t  devReg,
uint8_t &  data 
)
inline

Read a single byte from the given register.


Parameters
devRegThe device's register's address.
dataData to read.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ setByteOrder()

void sfTkIBus::setByteOrder ( sfTkByteOrder  order)
inline

Set the byte order for multi-byte data transfers.

Parameters
orderThe byte order to set - set to either sfTkByteOrder::BigEndian or sfTkByteOrder::LittleEndian

◆ type()

virtual uint8_t sfTkIBus::type ( void  )
inlinevirtual

Get the type of the object.

This virtual function returns the type of the object as an 8-bit unsigned integer. The default implementation returns 0. It is expected that the subclass will define and implement a type methodology

Returns
uint8_t The type of the object.

Reimplemented in sfTkII2C, and sfTkISPI.

◆ writeData() [1/4]

virtual sfTkError_t sfTkIBus::writeData ( const uint8_t *  data,
size_t  length 
)
inlinevirtual

Writes an array.


This function writes a 8-bit data array

Parameters
dataThe 8-bit data array to be written. The data is byteswapped if needed.
lengthThe length of the data array to be written.
Returns
sfTkError_t The status of the write operation.

◆ writeData() [2/4]

virtual sfTkError_t sfTkIBus::writeData ( uint16_t  data)
inlinevirtual

Send a 16 bit value to the device.


Parameters
dataData to write. If the byte order is different than system byteorder, data is byteswapped
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ writeData() [3/4]

virtual sfTkError_t sfTkIBus::writeData ( uint32_t  data)
inlinevirtual

Writes a 32-bit data value.


This function writes a 32-bit data value

Parameters
dataThe 32-bit data value to be written. The data is byteswapped if needed.
Returns
sfTkError_t The status of the write operation.

◆ writeData() [4/4]

virtual sfTkError_t sfTkIBus::writeData ( uint8_t  data)
inlinevirtual

Writes a 8-bit data value.


This function writes a 8-bit data value

Parameters
dataThe 8-bit data value to be written.
Returns
sfTkError_t The status of the write operation.

◆ writeRegister() [1/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint16_t  devReg,
const uint16_t *  data,
size_t  length 
)
inlinevirtual

Writes a number of uint16's starting at the given register's 16-bit address.


Parameters
devRegThe device's register's address.
data16 bit Data to write. This value is byteswapped if the byteorder set is different than the systems byteorder
length- length of data
Return values
sfTkError_tksfTkErrOk on successful execution

Reimplemented in sfTkArdI2C, sfTkArdSPI, and sfTkArdSPI.

◆ writeRegister() [2/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint16_t  devReg,
const uint16_t  data 
)
inlinevirtual

Writes a 16-bit data value to a specified device 16bit register.

This function writes a 16-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe 16 bit register address to write to.
dataThe 16-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [3/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint16_t  devReg,
const uint32_t  data 
)
inlinevirtual

Writes a 32-bit data value to a specified device register.

This function writes a 32-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe register address to write to.
dataThe 32-bit data value to write. This value is byteswapped if the byteorder set is different that the systems byteorder
Returns
sfTkError_t Error code indicating the success or failure of the operation.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [4/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint16_t  devReg,
const uint8_t *  data,
size_t  length 
)
inlinevirtual

Writes a number of bytes starting at the given register's 16-bit address.


Parameters
devRegThe device's register's 16 bit address. If the byteorder is different than the systems, the address is byteswapped
dataData to write.
length- length of data
Return values
sfTkError_tksfTkErrOk on successful execution

Reimplemented in sfTkArdI2C, sfTkArdSPI, and sfTkArdSPI.

◆ writeRegister() [5/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint16_t  devReg,
const uint8_t  data 
)
inlinevirtual

Writes a 8-bit data value to a specified device register.

This function writes a 16-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe device's register's 16 bit address. If the byteorder is different than the systems, the address is byteswapped
dataThe 8-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [6/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint8_t *  devReg,
size_t  regLength,
const uint8_t *  data,
size_t  length 
)
pure virtual

Writes an array of bytes to a register on the target address. Supports any address size.

Note
This is the minimum required write method to implement for a driver
Parameters
devRegThe device's register's address - can be any size, If nullptr, address is not sent
regLengthThe length of the register address. If 0, address is not sent
dataThe data to write
lengthThe length of the data buffer
Returns
sfTkError_t Returns ksfTkErrOk on success, or ksfTkErrFail code

Implemented in sfTkArdI2C, sfTkArdSPI, sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [7/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint8_t  devReg,
const uint16_t  data 
)
inlinevirtual

Write a single word (16 bit) to the given register.


Parameters
devRegThe device's register's address.
dataData to write. Note - if byte order differs, swap the data before writing.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [8/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint8_t  devReg,
const uint32_t  data 
)
inlinevirtual

Writes a 32-bit data value to a specified device register.

This function writes a 32-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe register address to write to.
dataThe 32-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [9/10]

virtual sfTkError_t sfTkIBus::writeRegister ( uint8_t  devReg,
const uint8_t *  data,
size_t  length 
)
inlinevirtual

Writes a number of bytes starting at the given register's address.


Parameters
devRegThe device's register's address.
dataData to write.
length- length of data
Return values
sfTkError_tksfTkErrOk on successful execution

Reimplemented in sfTkArdI2C, and sfTkArdSPI.

◆ writeRegister() [10/10]

sfTkError_t sfTkIBus::writeRegister ( uint8_t  devReg,
uint8_t  data 
)
inline

Write a single byte (8 bit) to the given register.


Parameters
devRegThe device's register's address.
dataData to write. Note - if byte order differs, swap the data before writing.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ writeRegisterUInt16() [1/2]

sfTkError_t sfTkIBus::writeRegisterUInt16 ( uint16_t  reg,
const uint16_t  data 
)
inline

Writes a 16-bit data value to a specified device 16bit register.

This function writes a 16-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe 16 bit register address to write to.
dataThe 16-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

◆ writeRegisterUInt16() [2/2]

sfTkError_t sfTkIBus::writeRegisterUInt16 ( uint8_t  reg,
uint16_t  data 
)
inline

Write a single word (16 bit) to the given register.


Parameters
devRegThe device's register's address.
dataData to write. Note - if byte order differs, swap the data before writing.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ writeRegisterUInt32() [1/2]

sfTkError_t sfTkIBus::writeRegisterUInt32 ( uint16_t  reg,
const uint32_t  data 
)
inline

Writes a 32-bit data value to a specified device register.

This function writes a 32-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe register address to write to.
dataThe 32-bit data value to write. This value is byteswapped if the byteorder set is different that the systems byteorder
Returns
sfTkError_t Error code indicating the success or failure of the operation.

◆ writeRegisterUInt32() [2/2]

sfTkError_t sfTkIBus::writeRegisterUInt32 ( uint8_t  reg,
uint32_t  data 
)
inline

Writes a 32-bit data value to a specified device register.

This function writes a 32-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe register address to write to.
dataThe 32-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

◆ writeRegisterUInt8() [1/2]

sfTkError_t sfTkIBus::writeRegisterUInt8 ( uint16_t  reg,
const uint8_t  data 
)
inline

Writes a 8-bit data value to a specified device register.

This function writes a 16-bit data value to a specified device register. If the system byte order differs from the byte order expected by the device, the data value is byte-swapped before being written.

Parameters
devRegThe device's register's 16 bit address. If the byteorder is different than the systems, the address is byteswapped
dataThe 8-bit data value to write.
Returns
sfTkError_t Error code indicating the success or failure of the operation.

◆ writeRegisterUInt8() [2/2]

sfTkError_t sfTkIBus::writeRegisterUInt8 ( uint8_t  reg,
uint8_t  data 
)
inline

Write a single byte (8 bit) to the given register.


Parameters
devRegThe device's register's address.
dataData to write. Note - if byte order differs, swap the data before writing.
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ writeUInt16()

sfTkError_t sfTkIBus::writeUInt16 ( uint16_t  data)
inline

Send a 16 bit value to the device.


Parameters
dataData to write. If the byte order is different than system byteorder, data is byteswapped
Return values
sfTkError_t- ksfTkErrOk on successful execution.

◆ writeUInt32()

sfTkError_t sfTkIBus::writeUInt32 ( uint32_t  data)
inline

Writes a 32-bit data value.


This function writes a 32-bit data value

Parameters
dataThe 32-bit data value to be written. The data is byteswapped if needed.
Returns
sfTkError_t The status of the write operation.

◆ writeUInt8()

sfTkError_t sfTkIBus::writeUInt8 ( uint8_t  data)
inline

Writes a 8-bit data value.


This function writes a 8-bit data value

Parameters
dataThe 8-bit data value to be written.
Returns
sfTkError_t The status of the write operation.

Member Data Documentation

◆ _byteOrder

sfTkByteOrder sfTkIBus::_byteOrder
protected

Flag to manage byte swapping


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