//
#ifndef Button_h
#define Button_h
//
#include <Define.h>
//
enum EStateButton
{
    sbtUnpressed = 0,
    sbtPressed = 1
};
//
const bool INIT_BUTTON_INVERTED = false;
const long unsigned INIT_BUTTON_PERIOD_MS = 1000L; // [ms]
//
class CButton
{
    protected:
    int FPin;
    EStateButton FState;
    bool FInverted;
    long unsigned FTimeStart;
    long unsigned FTimePeriod;
    //
    public:
    CButton(int pin, bool inverted = INIT_BUTTON_INVERTED, 
            long unsigned period = INIT_BUTTON_PERIOD_MS);
    virtual void Open(void);
    virtual void Close(void);
    EStateButton ReadState(void);
    const char* GetStateText(void);
    EStateButton Execute(void);
};
//
class CButtonNormallyOpened : public CButton
{
    public:
    CButtonNormallyOpened(int pin);
    void Open(void);
    void Close(void);
};
//
class CButtonNormallyClosed : public CButton
{
    public:
    CButtonNormallyClosed(int pin);
    void Open(void);
    void Close(void);
};
//
#endif // Button_h
//
