Skip to content

Class daisy::Led

ClassList > daisy > Led

LED Class providing simple Software PWM ability, etc Eventually this will work with hardware PWM, and external LED Driver devices as well.More...

  • #include <led.h>

Public Functions

Type Name
void Init (Pin pin, bool invert, float samplerate=1000.0f)
Led ()
void Set (float val)
void SetSampleRate (float sample_rate)
void Update ()
~Led ()

Detailed Description

Author:

shensley

Date:

March 2020

Public Functions Documentation

function Init

void daisy::Led::Init (
    Pin pin,
    bool invert,
    float samplerate=1000.0f
) 

Initializes an LED using the specified hardware pin.

Parameters:

  • pin chooses LED pin
  • invert will set whether to internally invert the brightness due to hardware config.
  • samplerate sets the rate at which 'Update()' will be called (used for software PWM)

function Led

inline daisy::Led::Led () 

function Set

void daisy::Led::Set (
    float val
) 

Sets the brightness of the Led.

Parameters:

  • val will be cubed for gamma correction, and then quantized to 8-bit values for Software PWM 8-bit is for more flexible update rate options, as 12-bit or more would require faster update rates.

function SetSampleRate

inline void daisy::Led::SetSampleRate (
    float sample_rate
) 

Set the rate at which you'll update the leds without reiniting the led

Parameters:

  • sample_rate New update rate in hz.

function Update

void daisy::Led::Update () 

This processes the pwm of the LED sets the hardware accordingly.


function ~Led

inline daisy::Led::~Led () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/led.h