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

Represents one filtered, logical PicoLC input. More...

#include <PicoLCInput.h>

Public Member Functions

bool read () const
 Returns the current filtered logical input state.
bool rising () const
 Reports a false-to-true logical transition.
bool falling () const
 Reports a true-to-false logical transition.
bool changed () const
 Reports any logical input transition.
void filterMillis (uint32_t ms)
 Sets the required input stability time.
uint32_t filterMillis () const
 Returns the configured input stability time.
void inverted (bool invert)
 Enables or disables logical input inversion.
bool inverted () const
 Returns whether logical input inversion is enabled.

Friends

class PicoLC

Detailed Description

Represents one filtered, logical PicoLC input.

PicoLCInput samples a physical input during PicoLC::update(), applies optional inversion, then applies the configured stability filter before updating its logical state. Edge detection operates only on the resulting logical state.

Instances are created and owned by PicoLC and are accessed through members such as PicoLC::X0 through PicoLC::X3.

Definition at line 18 of file PicoLCInput.h.

Member Function Documentation

◆ changed()

bool PicoLCInput::changed()const

Reports any logical input transition.

Filtering and inversion are applied before change detection. The result remains true for the current scan and is cleared by the next PicoLC::update().

Returns
true when the logical input changed during the current scan.

Definition at line 69 of file PicoLCInput.cpp.

◆ falling()

bool PicoLCInput::falling()const

Reports a true-to-false logical transition.

Filtering and inversion are applied before edge detection. The result remains true for the current scan and is cleared by the next PicoLC::update().

Returns
true when the logical input fell during the current scan.

Definition at line 62 of file PicoLCInput.cpp.

◆ filterMillis() [1/2]

uint32_t PicoLCInput::filterMillis()const

Returns the configured input stability time.

Returns
Filter duration in milliseconds.

Definition at line 47 of file PicoLCInput.cpp.

◆ filterMillis() [2/2]

void PicoLCInput::filterMillis(uint32_tms)

Sets the required input stability time.

A value of zero disables filtering and applies the sampled logical state during the next PicoLC::update(). Changing the duration does not restart an active filter interval; the new value is compared against the existing elapsed interval during the next update.

Parameters
msRequired stability time in milliseconds.

Definition at line 43 of file PicoLCInput.cpp.

◆ inverted() [1/2]

bool PicoLCInput::inverted()const

Returns whether logical input inversion is enabled.

Returns
true when the sampled physical input is inverted.

Definition at line 39 of file PicoLCInput.cpp.

◆ inverted() [2/2]

void PicoLCInput::inverted(boolinvert)

Enables or disables logical input inversion.

Inversion is applied before filtering and edge detection. This is a setup-time configuration setting. Behavior is undefined if changed while normal scan processing is active.

The new setting takes effect during the next PicoLC::update().

Parameters
inverttrue to invert the sampled physical input.

Definition at line 35 of file PicoLCInput.cpp.

◆ read()

bool PicoLCInput::read()const

Returns the current filtered logical input state.

The value changes only during PicoLC::update().

Returns
Current logical input state.

Definition at line 51 of file PicoLCInput.cpp.

◆ rising()

bool PicoLCInput::rising()const

Reports a false-to-true logical transition.

Filtering and inversion are applied before edge detection. The result remains true for the current scan and is cleared by the next PicoLC::update().

Returns
true when the logical input rose during the current scan.

Definition at line 55 of file PicoLCInput.cpp.

◆ PicoLC

friend class PicoLC
friend

Definition at line 19 of file PicoLCInput.h.


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