MyButton Library
Loading...
Searching...
No Matches
MyButton Class Reference

Public Types

enum  Action { NOPRESS = 0 , CLICK , DOUBLE_CLICK , LONG_PRESS }
 

Public Member Functions

void ARDUINO_ISR_ATTR buttonISR ()
 This function is only internally invoked.
 
 MyButton (int _pin)
 Construct a new My Button object from _pin.
 
bool useInterrupt ()
 Attempt to set an interrupt to use with the MyButton object.
 
bool usingInterrupt () const
 Check whether the MyButton object is configured to accept interrupts.
 
Action check ()
 This method must be called as often as possible in the loop() function.
 
bool on (Action action, ButtonPressCallback cb)
 Sets a callback/lambda for button gesture (Action)
 

Constructor & Destructor Documentation

◆ MyButton()

MyButton::MyButton ( int _pin)

Construct a new My Button object from _pin.

Parameters
_pin

Member Function Documentation

◆ check()

MyButton::Action MyButton::check ( )

This method must be called as often as possible in the loop() function.

Returns
Action

◆ on()

bool MyButton::on ( MyButton::Action action,
ButtonPressCallback cb )

Sets a callback/lambda for button gesture (Action)

Parameters
action
cb
Returns
true on success

◆ useInterrupt()

bool MyButton::useInterrupt ( )

Attempt to set an interrupt to use with the MyButton object.

Returns
true on success

◆ usingInterrupt()

bool MyButton::usingInterrupt ( ) const

Check whether the MyButton object is configured to accept interrupts.

Returns
true
false

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