PicoLC Arduino Library Arduino library for PicoLC hardware |
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 |
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.
| uint32_t PicoLCOutput::blinkOnTime | ( | ) | const |
Returns the active time within each Blink-mode cycle.
Definition at line 91 of file PicoLCOutput.cpp.
| void PicoLCOutput::blinkOnTime | ( | uint32_t | ms | ) |
Sets the active time within each Blink-mode cycle.
| ms | Blink on-time in milliseconds. |
Definition at line 88 of file PicoLCOutput.cpp.
| uint32_t PicoLCOutput::blinkPeriod | ( | ) | const |
Returns the complete Blink-mode cycle period.
Definition at line 87 of file PicoLCOutput.cpp.
| void PicoLCOutput::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 83 of file PicoLCOutput.cpp.
| uint16_t PicoLCOutput::duty | ( | ) | const |
Returns the configured linear PWM duty.
Definition at line 106 of file PicoLCOutput.cpp.
| uint16_t PicoLCOutput::duty | ( | uint16_t | duty | ) |
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.
| duty | Requested duty value. |
Definition at line 102 of file PicoLCOutput.cpp.
| uint32_t PicoLCOutput::frequency | ( | ) | const |
Returns the configured PWM frequency.
Definition at line 101 of file PicoLCOutput.cpp.
| uint32_t PicoLCOutput::frequency | ( | uint32_t | hertz | ) |
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.
| hertz | Requested frequency in hertz. |
Definition at line 100 of file PicoLCOutput.cpp.
| OutputMode PicoLCOutput::outputMode | ( | ) | const |
Returns the configured electrical drive mode.
Definition at line 95 of file PicoLCOutput.cpp.
| void PicoLCOutput::outputMode | ( | OutputMode | mode | ) |
Sets the electrical drive mode.
| mode | Desired electrical output configuration. |
Definition at line 94 of file PicoLCOutput.cpp.
| PatternMode PicoLCOutput::patternMode | ( | ) | const |
Returns the configured timed output behavior.
Definition at line 98 of file PicoLCOutput.cpp.
| void PicoLCOutput::patternMode | ( | PatternMode | mode | ) |
Sets the timed behavior applied to the output.
Pulse and blink configuration values are retained when changing modes.
| mode | Desired PatternMode. |
Definition at line 97 of file PicoLCOutput.cpp.
| uint32_t PicoLCOutput::pulseLength | ( | ) | const |
Returns the configured Pulse-mode duration.
Definition at line 81 of file PicoLCOutput.cpp.
| void PicoLCOutput::pulseLength | ( | uint32_t | ms | ) |
Sets the Pulse-mode duration.
| ms | Pulse duration in milliseconds. |
Definition at line 80 of file PicoLCOutput.cpp.
| 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.
Definition at line 60 of file PicoLCOutput.cpp.
| bool PicoLCOutput::write | ( | bool | state | ) |
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.
| state | Logical command to apply. |
Definition at line 67 of file PicoLCOutput.cpp.
| bool PicoLCOutput::write | ( | bool | state, |
| OutputMode | mode ) |
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.
| state | Logical command to apply. |
| mode | Desired electrical output configuration. |
Definition at line 75 of file PicoLCOutput.cpp.
| friend |
Definition at line 19 of file PicoLCOutput.h.
| staticconstexpr |
Maximum user-facing PWM duty value.
Definition at line 23 of file PicoLCOutput.h.
| staticconstexpr |
Default PWM frequency in hertz.
Definition at line 26 of file PicoLCOutput.h.