|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
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 | |
| Spi & | operator= (const Spi &)=delete |
| Spi (Spi &&o) noexcept | |
| Move constructor — transfers handle; source becomes empty. | |
| Spi & | operator= (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. | |
RAII wrapper around an oveRTOS SPI bus controller.
Not copyable. Move-only when heap allocation is enabled.
|
inlineexplicit |
Construct and initialise the SPI bus from cfg.
| [in] | cfg | Bus configuration (pins, mode, clock rate). |