SparkFun Toolkit  v1.0.6-1-gcf794e0
Core Functionality Library
Loading...
Searching...
No Matches
sfTkII2C Class Referenceabstract

#include <sfTkII2C.h>

Inheritance diagram for sfTkII2C:

Public Member Functions

 sfTkII2C ()
 Constructor for the I2C bus. More...
 
 sfTkII2C (uint8_t addr)
 Constructor for the I2C bus with an address passed in. More...
 
virtual sfTkError_t ping ()=0
 A simple ping of the device at the set address. More...
 
virtual void setAddress (uint8_t devAddr)
 setter for the I2C address More...
 
virtual uint8_t address (void)
 getter for the I2C address More...
 
virtual void setStop (bool stop)
 setter for I2C stop message (vs restarts) More...
 
virtual bool stop (void)
 getter for I2C stops message (vs restarts) More...
 
virtual uint8_t type (void)
 Get the type of the object. More...
 
- Public Member Functions inherited from sfTkIBus
 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...
 

Static Public Attributes

static constexpr uint8_t kNoAddress = 0
 kNoAddress is a constant to indicate no address has been set More...
 

Additional Inherited Members

- Protected Attributes inherited from sfTkIBus
sfTkByteOrder _byteOrder
 

Constructor & Destructor Documentation

◆ sfTkII2C() [1/2]

sfTkII2C::sfTkII2C ( )
inline

Constructor for the I2C bus.

◆ sfTkII2C() [2/2]

sfTkII2C::sfTkII2C ( uint8_t  addr)
inline

Constructor for the I2C bus with an address passed in.

Parameters
addr

Member Function Documentation

◆ address()

virtual uint8_t sfTkII2C::address ( void  )
inlinevirtual

getter for the I2C address


Return values
uint8_treturns the address for the device

◆ ping()

virtual sfTkError_t sfTkII2C::ping ( )
pure virtual

A simple ping of the device at the set address.


Return values
sfTkError_t- ok on success

Implemented in sfTkArdI2C.

◆ setAddress()

virtual void sfTkII2C::setAddress ( uint8_t  devAddr)
inlinevirtual

setter for the I2C address


Parameters
devAddrThe device's address

◆ setStop()

virtual void sfTkII2C::setStop ( bool  stop)
inlinevirtual

setter for I2C stop message (vs restarts)


Parameters
stopThe value to set for "send stop"

◆ stop()

virtual bool sfTkII2C::stop ( void  )
inlinevirtual

getter for I2C stops message (vs restarts)


Return values
boolreturns the value of "send stop"

◆ type()

virtual uint8_t sfTkII2C::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 from sfTkIBus.

Member Data Documentation

◆ kNoAddress

constexpr uint8_t sfTkII2C::kNoAddress = 0
staticconstexpr

kNoAddress is a constant to indicate no address has been set


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