oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::Spi Class Reference

RAII wrapper around an oveRTOS SPI bus controller. More...

#include <spi.hpp>

Public Member Functions

 Spi (const struct ove_spi_cfg &cfg)
 Construct and initialise the SPI bus from cfg.
 
 Spi (const Spi &)=delete
 
Spioperator= (const Spi &)=delete
 
 Spi (Spi &&o) noexcept
 Move constructor — transfers handle; source becomes empty.
 
Spioperator= (Spi &&o) noexcept
 Move-assignment — destroys current bus, then takes o's handle.
 
Result< void > transfer (const struct ove_spi_cs *cs, const void *tx, void *rx, size_t len, std::chrono::nanoseconds timeout=wait_forever) noexcept
 Full-duplex transfer — sends tx and receives into rx.
 
Result< void > write (const struct ove_spi_cs *cs, const void *data, size_t len, std::chrono::nanoseconds timeout=wait_forever) noexcept
 Write-only transfer — receive data is discarded.
 
Result< void > read (const struct ove_spi_cs *cs, void *buf, size_t len, std::chrono::nanoseconds timeout=wait_forever) noexcept
 Read-only transfer — transmit sends zeros.
 
Result< void > transfer_seq (const struct ove_spi_cs *cs, const struct ove_spi_xfer *xfers, unsigned int num_xfers, std::chrono::nanoseconds timeout=wait_forever) noexcept
 Execute a sequence of transfers under a single CS assertion.
 
ove_spi_t handle () const
 Returns the underlying C handle.
 

Detailed Description

RAII wrapper around an oveRTOS SPI bus controller.

Not copyable. Move-only when heap allocation is enabled.

Constructor & Destructor Documentation

◆ Spi()

ove::Spi::Spi ( const struct ove_spi_cfg &  cfg)
inlineexplicit

Construct and initialise the SPI bus from cfg.

Parameters
[in]cfgBus configuration (pins, mode, clock rate).

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