$darkmode
#include <hmi_contact.hpp>
Public Member Functions | |
| PushButton (std::function< void()> click_fn) | |
| PushButton (std::function< void()> click_fn, std::function< void()> repeat_fn) | |
| void | set_delay (D delay) |
| void | set_interval (D interval) |
Public Member Functions inherited from cloe::utility::Contact< Duration > | |
| Contact (bool active) | |
| void | update (Duration time, bool down) |
| bool | has_contact () const |
Protected Member Functions | |
| void | contact_down (D time) override |
| void | contact_up (D) override |
| void | reset () |
Protected Member Functions inherited from cloe::utility::Contact< Duration > | |
| virtual void | contact_down (Duration time)=0 |
| virtual void | contact_up (Duration time)=0 |
Additional Inherited Members | |
Protected Attributes inherited from cloe::utility::Contact< Duration > | |
| bool | active_ |
PushButton simulates a push button.
Pressing a button generally applies a current to a circuit. This current flows for a time t, which is variable. How often a button is triggered then is subject to the following algorithm:
---------—|--—|--—|--—|--—|— push delay | | inter-arrival time release
At delay and every inter-arrival time, the repeated function is executed, and at release the repeated function is not performed, or the single function is executed if the delay has not been reached yet.
WARNING: PushButton requires regular updates. On each update it will trigger at most once, so if you update with (0, true) and then again at (10000, true), it will simply trigger the repeated function once.
|
inline |
Set the initial delay before a repeated button activation is triggered.
Regardless of the delay, on release a "click" is activated.
|
inline |
Set the interarrival time of repeated button activations.
After the first delay, interval amount of time elapses between button activations.