PicoLC Arduino Library
Arduino library for PicoLC hardware
Loading...
Searching...
No Matches
PicoLCLED Class Reference

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

Detailed Description

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.

Member Function Documentation

◆ blinkOnTime() [1/2]

uint32_t PicoLCLED::blinkOnTime()const

Returns the active time within each Blink-mode cycle.

Returns
Blink on-time in milliseconds.

Definition at line 83 of file PicoLCLED.cpp.

◆ blinkOnTime() [2/2]

void PicoLCLED::blinkOnTime(uint32_tms)

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.

Parameters
msBlink on-time in milliseconds.

Definition at line 82 of file PicoLCLED.cpp.

◆ blinkPeriod() [1/2]

uint32_t PicoLCLED::blinkPeriod()const

Returns the complete Blink-mode cycle period.

Returns
Blink period in milliseconds.

Definition at line 81 of file PicoLCLED.cpp.

◆ blinkPeriod() [2/2]

void PicoLCLED::blinkPeriod(uint32_tms)

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().

Parameters
msBlink period in milliseconds.

Definition at line 80 of file PicoLCLED.cpp.

◆ brightness() [1/2]

uint16_t PicoLCLED::brightness()const

Returns the configured perceived LED brightness.

The internal PWM representation is converted back to the user-facing percentage scale.

Returns
Brightness percentage from 0 through BRIGHTNESS_MAX.

Definition at line 90 of file PicoLCLED.cpp.

◆ brightness() [2/2]

void PicoLCLED::brightness(uint16_tbrightness)

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.

Parameters
brightnessBrightness percentage from 0 through BRIGHTNESS_MAX.

Definition at line 85 of file PicoLCLED.cpp.

◆ patternMode() [1/2]

PatternMode PicoLCLED::patternMode()const

Returns the configured timed LED behavior.

Returns
Current PatternMode.

Definition at line 11 of file PicoLCLED.cpp.

◆ patternMode() [2/2]

void PicoLCLED::patternMode(PatternModemode)

Sets the timed behavior applied to the LED.

Pulse and blink configuration values are retained when changing modes.

Parameters
modeDesired PatternMode.

Definition at line 10 of file PicoLCLED.cpp.

◆ pulseLength() [1/2]

uint32_t PicoLCLED::pulseLength()const

Returns the configured Pulse-mode duration.

Returns
Pulse duration in milliseconds.

Definition at line 79 of file PicoLCLED.cpp.

◆ pulseLength() [2/2]

void PicoLCLED::pulseLength(uint32_tms)

Sets the Pulse-mode duration.

Parameters
msPulse duration in milliseconds.

Definition at line 78 of file PicoLCLED.cpp.

◆ read()

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.

Returns
Current logical LED state.

Definition at line 55 of file PicoLCLED.cpp.

◆ toggle()

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.

◆ write()

bool PicoLCLED::write(boolstate)

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.

Parameters
stateLogical command to apply.
Returns
The supplied logical command, allowing the call to be chained in an expression.

Definition at line 62 of file PicoLCLED.cpp.

◆ PicoLC

friend class PicoLC
friend

Definition at line 19 of file PicoLCLED.h.

Member Data Documentation

◆ BRIGHTNESS_MAX

uint16_t PicoLCLED::BRIGHTNESS_MAX = 100
staticconstexpr

Maximum user-facing brightness percentage.

Definition at line 23 of file PicoLCLED.h.


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