peary::interface::Interface
peary::interface::Interface
Abstract base class for communication interfaces. More…
#include <peary/interfaces/Interface.hpp>
Public Types
| Name | |
|---|---|
| using REG_T | reg_type Type aliases for register type, data type, configuration type, and data vector type. |
| using DATA_T | data_type |
| using CONFIG_T | configuration_type |
| using std::vector< data_type > | dataVector_type |
Public Functions
| Name | |
|---|---|
| std::string | devicePath() constGet the device path associated with the interface. |
Protected Functions
| Name | |
|---|---|
| Interface(const InterfaceConfiguration & config)Constructor for Interface class. | |
| virtual | ~Interface() =defaultVirtual destructor for Interface class. |
| virtual DATA_T | write(const DATA_T & )Write a single data word to a device which does not contain internal registers. |
| virtual dataVector_type | write(const dataVector_type & )Write multiple data words to a device which does not contain internal registers. |
| virtual std::pair< REG_T, DATA_T > | write(const std::pair< REG_T, DATA_T > & )Write a single data word to a device containing internal registers. |
| virtual dataVector_type | write(const REG_T & , const dataVector_type & )Write multiple data words to a specific register of a device containing internal registers. |
| virtual std::vector< std::pair< REG_T, DATA_T > > | write(const std::vector< std::pair< REG_T, DATA_T » & )Write multiple data words to multiple registers of a device containing internal registers. |
| virtual DATA_T | read()Read a single data word from a device which does not contain internal registers. |
| virtual dataVector_type | read(const unsigned int )Read multiple data words from a device which does not contain internal registers. |
| virtual dataVector_type | read(const REG_T & , const unsigned int )Read a single data word from a specific register of a device containing internal registers. |
Detailed Description
template <typename REG_T =uint8_t,
typename DATA_T =REG_T,
typename CONFIG_T =InterfaceConfiguration>
class peary::interface::Interface;
Abstract base class for communication interfaces.
Template Parameters:
- REG_T The type used for register addresses (default is uint8_t)
- DATA_T The type used for data (default is REG_T)
- CONFIG_T The type used for interface configuration (default is InterfaceConfiguration)
Public Types Documentation
using reg_type
using peary::interface::Interface< REG_T, DATA_T, CONFIG_T >::reg_type = REG_T;
Type aliases for register type, data type, configuration type, and data vector type.
using data_type
using peary::interface::Interface< REG_T, DATA_T, CONFIG_T >::data_type = DATA_T;
using configuration_type
using peary::interface::Interface< REG_T, DATA_T, CONFIG_T >::configuration_type = CONFIG_T;
using dataVector_type
using peary::interface::Interface< REG_T, DATA_T, CONFIG_T >::dataVector_type = std::vector<data_type>;
Public Functions Documentation
function devicePath
inline std::string devicePath() const
Get the device path associated with the interface.
Protected Functions Documentation
function Interface
inline explicit Interface(
const InterfaceConfiguration & config
)
Constructor for Interface class.
Parameters:
- config The configuration object used to initialize the interface
function ~Interface
virtual ~Interface() =default
Virtual destructor for Interface class.
function write
inline virtual DATA_T write(
const DATA_T &
)
Write a single data word to a device which does not contain internal registers.
Return: The data word read back from the device (if applicable)
Reimplemented by: peary::interface::iface_i2c::write, peary::interface::iface_ipsocket::write, peary::interface::iface_loopback::write
function write
inline virtual dataVector_type write(
const dataVector_type &
)
Write multiple data words to a device which does not contain internal registers.
Return: A vector containing the data words read back from the device (if applicable)
Reimplemented by: peary::interface::iface_loopback::write
function write
inline virtual std::pair< REG_T, DATA_T > write(
const std::pair< REG_T, DATA_T > &
)
Write a single data word to a device containing internal registers.
Return: A pair containing the register address and the data word read back from the device (if applicable)
Reimplemented by: peary::interface::iface_i2c::write, peary::interface::iface_mem::write, peary::interface::iface_sermem::write, peary::interface::iface_loopback::write
function write
inline virtual dataVector_type write(
const REG_T & ,
const dataVector_type &
)
Write multiple data words to a specific register of a device containing internal registers.
Return: A vector containing the data words read back from the device (if applicable)
Reimplemented by: peary::interface::iface_i2c::write, peary::interface::iface_loopback::write
function write
inline virtual std::vector< std::pair< REG_T, DATA_T > > write(
const std::vector< std::pair< REG_T, DATA_T >> &
)
Write multiple data words to multiple registers of a device containing internal registers.
Return: A vector of pairs, each containing a register address and the corresponding data word read back from the device (if applicable)
Reimplemented by: peary::interface::iface_loopback::write
function read
inline virtual DATA_T read()
Read a single data word from a device which does not contain internal registers.
Return: The data word read from the device
function read
inline virtual dataVector_type read(
const unsigned int
)
Read multiple data words from a device which does not contain internal registers.
Return: A vector containing the data words read from the device
Reimplemented by: peary::interface::iface_i2c::read, peary::interface::iface_loopback::read
function read
inline virtual dataVector_type read(
const REG_T & ,
const unsigned int
)
Read a single data word from a specific register of a device containing internal registers.
Return: A vector containing the data words read from the specified register
Reimplemented by: peary::interface::iface_i2c::read, peary::interface::iface_ipsocket::read, peary::interface::iface_mem::read, peary::interface::iface_sermem::read, peary::interface::iface_loopback::read
Updated on 2025-11-14 at 11:31:23 +0100