Treehopper C++ API
LedDriver Class Referenceabstract

Base class that all LED drivers inherit from. More...

#include <LedDriver.h>

Inheritance diagram for LedDriver:
Flushable Dm632

Public Member Functions

 LedDriver (int numLeds, bool hasGlobalBrightnessControl, bool hasIndividualBrightnessControl)
 Construct an LedDriver More...
 
double brightness ()
 Gets the global brightness of the display. More...
 
void brightness (double value)
 Sets the global brightness of the display. More...
 
virtual void flush (bool force=false)=0
 flush changed data to the port expander More...
 

Public Attributes

vector< Ledleds
 The collection of LEDs that belong to this driver. More...
 
const bool hasGlobalBrightnessControl
 Gets or sets whether this controller supports global _brightness control. More...
 
const bool hasIndividualBrightnessControl
 Gets or sets whether this controller's LEDs have individual _brightness control (through PWM or otherwise). More...
 
bool autoFlush
 Whether this interface should automatically flush new values or not. More...
 
Flushableparent
 Gets or sets the parent flushable device (if it exists); if this property is set by this driver, it is expected that flushing the parent will also flush this device. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ LedDriver()

LedDriver ( int  numLeds,
bool  hasGlobalBrightnessControl,
bool  hasIndividualBrightnessControl 
)
Parameters
numLedsThe number of LEDs to construct
hasGlobalBrightnessControlWhether the controller can globally adjust the LED _brightness.
hasIndividualBrightnessControlWhether the controller has individual LED _brightness control

Member Function Documentation

◆ brightness() [1/2]

double brightness ( )

◆ brightness() [2/2]

void brightness ( double  value)

If the display's hasGlobalBrightnessControl is true, native brightness control will be used. Otherwise, if the display's hasIndividualBrightnessControl is true, global brightness will be emulated by setting all

◆ flush()

virtual void flush ( bool  force = false)
pure virtualinherited
Parameters
[in]forcewhether to flush all data to the port expander, even if it doesn't appear to have been changed

Implemented in ChainableShiftRegisterOutput, and Dm632.

Member Data Documentation

◆ autoFlush

bool autoFlush
inherited

◆ hasGlobalBrightnessControl

const bool hasGlobalBrightnessControl

◆ hasIndividualBrightnessControl

const bool hasIndividualBrightnessControl

◆ leds

vector<Led> leds

◆ parent

Flushable* parent
inherited

This property is designed to make LED displays, which operate across groups of LEDs (and possibly groups of LED drivers), much more efficient to update. Many commonly-used LED drivers are shift registers that are chained together; since these cannot be individually addressed, any write to one must include a write to all the other ones. By properly setting the parent shift register in each chain, displays can optimize these updates.


The documentation for this class was generated from the following file: