Sequential Button (for Arduino) 1.5
Sequential Button library for Arduino documentation
Loading...
Searching...
No Matches
SeqButton Class Reference

Class containing the required methods for handling sequential button. More...

#include "SeqButton/SeqButton.h"

Public Member Functions

void init (const uint8_t pin, void(*cbckON)(SeqButton *), void(*cbckOFF)(SeqButton *), const bool repeat, const bool logic=LOW, const uint32_t filter=50)
 Initialization routine.
 
void init (uint8_t pin, void(*cbckON)(SeqButton *), void(*cbckOFF)(SeqButton *)=NULL)
 Initialization routine.
 
bool handler (void)
 Check button state and perform callbacks accordingly.
 
uint8_t getPin (void) __attribute__((always_inline))
 Get button pin.
 
bool getState (void) __attribute__((always_inline))
 Get button state.
 
bool getButton (void) __attribute__((always_inline))
 Get button state.
 
uint32_t getHoldTime (void) __attribute__((always_inline))
 Get button hold duration.
 

Detailed Description

Class containing the required methods for handling sequential button.

Member Function Documentation

◆ getButton()

bool SeqButton::getButton ( void )
inline

Get button state.

Deprecated
getButton was already used in SeqButton lib, alias is made to keep compatibility with earlier versions
Returns
Current button state
Here is the call graph for this function:

◆ getHoldTime()

uint32_t SeqButton::getHoldTime ( void )
inline

Get button hold duration.

Returns
Current button hold duration
Here is the caller graph for this function:

◆ getPin()

uint8_t SeqButton::getPin ( void )
inline

Get button pin.

Returns
Current pin assigned to instance
Here is the caller graph for this function:

◆ getState()

bool SeqButton::getState ( void )
inline

Get button state.

Returns
Current button state
Here is the caller graph for this function:

◆ handler()

bool SeqButton::handler ( void )

Check button state and perform callbacks accordingly.

Note
handler for button, this function has to be called in a pseudo main loop to work properly
Returns
Current button state

◆ init() [1/2]

void SeqButton::init ( const uint8_t pin,
void(* cbckON )(SeqButton *),
void(* cbckOFF )(SeqButton *),
const bool repeat,
const bool logic = LOW,
const uint32_t filter = 50 )

Initialization routine.

Note
Input pin is configured with device internal pullup
Parameters
[in]pin- Pin on which button is connected
[in]repeat- callback called repeatedly when set to true
[in]logic- Button logic: LOW for NO / HIGH for NC (internal pullup for input is enabled)
[in]filter- filtering time (in ms)
[in]cbckON- callback function on press (NULL when no callback needed)
[in]cbckOFF- callback function on release (NULL when no callback needed)
Note
Callbacks have to be declared using an SeqButton* as parameter (instance is passed to the callback function)
Returns
nothing
Here is the caller graph for this function:

◆ init() [2/2]

void SeqButton::init ( uint8_t pin,
void(* cbckON )(SeqButton *),
void(* cbckOFF )(SeqButton *) = NULL )

Initialization routine.

Note
Input pin is configured with device internal pullup
Parameters
[in]pin- Pin on which button is connected
[in]cbckON- callback function on press (NULL when no callback needed)
[in]cbckOFF- callback function on release (NULL when no callback needed)
Note
Callbacks have to be declared using an SeqButton* as parameter (instance is passed to the callback function)
Returns
nothing
Here is the call graph for this function:

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