FastLED 3.9.15
Loading...
Searching...
No Matches
device_impl_base.h
Go to the documentation of this file.
1#pragma once
2
6
7#include "fl/stl/shared_ptr.h"
8// IWYU pragma: begin_keep
9#include "platforms/shared/spi_hw_base.h" // ok platform headers
10#include "fl/stl/noexcept.h"
11// IWYU pragma: end_keep // ok platform headers
12
13namespace fl {
14namespace spi {
15
23
26 : backend()
27 , initialized(false)
28 , owns_backend(false) {}
29
32 bool isReady() const {
33 return initialized && backend != nullptr;
34 }
35
38 bool hasBackend() const {
39 return backend != nullptr;
40 }
41
43 void clearBackend() {
44 backend = nullptr;
45 initialized = false;
46 }
47};
48
49} // namespace spi
50} // namespace fl
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
bool owns_backend
Whether this device owns the backend (for cleanup)
bool hasBackend() const
Validate backend pointer.
DeviceImplBase() FL_NOEXCEPT
Constructor.
bool initialized
Whether hardware is initialized.
bool isReady() const
Check if device is ready.
void clearBackend()
Clear backend state.
fl::shared_ptr< SpiHwBase > backend
Polymorphic SPI hardware backend (SpiHw1/2/4/8)