libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::Led Class Reference

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

Detailed Description

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

Author
shensley
Date
March 2020

#include <led.h>

Public Member Functions

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

Constructor & Destructor Documentation

◆ Led()

daisy::Led::Led ( )
inline

◆ ~Led()

daisy::Led::~Led ( )
inline

Member Function Documentation

◆ Init()

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

Initializes an LED using the specified hardware pin.

Parameters
pinchooses LED pin
invertwill set whether to internally invert the brightness due to hardware config.
sampleratesets the rate at which 'Update()' will be called (used for software PWM)

◆ Set()

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

Sets the brightness of the Led.

Parameters
valwill 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.

◆ SetSampleRate()

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

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

Parameters
sample_rateNew update rate in hz.

◆ Update()

void daisy::Led::Update ( )

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


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