DriverBase
Source:
DriverBase.h
DriverBase¶
src/light/drivers/DriverBase.h:29Inherits:
MoonModule
Base class for one driver: a consumer that reads the shared source buffer and emits it.
The destination is a physical LED output, a network sink, or the preview.
A driver reads dimensions from an active Layer, applies the shared output correction, and may restrict its output to a window of the source buffer. The zero-state role EffectBase plays for effects.
Public Methods¶
virtual inline ModuleRole role() const override
: This module's role, which is what the container filters its children by.
virtual void setSourceBuffer(Buffer * buf)
virtual inline LedHwBlock hwBlock() const
: The hardware block this driver claims, so two drivers cannot corrupt one peripheral.
virtual inline void defineControls() final
: Lead every driver card with the correction block, then the driver's own controls.
virtual inline void defineDriverControls()
: A driver's own controls, added after the correction block; this is what a driver overrides.
virtual inline bool hasCorrectionControls() const
: Whether this driver exposes the correction controls, which a raw-RGB sink opts out of.
inline void setLayer(Layer * layer)
: Set the Layer this driver reads its dimensions from.
inline uint16_t windowStart() const
: The first light of the configured window.
inline uint16_t windowCount() const
: Number of lights in the configured window (0 = to end of buffer).
inline void setWindow(uint16_t start, uint16_t count)
: Set the window directly, which takes effect on the next parse as a control edit does.
inline nrOfLightsType resolveWindowLenForTest(nrOfLightsType bufN) const
: Test-only: resolve the window against a buffer of bufN lights into its length.
inline Layer * layer() const
: The active Layer, which is null when none is wired, so a driver must tolerate that.
inline void rebuildCorrection(uint8_t globalBrightness)
: Rebuild this driver's correction, baking global times local brightness into one LUT.
virtual inline void onControlChanged(const char * name) override
: Rebuild the correction when one of its own correction controls changed.
virtual inline void onCorrectionChanged()
: Notified when the output channel count may have changed without a structural rebuild.
virtual inline void release() override
: Clear every shared status string, so a stopped driver leaves nothing behind.
inline Correction & correctionForTest()
: Test-only: the driver's own Correction, mutable so a test can set a wiring directly.
inline const Correction & correction() const
: The resolved correction, read-only, since the driver owns and rebuilds it.
inline void setMotionHeld(bool held)
: Park or release this driver's motion.
inline bool motionHeld() const
: Whether this driver's motion is currently parked.
More info¶
One include writes a driver¶
This file brings DriverBase plus the buffer, correction and platform pieces every driver needs. A peripheral seam or a packet header stays per-driver.