Treehopper C# API
RgbLed Class Reference

An RGB LED connected to three discrete channels of LED driver(s). More...

Inheritance diagram for RgbLed:
IFlushable

Public Member Functions

 RgbLed (Led red, Led green, Led blue)
 Construct a new RGB LED from the specified LED driver channels More...
 
 RgbLed (IList< Led > Leds)
 Construct a new RGB LED from a three-item list of LEDs More...
 
async Task FlushAsync (bool force=false)
 Flush this LED's color value to the driver(s) More...
 
void SetRgb (float red, float green, float blue)
 Set the RGB value of this RGB LED More...
 
void SetColor (Color color)
 Set the color of the RGB LED More...
 
void SetHsl (float hue, float saturation, float luminance)
 Set the hue, saturation, and luminance of this RGB LED More...
 

Properties

bool AutoFlush = true [get, set]
 Whether calls to SetColor(Color), SetHsl(float, float, float), or SetRgb(float, float, float) should flush to the drivers immediately More...
 
IFlushable Parent [get]
 The parent of this instance. More...
 
float RedGain = 1f [get, set]
 The red gain to use with this RGB LED More...
 
float GreenGain = 1f [get, set]
 The green gain to use with this RGB LED More...
 
float BlueGain = 1f [get, set]
 The blue gain to use with this RGB LED More...
 

Detailed Description

An RGB LED connected to three discrete channels of LED driver(s).

Note the RGB LED may be connected across multiple drivers with no impact on functionality. This is common for large arrays of RGB LEDs (which require multiple-of-3 number of channels) interfacing with multiple 8-, 16-, or 24-channel drivers.

Constructor & Destructor Documentation

◆ RgbLed() [1/2]

RgbLed ( Led  red,
Led  green,
Led  blue 
)

Construct a new RGB LED from the specified LED driver channels

Parameters
redThe red LED
greenThe green LED
blueThe blue LED

◆ RgbLed() [2/2]

RgbLed ( IList< Led Leds)

Construct a new RGB LED from a three-item list of LEDs

Parameters
Leds

Member Function Documentation

◆ FlushAsync()

async Task FlushAsync ( bool  force = false)

Flush this LED's color value to the driver(s)

Parameters
forceWhether to force an update
Returns
An awaitable task

Implements IFlushable.

◆ SetRgb()

void SetRgb ( float  red,
float  green,
float  blue 
)

Set the RGB value of this RGB LED

Parameters
redThe red intensity, from 0-255
greenThe green intensity, from 0-255
blueThe blue intensity, from 0-255

◆ SetColor()

void SetColor ( Color  color)

Set the color of the RGB LED

Parameters
colorThe desired color

◆ SetHsl()

void SetHsl ( float  hue,
float  saturation,
float  luminance 
)

Set the hue, saturation, and luminance of this RGB LED

Parameters
hueThe hue, from 0-360 degrees, of the desired color
saturationThe saturation, from 0-100, of the desired color
luminanceThe luminance, from 0-100, of the desired color

Property Documentation

◆ AutoFlush

bool AutoFlush = true
getset

Whether calls to SetColor(Color), SetHsl(float, float, float), or SetRgb(float, float, float) should flush to the drivers immediately

◆ Parent

IFlushable Parent
get

The parent of this instance.

Unused.

◆ RedGain

float RedGain = 1f
getset

The red gain to use with this RGB LED

◆ GreenGain

float GreenGain = 1f
getset

The green gain to use with this RGB LED

◆ BlueGain

float BlueGain = 1f
getset

The blue gain to use with this RGB LED


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