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

Represents one configurable PicoLC hardware output. More...

#include <PicoLCOutput.h>

Public Member Functions

bool read () const
 Returns the current logical output state.
bool write (bool state)
 Applies a logical command to the output.
bool write (bool state, OutputMode mode)
 Applies a logical command to the output and sets the electrical drive mode.
void outputMode (OutputMode mode)
 Sets the electrical drive mode.
OutputMode outputMode () const
 Returns the configured electrical drive mode.
void patternMode (PatternMode mode)
 Sets the timed behavior applied to the output.
PatternMode patternMode () const
 Returns the configured timed output behavior.
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.
uint32_t frequency (uint32_t hertz)
 Sets the requested PWM frequency.
uint32_t frequency () const
 Returns the configured PWM frequency.
uint16_t duty (uint16_t duty)
 Sets the linear PWM duty.
uint16_t duty () const
 Returns the configured linear PWM duty.

Static Public Attributes

static constexpr uint16_t DUTY_MAX = 1000
 Maximum user-facing PWM duty value.
static constexpr uint32_t FREQUENCY_DEFAULT = 1000
 Default PWM frequency in hertz.

Friends

class PicoLC

Detailed Description

Represents one configurable PicoLC hardware output.

PicoLCOutput exposes logical output behavior rather than instantaneous electrical state. The selected OutputMode defines the electrical drive configuration, PatternMode defines timed behavior, and duty() defines the linear PWM duty applied while the output pattern is active.

Instances are created and owned by PicoLC and are accessed through members such as PicoLC::Y0 through PicoLC::Y3.

Definition at line 18 of file PicoLCOutput.h.

Member Function Documentation

◆ blinkOnTime() [1/2]

uint32_t PicoLCOutput::blinkOnTime()const

Returns the active time within each Blink-mode cycle.

Returns
Blink on-time in milliseconds.

Definition at line 91 of file PicoLCOutput.cpp.

◆ blinkOnTime() [2/2]

void PicoLCOutput::blinkOnTime(uint32_tms)

Sets the active time within each Blink-mode cycle.

Parameters
msBlink on-time in milliseconds.

Definition at line 88 of file PicoLCOutput.cpp.

◆ blinkPeriod() [1/2]

uint32_t PicoLCOutput::blinkPeriod()const

Returns the complete Blink-mode cycle period.

Returns
Blink period in milliseconds.

Definition at line 87 of file PicoLCOutput.cpp.

◆ blinkPeriod() [2/2]

void PicoLCOutput::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 83 of file PicoLCOutput.cpp.

◆ duty() [1/2]

uint16_t PicoLCOutput::duty()const

Returns the configured linear PWM duty.

Returns
Duty value from 0 through DUTY_MAX.

Definition at line 106 of file PicoLCOutput.cpp.

◆ duty() [2/2]

uint16_t PicoLCOutput::duty(uint16_tduty)

Sets the linear PWM duty.

The public duty range is 0 through DUTY_MAX. A value of 0 produces no active drive during an enabled pattern, and DUTY_MAX produces full duty.

Parameters
dutyRequested duty value.
Returns
Applied duty value after range handling.

Definition at line 102 of file PicoLCOutput.cpp.

◆ frequency() [1/2]

uint32_t PicoLCOutput::frequency()const

Returns the configured PWM frequency.

Returns
PWM frequency in hertz.

Definition at line 101 of file PicoLCOutput.cpp.

◆ frequency() [2/2]

uint32_t PicoLCOutput::frequency(uint32_thertz)

Sets the requested PWM frequency.

Outputs sharing an RP2 PWM slice also share a frequency. The returned value is the frequency actually applied after hardware constraints and shared-slice behavior are taken into account.

Parameters
hertzRequested frequency in hertz.
Returns
Actual configured frequency in hertz.

Definition at line 100 of file PicoLCOutput.cpp.

◆ outputMode() [1/2]

OutputMode PicoLCOutput::outputMode()const

Returns the configured electrical drive mode.

Returns
Current OutputMode.

Definition at line 95 of file PicoLCOutput.cpp.

◆ outputMode() [2/2]

void PicoLCOutput::outputMode(OutputModemode)

Sets the electrical drive mode.

Parameters
modeDesired electrical output configuration.

Definition at line 94 of file PicoLCOutput.cpp.

◆ patternMode() [1/2]

PatternMode PicoLCOutput::patternMode()const

Returns the configured timed output behavior.

Returns
Current PatternMode.

Definition at line 98 of file PicoLCOutput.cpp.

◆ patternMode() [2/2]

void PicoLCOutput::patternMode(PatternModemode)

Sets the timed behavior applied to the output.

Pulse and blink configuration values are retained when changing modes.

Parameters
modeDesired PatternMode.

Definition at line 97 of file PicoLCOutput.cpp.

◆ pulseLength() [1/2]

uint32_t PicoLCOutput::pulseLength()const

Returns the configured Pulse-mode duration.

Returns
Pulse duration in milliseconds.

Definition at line 81 of file PicoLCOutput.cpp.

◆ pulseLength() [2/2]

void PicoLCOutput::pulseLength(uint32_tms)

Sets the Pulse-mode duration.

Parameters
msPulse duration in milliseconds.

Definition at line 80 of file PicoLCOutput.cpp.

◆ read()

bool PicoLCOutput::read()const

Returns the current logical output state.

The returned value never represents the instantaneous electrical output state. In Pulse mode, read() returns false after a pulse is triggered, even while the timed pulse remains active.

Returns
Current logical output state.

Definition at line 60 of file PicoLCOutput.cpp.

◆ write() [1/2]

bool PicoLCOutput::write(boolstate)

Applies a logical command to the output.

In Steady and Blink modes, the supplied value becomes the logical output 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.

Physical output drive remains disabled until PicoLC::enableOutputs() is called.

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

Definition at line 67 of file PicoLCOutput.cpp.

◆ write() [2/2]

bool PicoLCOutput::write(boolstate,
OutputModemode )

Applies a logical command to the output and sets the electrical drive mode.

In Steady and Blink modes, the supplied state becomes the logical output 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.

Physical output drive remains disabled until PicoLC::enableOutputs() is called.

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

Definition at line 75 of file PicoLCOutput.cpp.

◆ PicoLC

friend class PicoLC
friend

Definition at line 19 of file PicoLCOutput.h.

Member Data Documentation

◆ DUTY_MAX

uint16_t PicoLCOutput::DUTY_MAX = 1000
staticconstexpr

Maximum user-facing PWM duty value.

Definition at line 23 of file PicoLCOutput.h.

◆ FREQUENCY_DEFAULT

uint32_t PicoLCOutput::FREQUENCY_DEFAULT = 1000
staticconstexpr

Default PWM frequency in hertz.

Definition at line 26 of file PicoLCOutput.h.


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