|
HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
|
Manages a single SPI bus (host). Handles bus init/deinit and device creation. More...
#include <EspSpi.h>
Public Member Functions | |
| EspSpiBus (const hf_spi_bus_config_t &config) noexcept | |
| Construct a new EspSpiBus. | |
| ~EspSpiBus () noexcept | |
| Destructor. Automatically deinitializes the bus if needed. | |
| bool | Initialize () noexcept |
| Initialize the SPI bus. | |
| bool | IsInitialized () const noexcept |
| Check if the bus is initialized. | |
| bool | Deinitialize () noexcept |
| Deinitialize the SPI bus and free resources. | |
| int | CreateDevice (const hf_spi_device_config_t &device_config) noexcept |
| Create a new SPI device on this bus and store it internally. | |
| BaseSpi * | GetDevice (int device_index) noexcept |
| Get a device by index. | |
| const BaseSpi * | GetDevice (int device_index) const noexcept |
| Get a device by index (const version). | |
| EspSpiDevice * | GetEspDevice (int device_index) noexcept |
| Get an ESP-specific device by index. | |
| const EspSpiDevice * | GetEspDevice (int device_index) const noexcept |
| Get an ESP-specific device by index (const version). | |
| std::size_t | GetDeviceCount () const noexcept |
| Get number of devices on this bus. | |
| bool | RemoveDevice (int device_index) noexcept |
| Remove a device from the bus. | |
| const hf_spi_bus_config_t & | GetConfig () const noexcept |
| Get the bus configuration. | |
| spi_host_device_t | GetHost () const noexcept |
| Get the ESP-IDF host ID for this bus. | |
Private Attributes | |
| hf_spi_bus_config_t | config_ |
| Bus configuration. | |
| bool | initialized_ |
| Initialization state. | |
| PlatformMutex | mutex_ |
| Thread safety (mutable for const operations) | |
| std::vector< std::unique_ptr< EspSpiDevice > > | devices_ |
| Managed devices on this bus. | |
Manages a single SPI bus (host). Handles bus init/deinit and device creation.
Provides full configuration and control for the SPI bus, including DMA, IOMUX, and advanced ESP-IDF v5.5+ features. Thread-safe device management.
|
explicitnoexcept |
Construct a new EspSpiBus.
| config | Bus configuration (hf_spi_bus_config_t) |
|
noexcept |
Destructor. Automatically deinitializes the bus if needed.
|
noexcept |
Create a new SPI device on this bus and store it internally.
| device_config | Device configuration (hf_spi_device_config_t) |
|
noexcept |
Deinitialize the SPI bus and free resources.
|
noexcept |
Get the bus configuration.
|
noexcept |
Get a device by index (const version).
| device_index | Index returned by CreateDevice() |
|
noexcept |
Get a device by index.
| device_index | Index returned by CreateDevice() |
|
noexcept |
Get number of devices on this bus.
|
noexcept |
Get an ESP-specific device by index (const version).
| device_index | Index returned by CreateDevice() |
|
noexcept |
Get an ESP-specific device by index.
| device_index | Index returned by CreateDevice() |
|
noexcept |
Get the ESP-IDF host ID for this bus.
|
noexcept |
Initialize the SPI bus.
|
noexcept |
Check if the bus is initialized.
|
noexcept |
Remove a device from the bus.
| device_index | Index of device to remove |
|
private |
Bus configuration.
|
private |
Managed devices on this bus.
|
private |
Initialization state.
|
mutableprivate |
Thread safety (mutable for const operations)