Commanders
Arduino buttons/bus library
ButtonsCommanderPush Class Reference

#include "ButtonsCommanderPush.hpp"

Inheritance diagram for ButtonsCommanderPush:
ButtonsCommanderButton

Public Member Functions

 ButtonsCommanderPush ()
 
void begin (unsigned long inId, int inButtonPin, COMMANDERS_EVENT_TYPE inEventType = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)
 
void AddEvent (unsigned long inId, COMMANDERS_EVENT_TYPE inEventType = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)
 
unsigned long loop ()
 
int GetPin () const
 
GPIO_pin_t GetDIO2Pin () const
 
- Public Member Functions inherited from ButtonsCommanderButton
 ButtonsCommanderButton (unsigned long inId)
 
unsigned long GetId () const
 
virtual ButtonsCommanderButton * GetFromId (unsigned long inId)
 
virtual int GetPosition () const
 
virtual void beforeFirstLoop ()
 
virtual void EndLoop ()
 
void SetNextButton (ButtonsCommanderButton *inpButton)
 
ButtonsCommanderButton * GetNextButton () const
 

Additional Inherited Members

- Protected Attributes inherited from ButtonsCommanderButton
unsigned long Id
 

Detailed Description

A push button is a hardware device giving a time limited impulsion. It will return one id at a time, passing through the whole list of Ids.

Events thrown:

 reason      |   id      |    type    | data

--------------—|--------—|---------—|---— pin state to LOW | button id | event type | data

Definition at line 29 of file ButtonsCommanderPush.hpp.

Constructor & Destructor Documentation

ButtonsCommanderPush::ButtonsCommanderPush ( )

Default constructor.

Definition at line 11 of file ButtonsCommanderPush.cpp.

Member Function Documentation

void ButtonsCommanderPush::AddEvent ( unsigned long  inId,
COMMANDERS_EVENT_TYPE  inEventType = COMMANDERS_EVENT_MOVEPOSITIONID,
int  inData = 0 
)

A push button can throw different events when it is pressed. This function add a new event in the list. When the first press on push button is done, the main id/event type/data Event defined by begin(�) function will be thrown. At the following press, the first event of the list is thrown, and so on at each new press until the end of the list. At the end, the next event is the main one defined by begin.

Parameters
inIdid of the button.
inEventTypeEvent type used when the button is pressed. Default COMMANDERS_EVENT_MOVEPOSITIONID.
inDataAssociated data when the push button is pressed. Default 0.

Definition at line 31 of file ButtonsCommanderPush.cpp.

void ButtonsCommanderPush::begin ( unsigned long  inId,
int  inButtonPin,
COMMANDERS_EVENT_TYPE  inEventType = COMMANDERS_EVENT_MOVEPOSITIONID,
int  inData = 0 
)

Initialize the instance.

Parameters
inIdid of the button.
inButtonPinArduino pin connected to the push button.
inEventTypeEvent type used when the button is pressed. Default COMMANDERS_EVENT_MOVEPOSITIONID.
inDataAssociated data when the push button is pressed. Default 0.

Definition at line 19 of file ButtonsCommanderPush.cpp.

GPIO_pin_t ButtonsCommanderPush::GetDIO2Pin ( ) const
inline

Gets the pin number connected to the push button, in DIO2 library format.

Returns
Pin number.

Definition at line 70 of file ButtonsCommanderPush.hpp.

int ButtonsCommanderPush::GetPin ( ) const
inline

Gets the pin number connected to the push button.

Returns
Pin number.

Definition at line 66 of file ButtonsCommanderPush.hpp.

unsigned long ButtonsCommanderPush::loop ( )
virtual

Main loop function.

Reimplemented from ButtonsCommanderButton.

Definition at line 40 of file ButtonsCommanderPush.cpp.


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