peary::interface::SPIEndpoint
peary::interface::SPIEndpoint
SPI interface endpoint class. More…
#include <peary/interfaces/SPI/spi.hpp>
Inherits from peary::interface::Endpoint< SpiInterface, uint8_t, uint8_t >
Inherited by peary::interface::SPIBusEndpoint, peary::interface::SPICLICpix2Endpoint
Public Types
| Name | |
|---|---|
| using typename Base::reg_t | reg_t |
| using typename Base::pair_t | pair_t |
| using typename Base::data_t | data_t |
| using typename Base::vector_t | vector_t |
Public Functions
| Name | |
|---|---|
| SPIEndpoint(const std::string & bus)Constructor for SPIEndpoint. | |
| ~SPIEndpoint()Destructor for SPIEndpoint. |
Protected Functions
| Name | |
|---|---|
| pair_t | write_impl(const pair_t & data) overrideWrite data to a register. |
| vector_t | write_impl(const reg_t & reg, const vector_t & data) overrideWrite multiple data to registers. |
| std::vector< pair_t > | write_impl(const std::vector< pair_t > & data) overrideWrite multiple data to registers. |
| vector_t | read_impl(const reg_t & reg, const unsigned int length) overrideRead multiple data from a register. |
Protected Attributes
| Name | |
|---|---|
| int | fd_ |
| const uint32_t | bits_per_word |
Additional inherited members
Public Functions inherited from peary::interface::Endpoint< SpiInterface, uint8_t, uint8_t >
| Name | |
|---|---|
| Endpoint(const Endpoint & ) =delete | |
| Endpoint & | operator=(const Endpoint & ) =delete |
| Endpoint(Endpoint && ) =delete | |
| Endpoint & | operator=(Endpoint && ) =delete |
| std::string | info() constReturn human-readable endpoint information. |
| data_t | write(const data_t & value)Write a single data word to a device which does not contain internal registers. |
| vector_t | write(const vector_t & values)Write multiple data words to a device which does not contain internal registers. |
| pair_t | write(const pair_t & regData)Write a single data word to a device containing internal registers. |
| vector_t | write(const reg_t & reg, const vector_t & values)Write multiple data words to a specific register of a device containing internal registers. |
| std::vector< pair_t > | write(const std::vector< pair_t > & regDataVec)Write multiple data words to multiple registers of a device containing internal registers. |
| data_t | read()Read a single data word from a device which does not contain internal registers. |
| vector_t | read(unsigned int count)Read multiple data words from a device which does not contain internal registers. |
| vector_t | read(const reg_t & reg, unsigned int count)Read a single data word from a specific register of a device containing internal registers. |
Protected Functions inherited from peary::interface::Endpoint< SpiInterface, uint8_t, uint8_t >
| Name | |
|---|---|
| Endpoint(const std::string & info) | |
| virtual | ~Endpoint() =default |
Detailed Description
template <typename REG_T =uint8_t>
class peary::interface::SPIEndpoint;
SPI interface endpoint class.
Template Parameters:
- REG_T The type used for the register address (e.g., uint8_t, uint16_t, etc.)
This class provides SPI communication to endpoints with different register address widths through a template parameter. The common locking of all SPI interface communication is ensured through using the same interface type.
Public Types Documentation
using reg_t
using peary::interface::SPIEndpoint< REG_T >::reg_t = typename Base::reg_t;
using pair_t
using peary::interface::SPIEndpoint< REG_T >::pair_t = typename Base::pair_t;
using data_t
using peary::interface::SPIEndpoint< REG_T >::data_t = typename Base::data_t;
using vector_t
using peary::interface::SPIEndpoint< REG_T >::vector_t = typename Base::vector_t;
Public Functions Documentation
function SPIEndpoint
explicit SPIEndpoint(
const std::string & bus
)
Constructor for SPIEndpoint.
Parameters:
- bus Address of the SPI bus to use
function ~SPIEndpoint
~SPIEndpoint()
Destructor for SPIEndpoint.
Protected Functions Documentation
function write_impl
pair_t write_impl(
const pair_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_impl
vector_t write_impl(
const reg_t & reg,
const vector_t & data
) override
Write multiple data to registers.
Parameters:
- reg The register address to write to
- data A vector containing the data to be written
Return: A vector containing the data read back from the device
function write_impl
std::vector< pair_t > write_impl(
const std::vector< pair_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_impl
vector_t read_impl(
const 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
Protected Attributes Documentation
variable fd_
int fd_;
variable bits_per_word
const uint32_t bits_per_word = 8;
Updated on 2026-01-30 at 22:01:05 +0100