peary::interface::iface_spi_bus

Inherits from peary::interface::iface_spi<>, peary::interface::Interface< uint8_t, spi_t >

Public Types

Name
typedef iface_spi_bus_config configuration_type Type definition for the configuration object used by the SPI bus interface.

Public Functions

Name
std::pair< spi_reg_t, spi_t > write(const std::pair< spi_reg_t, spi_t > & data) overrideWrite data to a register.
std::vector< std::pair< spi_reg_t, spi_t > > write(const std::vector< std::pair< spi_reg_t, spi_t » & data) overrideWrite multiple data to registers.
dataVector_type read(const spi_reg_t & reg, const unsigned int length) overrideRead multiple data from a register.
std::pair< spi_reg_t, spi_t > access(const bool rw, const std::pair< spi_reg_t, spi_t > & data)Access a register for read or write operation.
iface_spi_bus() =deleteDeleted default constructor to prevent instantiation without configuration.

Protected Functions

Name
iface_spi_bus(const configuration_type & config)Constructor for iface_spi_bus.
~iface_spi_bus() override =defaultDestructor for iface_spi_bus.

Protected Attributes

Name
const uint8_t _addressBits
const uint8_t _dataBits
const spi_reg_t _addressMask
const spi_t _dataMask
const size_t _length
const bool _ws
const bool _alignMSB

Friends

Name
iface_spi_bus & InterfaceManager::getInterface(const configuration_type & ) Friend function to get an instance of iface_spi_bus from the InterfaceManager.
void InterfaceManager::deleteInterface(iface_spi_bus * ) Friend function to delete an instance of iface_spi_bus from the InterfaceManager.

Additional inherited members

Public Types inherited from peary::interface::iface_spi<>

Name
using REG_T spi_reg_t

Public Functions inherited from peary::interface::iface_spi<>

Name
iface_spi() =deleteDeleted default constructor to prevent instantiation without configuration.

Protected Functions inherited from peary::interface::iface_spi<>

Name
iface_spi(const Interface<>::configuration_type & config)Constructor for iface_spi.
~iface_spi() overrideDestructor for iface_spi.

Protected Attributes inherited from peary::interface::iface_spi<>

Name
int spiDesc
std::mutex mutex
const uint32_t bits_per_word

Public Types inherited from peary::interface::Interface< uint8_t, spi_t >

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 std::vector< data_type > dataVector_type

Public Functions inherited from peary::interface::Interface< uint8_t, spi_t >

Name
std::string devicePath() constGet the device path associated with the interface.

Protected Functions inherited from peary::interface::Interface< uint8_t, spi_t >

Name
Interface(const InterfaceConfiguration & config)Constructor for Interface class.
virtual ~Interface() =defaultVirtual destructor for Interface class.

Public Types Documentation

typedef configuration_type

  typedef iface_spi_bus_config peary::interface::iface_spi_bus::configuration_type;
  

Type definition for the configuration object used by the SPI bus interface.

Public Functions Documentation

function write

  std::pair< spi_reg_t, spi_t > write(
    const std::pair< spi_reg_t, spi_t > & data
) override
  

Write data to a register.

Parameters:

  • data A pair containing the register address and the data to be written

Return: A pair containing the register address and the data read back from the device

function write

  std::vector< std::pair< spi_reg_t, spi_t > > write(
    const std::vector< std::pair< spi_reg_t, spi_t >> & data
) override
  

Write multiple data to registers.

Parameters:

  • data A vector of pairs containing the register addresses and the data to be written

Return: A vector of pairs containing the register addresses and the data read back from the device

function read

  dataVector_type read(
    const spi_reg_t & reg,
    const unsigned int length
) override
  

Read multiple data from a register.

Parameters:

  • reg The register address to read from
  • length The number of data items to read

Return: A vector containing the data read from the device

function access

  std::pair< spi_reg_t, spi_t > access(
    const bool rw,
    const std::pair< spi_reg_t, spi_t > & data
)
  

Access a register for read or write operation.

Parameters:

  • rw A boolean indicating whether the operation is a read (false) or write (true)
  • data A pair containing the register address and the data to be written (for write operations)

function iface_spi_bus

  iface_spi_bus() =delete
  

Deleted default constructor to prevent instantiation without configuration.

Protected Functions Documentation

function iface_spi_bus

  explicit iface_spi_bus(
    const configuration_type & config
)
  

Constructor for iface_spi_bus.

Parameters:

  • config The configuration object for the SPI bus interface

function ~iface_spi_bus

  ~iface_spi_bus() override =default
  

Destructor for iface_spi_bus.

Protected Attributes Documentation

variable _addressBits

  const uint8_t _addressBits;
  

variable _dataBits

  const uint8_t _dataBits;
  

variable _addressMask

  const spi_reg_t _addressMask;
  

variable _dataMask

  const spi_t _dataMask;
  

variable _length

  const size_t _length;
  

variable _ws

  const bool _ws;
  

variable _alignMSB

  const bool _alignMSB;
  

Friends

friend InterfaceManager::getInterface

  friend iface_spi_bus & InterfaceManager::getInterface(
    const configuration_type & 
);
  

Friend function to get an instance of iface_spi_bus from the InterfaceManager.

Return: A reference to the iface_spi_bus instance

friend InterfaceManager::deleteInterface

  friend void InterfaceManager::deleteInterface(
    iface_spi_bus * 
);
  

Friend function to delete an instance of iface_spi_bus from the InterfaceManager.


Updated on 2025-11-14 at 11:31:23 +0100