$darkmode
#include <hmi_contact.hpp>
Public Member Functions | |
| Contact (bool active) | |
| void | update (D time, bool down) |
| bool | has_contact () const |
Protected Member Functions | |
| virtual void | contact_down (D time)=0 |
| virtual void | contact_up (D time)=0 |
Protected Attributes | |
| bool | active_ {false} |
A contact allows electricity to pass through it when it has contact with a source and a drain.
This phenomenon is modelled with this superclass, of which Switch and PushButton are the primary subtypes.
The function of switches occasionally changes based on the passage of time. What unit is used for time and what effect that has is parameterized via templating.
|
protectedpure virtual |
Apply the contact.
This corresponds to pushing down on a key or button, or moving a switch to the ON position, and should set active_ to true.
|
protectedpure virtual |
Release the contact.
This corresponds to releasing a previous push on a key or button, or moving a switch to the OFF position, and should set active_ to false.
|
inline |
Update the state of a contact.
If the contact is not active, it only triggers when true is sent. This is not virtual for performance reasons.