PicoLC Arduino Library Arduino library for PicoLC hardware |
Represents one configurable PicoLC status LED. More...
#include <PicoLCLED.h>
Public Member Functions | |
| void | patternMode (PatternMode mode) |
| Sets the timed behavior applied to the LED. | |
| PatternMode | patternMode () const |
| Returns the configured timed LED behavior. | |
| bool | read () const |
| Returns the current logical LED state. | |
| bool | write (bool state) |
| Applies a logical command to the LED. | |
| void | toggle () |
| Toggles the LED state or active pulse. | |
| void | pulseLength (uint32_t ms) |
| Sets the Pulse-mode duration. | |
| uint32_t | pulseLength () const |
| Returns the configured Pulse-mode duration. | |
| void | blinkPeriod (uint32_t ms) |
| Sets the complete Blink-mode cycle period. | |
| uint32_t | blinkPeriod () const |
| Returns the complete Blink-mode cycle period. | |
| void | blinkOnTime (uint32_t ms) |
| Sets the active time within each Blink-mode cycle. | |
| uint32_t | blinkOnTime () const |
| Returns the active time within each Blink-mode cycle. | |
| void | brightness (uint16_t brightness) |
| Sets the perceived LED brightness. | |
| uint16_t | brightness () const |
| Returns the configured perceived LED brightness. | |
Static Public Attributes | |
| static constexpr uint16_t | BRIGHTNESS_MAX = 100 |
| Maximum user-facing brightness percentage. | |
Friends | |
| class | PicoLC |
Represents one configurable PicoLC status LED.
PicoLCLED exposes logical LED behavior rather than instantaneous physical output state. PatternMode controls steady, pulse, and blink behavior, while brightness() controls perceived LED brightness using a user-facing percentage scale.
Instances are created and owned by PicoLC and are accessed through members such as PicoLC::StatusLED and PicoLC::FaultLED.
Definition at line 18 of file PicoLCLED.h.
| uint32_t PicoLCLED::blinkOnTime | ( | ) | const |
Returns the active time within each Blink-mode cycle.
Definition at line 83 of file PicoLCLED.cpp.
| void PicoLCLED::blinkOnTime | ( | uint32_t | ms | ) |
Sets the active time within each Blink-mode cycle.
A default value of zero produces no visible output in Blink mode until the on-time is configured.
| ms | Blink on-time in milliseconds. |
Definition at line 82 of file PicoLCLED.cpp.
| uint32_t PicoLCLED::blinkPeriod | ( | ) | const |
Returns the complete Blink-mode cycle period.
Definition at line 81 of file PicoLCLED.cpp.
| void PicoLCLED::blinkPeriod | ( | uint32_t | ms | ) |
Sets the complete Blink-mode cycle period.
Changing the period does not restart the current cycle. The new timing is applied during the next PicoLC::update().
| ms | Blink period in milliseconds. |
Definition at line 80 of file PicoLCLED.cpp.
| uint16_t PicoLCLED::brightness | ( | ) | const |
Returns the configured perceived LED brightness.
The internal PWM representation is converted back to the user-facing percentage scale.
Definition at line 90 of file PicoLCLED.cpp.
| void PicoLCLED::brightness | ( | uint16_t | brightness | ) |
Sets the perceived LED brightness.
The public range is 0 through BRIGHTNESS_MAX percent. The value is converted internally to a nonlinear PWM duty so that user-facing brightness changes appear more visually uniform.
Brightness is applied only during active steady, pulse, or blink phases. A brightness of zero does not change the logical LED state or pattern.
| brightness | Brightness percentage from 0 through BRIGHTNESS_MAX. |
Definition at line 85 of file PicoLCLED.cpp.
| PatternMode PicoLCLED::patternMode | ( | ) | const |
Returns the configured timed LED behavior.
Definition at line 11 of file PicoLCLED.cpp.
| void PicoLCLED::patternMode | ( | PatternMode | mode | ) |
Sets the timed behavior applied to the LED.
Pulse and blink configuration values are retained when changing modes.
| mode | Desired PatternMode. |
Definition at line 10 of file PicoLCLED.cpp.
| uint32_t PicoLCLED::pulseLength | ( | ) | const |
Returns the configured Pulse-mode duration.
Definition at line 79 of file PicoLCLED.cpp.
| void PicoLCLED::pulseLength | ( | uint32_t | ms | ) |
Sets the Pulse-mode duration.
| ms | Pulse duration in milliseconds. |
Definition at line 78 of file PicoLCLED.cpp.
| bool PicoLCLED::read | ( | ) | const |
Returns the current logical LED state.
The returned value never represents the instantaneous physical LED state. In Pulse mode, read() returns false after a pulse is triggered, even while the timed pulse remains active.
Definition at line 55 of file PicoLCLED.cpp.
| void PicoLCLED::toggle | ( | ) |
Toggles the LED state or active pulse.
In Steady and Blink modes, this is equivalent to writing the opposite logical state. In Pulse mode, an active pulse is stopped; otherwise a new pulse is started.
Definition at line 70 of file PicoLCLED.cpp.
| bool PicoLCLED::write | ( | bool | state | ) |
Applies a logical command to the LED.
In Steady and Blink modes, the supplied value becomes the logical LED state. In Blink mode, a false-to-true transition starts a new cycle in the on phase, and false stops the pattern immediately.
In Pulse mode, true starts or restarts the pulse timer and then returns the logical state to false. Writing false stops an active pulse immediately.
| state | Logical command to apply. |
Definition at line 62 of file PicoLCLED.cpp.
| friend |
Definition at line 19 of file PicoLCLED.h.
| staticconstexpr |
Maximum user-facing brightness percentage.
Definition at line 23 of file PicoLCLED.h.