Changed to JC_button lib

This commit is contained in:
willem oldemans
2020-11-19 08:27:52 +01:00
parent 8c9176ccbe
commit d184f1785c
8 changed files with 135 additions and 167 deletions

View File

@@ -3,45 +3,11 @@
#include <Arduino.h>
#include <vector>
typedef enum buttonState_e
{
RELEASED,
SHORT,
LONG,
INVALID
}buttonState_t;
class buttons
{
const unsigned int _buttonIndex;
const uint32_t _buttonPin;
unsigned long _buttonTimer;
buttonState_t _buttonState;
buttonState_t _lastState;
bool _buttonFlag;
unsigned long _buttonDelayShort;
unsigned long _buttonDelayLong;
public:
buttons(uint32_t pin, unsigned long shortpress, unsigned long longpress, unsigned int index);
void begin();
void update( void );
bool raw( void );
buttonState_t state();
buttonState_t lastState();
unsigned int index( void );
};
#include "JC_Button.h"
bool anybutton( void );
void initbuttons( void );
void initButtons( void );
void handleButtons( void );
buttons* getButton(unsigned int index);
ToggleButton* getButton(unsigned int index);
#endif //BUTTONSH