EX-Display
EX-Display
Loading...
Searching...
No Matches
MockInput Class Reference

Mock physical input class. More...

#include <MockInput.h>

Inheritance diagram for MockInput:
[legend]
Collaboration diagram for MockInput:
[legend]

Public Member Functions

 MockInput ()
 
 MockInput (int needsDisplay)
 
 MOCK_METHOD (void, begin,(),(override))
 
 MOCK_METHOD (void, check,(),(override))
 
void setIsCalibrating (bool isCalibrating)
 
void setNeedsDisplay (int displayId)
 
- Public Member Functions inherited from InputInterface
virtual void begin ()=0
 Perform any initial once off setup or configuration here and call only once.
 
virtual void check ()=0
 Call this method at least once per main loop to monitor for input actions Any actions should call the callback set in the _callback attribute.
 
void setCallback (CallbackInterface *callback)
 Set the instance for callbacks when users trigger an input action.
 
void setLogger (Logger *logger)
 Set the logger instance to use for diagnostic logging.
 
bool isCalibrating ()
 Test if this InputInterface is undergoing calibration as required by touch screens.
 
int needsDisplay ()
 Test if this InputInterface requires a display instance - needed for TFT_eSPI as it shares the instance.
 
void setDisplay (DisplayInterface *display)
 Set the DisplayInterface for this input if required.
 
void setDebounceDelay (unsigned long delay)
 Set the debounce delay.
 
void setHoldThreshold (unsigned long threshold)
 Set the threshold for detecting an input is held.
 
void forceCalibration ()
 Force a touch screen into calibration mode, even if existing calibration is valid.
 
virtual ~InputInterface ()=default
 Destructor for an InputInterface.
 

Static Public Member Functions

static MockInputcreate (int needsDisplay)
 

Additional Inherited Members

- Protected Member Functions inherited from InputInterface
InputAction _debounceOrHeld (InputAction currentAction)
 Call this from the derived class' check() method to debounce and detect if the input is a hold vs. press.
 
InputAction _calculateInputAction (int touchX, int touchY, int displayWidth, int displayHeight)
 This method is designed to take an input from a touch screen display and determine which "button" has been touched according to the coordinates of the touch. This assumes the touch screen has been calibrated correctly.
 
- Protected Attributes inherited from InputInterface
CallbackInterface_callback = nullptr
 Pointer to the instance for callbacks Must implement updateScreen() and onInputAction() methods.
 
Logger_logger = nullptr
 Pointer to the Logger instance for derived classes to use.
 
bool _isCalibrating = false
 Flag if the input interface is undergoing calibration - needed for touch screens.
 
int _needsDisplay = -1
 Display ID if this input interface requires a display instance - needed for TFT_eSPI as it shares the instance.
 
DisplayInterface_display = nullptr
 Pointer to the DisplayInterface if this input requires it.
 
unsigned long _lastDebounceTime = 0
 Time of the last debounce.
 
unsigned long _debounceDelay = 50
 Inputs must remain constant for this amount of time to be valid.
 
unsigned long _holdThreshold = 500
 Inputs constant for longer than this threshold change from PRESS to HOLD.
 
InputAction _lastAction = InputAction::PRESS_NONE
 Set initial InputAction for comparisons in determining debounce or hold.
 
bool _isHolding = false
 Flag to help determining if input is held.
 
bool _forceCalibration = false
 Flag to force calibration for touch screens if it's required.
 

Detailed Description

Mock physical input class.

Constructor & Destructor Documentation

◆ MockInput() [1/2]

MockInput::MockInput ( )
inline
Here is the caller graph for this function:

◆ MockInput() [2/2]

MockInput::MockInput ( int  needsDisplay)
inline
Here is the call graph for this function:

Member Function Documentation

◆ create()

static MockInput * MockInput::create ( int  needsDisplay)
inlinestatic
Here is the call graph for this function:

◆ MOCK_METHOD() [1/2]

MockInput::MOCK_METHOD ( void  ,
begin  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [2/2]

MockInput::MOCK_METHOD ( void  ,
check  ,
()  ,
(override)   
)

◆ setIsCalibrating()

void MockInput::setIsCalibrating ( bool  isCalibrating)
inline
Here is the call graph for this function:

◆ setNeedsDisplay()

void MockInput::setNeedsDisplay ( int  displayId)
inline

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