semf
|
This class uses PwmOut
and a SoftwareTimer
in order to generate different waveforms. (e.g. sine, triangle), for switching the LED on and off. Additionally a pulsing mode and a constant on / off mode is available.
More...
#include <leddimming.h>
Public Types | |
enum class | Mode : uint8_t { Off = 0 , On , Blinking , Sine , Triangule } |
Public Member Functions | |
virtual | ~LedDimming ()=default |
virtual void | setBrightness (uint16_t maxBrightness)=0 |
Sets the maximum brightness of the LED. More... | |
virtual void | setBrightness (uint16_t minBrightness, uint16_t maxBrightness)=0 |
Sets the minimum and maximum brightness of the LED. More... | |
virtual void | setBlinking (unsigned int onOffTime)=0 |
Start blinking the led with the same on-off time. More... | |
virtual void | setBlinking (unsigned int onTime, unsigned int offTime)=0 |
Starts blinking the led with different on and off time. More... | |
virtual void | setSine (unsigned int periodInTimeBaseTicks, unsigned int startIndexInTimeBaseTicks)=0 |
Starts showing a sine waveform on the led. More... | |
virtual void | setSine (unsigned int periodInTimeBaseTicks)=0 |
Starts showing a sine waveform on the led. More... | |
virtual void | setTriangle (unsigned int periodInTimeBaseTicks, unsigned int startIndexInTimeBaseTicks)=0 |
Starts showing a triangle waveform on the led. More... | |
virtual void | setTriangle (unsigned int periodInTimeBaseTicks)=0 |
Starts showing a triangle waveform on the led. Maximal brightness can be set by setBrightness function. Waveform starts at zero and is increasing afterwards. More... | |
virtual Mode | mode () const =0 |
Returns the active mode of the led. More... | |
Public Member Functions inherited from semf::app::Led | |
virtual | ~Led ()=default |
virtual void | setOn ()=0 |
virtual void | setOff ()=0 |
virtual void | toggle ()=0 |
This class uses PwmOut
and a SoftwareTimer
in order to generate different waveforms. (e.g. sine, triangle), for switching the LED on and off. Additionally a pulsing mode and a constant on / off mode is available.
PwmOut
controls the output amplitude (brightness), while SoftwareTimer
controls the time intervals for the pulse's samples and the pulse's period.
PwmOut
has to be correctly configured before registering them to the class.
The timing of the SoftwareTimer
depends to the hardware predefined configuration (e.g. clock speed, prescaler, etc.), recommended is the SysTick
with 1ms resolution.
Timing resolution [ms] = 1000 * Auto-reload register value of the timer / timer's input clock[Hz].
Definition at line 34 of file leddimming.h.
|
strong |
Led operation modes.
Enumerator | |
---|---|
Off | |
On | |
Blinking | |
Sine | |
Triangule |
Definition at line 38 of file leddimming.h.
|
virtualdefault |
|
pure virtual |
Returns the active mode of the led.
Implemented in semf::LedDimming.
|
pure virtual |
Start blinking the led with the same on-off time.
The timing of the SoftwareTimer
module depends to the hardware predefined configuration (e.g. clock speed, prescaler, etc.), recommended is the SysTick
with 1ms resolution.
Timing resolution [ms] = 1000 * Auto-reload register value of the timer / timer's input clock[Hz].
onOffTime | On and off time. |
Implemented in semf::LedDimming.
|
pure virtual |
Starts blinking the led with different on and off time.
The timing of the SoftwareTimer
module depends to the hardware predefined configuration (e.g. clock speed, prescaler, etc.), recommended is the SysTick
with 1ms resolution.
Timing resolution [ms] = 1000 * Auto-reload register value of the timer / timer's input clock[Hz].
onTime | On time. |
offTime | Off time. |
Implemented in semf::LedDimming.
|
pure virtual |
Sets the maximum brightness of the LED.
Adjusts the LED brightness in blink mode and sets the maximum brightness for sine and triangle mode. There is also a function to set the minimum and maximum brightness for sine and triangle mode.
maxBrightness | Brightness value, which is between 0 and 1000. |
Implemented in semf::LedDimming.
|
pure virtual |
Sets the minimum and maximum brightness of the LED.
For sine and triangle modes this function sets the minimum and maximum brightness. There is also a function to set only the maximum brightness, if only blinking and on / off is used. For blinking, on / off, the minBrightness is ignored.
minBrightness | Brightness value, which is between 0 and 1000. |
maxBrightness | Brightness value, which is between 0 and 1000. |
Implemented in semf::LedDimming.
|
pure virtual |
Starts showing a sine waveform on the led.
setBrightness()
function. periodInTimeBaseTicks | Period of triangle is timer ticks by TimeBase (period time = periodInTimeBaseTicks * TimeBase timer period). |
Implemented in semf::LedDimming.
|
pure virtual |
Starts showing a sine waveform on the led.
Maximal brightness can be set by setBrightness()
function. Waveform starts at startIndexInTimeBaseTicks
. Minimal brightness is zero in these examples.
periodInTimeBaseTicks | Period of triangle is timer ticks by TimeBase (period time = periodInTimeBaseTicks * TimeBase timer period). |
startIndexInTimeBaseTicks | index in period to start waveform. |
Implemented in semf::LedDimming.
|
pure virtual |
Starts showing a triangle waveform on the led. Maximal brightness can be set by setBrightness
function. Waveform starts at zero and is increasing afterwards.
periodInTimeBaseTicks | Period of triangle is timer ticks by TimeBase (period time = periodInTimeBaseTicks * TimeBase timer period). |
Implemented in semf::LedDimming.
|
pure virtual |
Starts showing a triangle waveform on the led.
Maximal brightness can be set by setBrightness
function. Waveform starts at startIndexInTimeBaseTicks. Minimal brightness is zero in these examples.
periodInTimeBaseTicks | Period of triangle is timer ticks by TimeBase (period time = periodInTimeBaseTicks * TimeBase timer period). |
startIndexInTimeBaseTicks | index in period to start waveform. |
Implemented in semf::LedDimming.