|
FastLED 3.9.15
|
Single-channel SPI device interface (TX-only, transaction-based, optimized for FastLED)
Provides easy-to-use API for SPI communication with two levels:
TX-Only, Transaction-Based Design: This SPI implementation is optimized for LED strip output (WS2812, APA102, SK6812, etc.) and only supports transmission (MOSI). Read operations (MISO) are not supported because:
Transaction API (Simpler Implementation): All operations use the transaction-based API (writeAsync()) which returns a Transaction handle. This provides a single, consistent interface that's easier to implement and use:
wait() immediately#include <device.h>
Collaboration diagram for fl::spi::Device:Classes | |
| struct | Impl |
| Private implementation data for Device class. More... | |
Public Member Functions | |
| Device (const Config &config) | |
| Construct SPI device with configuration. | |
| ~Device () FL_NOEXCEPT | |
| Destructor - releases hardware resources. | |
| DMABuffer | acquireBuffer (size_t size) |
| Acquire DMA-capable buffer for zero-copy transmission. | |
| fl::optional< fl::task::Error > | begin () |
| Initialize the SPI hardware. | |
| void | end () |
| Shutdown the SPI hardware and release resources. | |
| const Config & | getConfig () const |
| Get current configuration. | |
| bool | isBusy () const |
| Check if async operation is in progress. | |
| bool | isReady () const |
| Check if device is initialized and ready for use. | |
| fl::optional< fl::task::Error > | setClockSpeed (u32 speed_hz) |
| Update clock speed. | |
| fl::optional< fl::task::Error > | transmit (DMABuffer &buffer, bool async=true) |
| Transmit from previously acquired DMA buffer. | |
| bool | waitComplete (u32 timeout_ms=(fl::numeric_limits< u32 >::max)()) |
| Wait for pending async operation to complete. | |
| Result< Transaction > | writeAsync (const u8 *data, size_t size) |
| Begin asynchronous write operation (returns immediately) | |
Private Member Functions | |
| Device (const Device &) FL_NOEXCEPT=delete | |
| Device & | operator= (const Device &) FL_NOEXCEPT=delete |
Private Attributes | |
| fl::unique_ptr< Impl > | pImpl |
Friends | |
| class | Transaction |