daisy::Led¶
Module: LIBDAISY / HUMAN_INTERFACE / FEEDBACK
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¶
Name | |
---|---|
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) |
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
Public Functions Documentation¶
function Led¶
function ~Led¶
function Init¶
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)
Initializes an LED using the specified hardware pin.
function Set¶
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.
Sets the brightness of the Led.
function Update¶
This processes the pwm of the LED sets the hardware accordingly.
function SetSampleRate¶
Parameters:
- sample_rate New update rate in hz.
Set the rate at which you'll update the leds without reiniting the led
---¶
Updated on 2024-01-03 at 19:41:01 +0000