class::ev::Button

class ev::Button
  : public api::WorkObject

This class implements a button that can be pressed by the user. It implements the timing for button actuations, button holds, presses and releases. It is an abstract class where the inheriting classes must implement the ev::Button::get_value() method which returns the value of input.

Summary

ev::Event event()

enum ev::Event::button_id event_id() const

bool get_actuated()

chrono::MicroTime get_duration()

ev::Event get_event()

bool get_held()

bool get_pressed()

bool get_released()

bool is_active() const

virtual void reset()

static chrono::MicroTime max_held_duration()

protected virtual void update()

Members

ev::Event event()

enum ev::Event::button_id event_id() const

Access the event ID of the button


bool get_actuated()

Returns true if the button was pressed then released This will return true only once per button press.


chrono::MicroTime get_duration()

Returns the duration of the last button press. This method will only return a non-zero value once per button press.


ev::Event get_event()

This method checks the state of the actuation and then returns an Event if needed.

It will report the following events


bool get_held()

Returns true if the button has been held for the specified duration This will only return true once per button press.


bool get_pressed()

Returns true if the button has been pressed. This will only return true once per button press.


bool get_released()

Returns true if the button has been released. This will only return true one time for each button press.


bool is_active() const

Returns true if the button is currently in the active state. The active state is updated each time Button::update() is called.


virtual void reset()

Reset the state of the button


static chrono::MicroTime max_held_duration()

Returns the max held duration which will effectively disable the reporting of button holds

Button::set_held_duration( Button::max_held_duration() );

protected virtual void update()

This will update the state of the button. This method should be called periodically.


X

Thanks for Coming!

Subscribe to news and updates