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

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

#include <PicoLCButton.h>

Public Member Functions

bool read () const
 Returns the current filtered logical button state.
bool rising () const
 Reports a logical button press transition.
bool falling () const
 Reports a logical button release transition.
bool changed () const
 Reports any logical button transition.
void filterMillis (uint32_t ms)
 Sets the required button-state stability time.
uint32_t filterMillis () const
 Returns the configured button-state stability time.

Friends

class PicoLC

Detailed Description

Represents one filtered, logical PicoLC button.

PicoLCButton samples a board-defined button during PicoLC::update(), applies its configured inversion, then applies the configured stability filter before updating the logical button 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::BootButton, PicoLC::RunStopButton, and PicoLC::UserButton.

Definition at line 18 of file PicoLCButton.h.

Member Function Documentation

◆ changed()

bool PicoLCButton::changed()const

Reports any logical button 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 button state changed during the current scan.

Definition at line 65 of file PicoLCButton.cpp.

◆ falling()

bool PicoLCButton::falling()const

Reports a logical button release 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 button state changed from pressed to released during the current scan.

Definition at line 58 of file PicoLCButton.cpp.

◆ filterMillis() [1/2]

uint32_t PicoLCButton::filterMillis()const

Returns the configured button-state stability time.

Returns
Filter duration in milliseconds.

Definition at line 43 of file PicoLCButton.cpp.

◆ filterMillis() [2/2]

void PicoLCButton::filterMillis(uint32_tms)

Sets the required button-state 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 39 of file PicoLCButton.cpp.

◆ read()

bool PicoLCButton::read()const

Returns the current filtered logical button state.

The value is true when the button is logically pressed and changes only during PicoLC::update().

Returns
true when the button is logically pressed.

Definition at line 47 of file PicoLCButton.cpp.

◆ rising()

bool PicoLCButton::rising()const

Reports a logical button press 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 button state changed from released to pressed during the current scan.

Definition at line 51 of file PicoLCButton.cpp.

◆ PicoLC

friend class PicoLC
friend

Definition at line 19 of file PicoLCButton.h.


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