|
| virtual | ~BaseSpi () noexcept=default |
| | Virtual destructor ensures proper cleanup in derived classes.
|
| |
| | BaseSpi (const BaseSpi &)=delete |
| |
| BaseSpi & | operator= (const BaseSpi &)=delete |
| |
| | BaseSpi (BaseSpi &&)=delete |
| |
| BaseSpi & | operator= (BaseSpi &&)=delete |
| |
| bool | EnsureInitialized () noexcept |
| | Ensures that the SPI bus is initialized (lazy initialization).
|
| |
| bool | EnsureDeinitialized () noexcept |
| | Ensures that the SPI bus is deinitialized (lazy deinitialization).
|
| |
| bool | IsInitialized () const noexcept |
| | Checks if the bus is initialized.
|
| |
| virtual bool | Initialize () noexcept=0 |
| | Initialize the SPI bus.
|
| |
| virtual bool | Deinitialize () noexcept=0 |
| | Deinitialize the SPI bus.
|
| |
| virtual hf_spi_err_t | Transfer (const hf_u8_t *tx_data, hf_u8_t *rx_data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept=0 |
| | Perform a full-duplex SPI transfer.
|
| |
| virtual const void * | GetDeviceConfig () const noexcept=0 |
| | Get the device configuration for this SPI device.
|
| |
| virtual bool | Open () noexcept |
| | Legacy compatibility: Open and initialize the SPI bus.
|
| |
| virtual bool | Close () noexcept |
| | Legacy compatibility: Close and de-initialize the SPI bus.
|
| |
| virtual bool | Transfer (const hf_u8_t *tx_data, hf_u8_t *rx_data, hf_u16_t length) noexcept |
| | Legacy compatibility: Transfer with boolean return.
|
| |
| virtual hf_spi_err_t | Write (const hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept |
| | Write data to SPI bus.
|
| |
| virtual hf_spi_err_t | Read (hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept |
| | Read data from SPI bus.
|
| |
| virtual bool | Write (const hf_u8_t *data, hf_u16_t length) noexcept |
| | Legacy compatibility: Write with boolean return.
|
| |
| virtual bool | Read (hf_u8_t *data, hf_u16_t length) noexcept |
| | Legacy compatibility: Read with boolean return.
|
| |
| virtual bool | WriteByte (hf_u8_t data) noexcept |
| | Write single byte to SPI bus.
|
| |
| virtual bool | ReadByte (hf_u8_t &data) noexcept |
| | Read single byte from SPI bus.
|
| |
| virtual bool | TransferByte (hf_u8_t tx_data, hf_u8_t &rx_data) noexcept |
| | Write single byte and read response.
|
| |
| virtual hf_spi_err_t | ResetStatistics () noexcept |
| | Reset SPI operation statistics.
|
| |
| virtual hf_spi_err_t | ResetDiagnostics () noexcept |
| | Reset SPI diagnostic information.
|
| |
| virtual hf_spi_err_t | GetStatistics (hf_spi_statistics_t &statistics) const noexcept |
| | Get SPI operation statistics.
|
| |
| virtual hf_spi_err_t | GetDiagnostics (hf_spi_diagnostics_t &diagnostics) const noexcept |
| | Get SPI diagnostic information.
|
| |
Abstract base class for SPI device implementations.
This class provides a comprehensive SPI device abstraction that serves as the base for all SPI device implementations in the HardFOC system. Each instance represents a single SPI device with pre-configured settings. It supports:
- Master mode SPI communication
- Configurable SPI modes (0-3)
- Full-duplex, write-only, and read-only transfers
- Configurable clock speeds and timing
- Automatic chip select management
- Configurable word sizes
- Comprehensive error handling
- Lazy initialization pattern
Device configuration (mode, speed, CS pin) is set during device creation and managed automatically, ensuring each device operates with its correct settings without manual configuration per transaction.
Derived classes implement platform-specific details such as:
- On-chip SPI controllers with device handles
- SPI bridge or adapter hardware
- Device-specific configurations
- Note
- This is a header-only abstract base class - instantiate concrete implementations instead.
-
This class is not inherently thread-safe. Use appropriate synchronization if accessed from multiple contexts.
-
Each BaseSpi instance represents a specific SPI device, not the SPI bus itself.