Serial Wombat Arduino Library
Public Member Functions | Public Attributes | List of all members
SerialWombatAbstractButton Class Referenceabstract

SerialWombat18CapTouch, SerialWombatDebouncedInput and SerialWombatMatrixButton inherit from this class. More...

#include <SerialWombatAbstractButton.h>

Inheritance diagram for SerialWombatAbstractButton:
SerialWombat18CapTouch SerialWombatDebouncedInput SerialWombatMatrixButton

Public Member Functions

 SerialWombatAbstractButton ()
 
virtual bool digitalRead ()=0
 Returns the state of the input. More...
 
virtual uint16_t readDurationInTrueState_mS ()=0
 return the number of mS that the input has been in true state More...
 
virtual uint16_t readDurationInFalseState_mS ()=0
 return the number of mS that the input has been in false state More...
 
virtual bool readTransitionsState (bool resetTransitionCounts=true)=0
 Queries the number of transistions that have occured on the debounced input. More...
 

Public Attributes

uint16_t transitions = 0
 Number of transitions returned by last call to readTransitionsState() More...
 

Detailed Description

SerialWombat18CapTouch, SerialWombatDebouncedInput and SerialWombatMatrixButton inherit from this class.

This class provides a basic set of interface for any pin mode class that has a button-like interface It allows classes like SerialWombatButtonCounter to work uniformly with any button-like class.

Constructor & Destructor Documentation

◆ SerialWombatAbstractButton()

SerialWombatAbstractButton::SerialWombatAbstractButton ( )
inline

Member Function Documentation

◆ digitalRead()

virtual bool SerialWombatAbstractButton::digitalRead ( )
pure virtual

Returns the state of the input.

This function reads the status of an input

Returns
TRUE or FALSE. Meaning depends on inversion setting

Implemented in SerialWombatMatrixButton, SerialWombat18CapTouch, and SerialWombatDebouncedInput.

◆ readDurationInFalseState_mS()

virtual uint16_t SerialWombatAbstractButton::readDurationInFalseState_mS ( )
pure virtual

return the number of mS that the input has been in false state

Note that this value starts incrementing after any debounce period, not after the physical pin transition.

Returns
returns a value in mS which saturates at 65535. Returns 0 if currently true.

Implemented in SerialWombatMatrixButton, SerialWombat18CapTouch, and SerialWombatDebouncedInput.

◆ readDurationInTrueState_mS()

virtual uint16_t SerialWombatAbstractButton::readDurationInTrueState_mS ( )
pure virtual

return the number of mS that the input has been in true state

Note that this value starts incrementing after the debounce period, not after the physical pin transition.

Returns
returns a value in mS which saturates at 65535. Returns 0 if currently false.

Implemented in SerialWombatMatrixButton, SerialWombat18CapTouch, and SerialWombatDebouncedInput.

◆ readTransitionsState()

virtual bool SerialWombatAbstractButton::readTransitionsState ( bool  resetTransitionCounts = true)
pure virtual

Queries the number of transistions that have occured on the debounced input.

This function queries the debounced input for current state and transitions since last call. transition count is put in the global member transitions. The debounced input in the Serial Wombat resets its count to zero after this call.

Returns
TRUE or FALSE, current status of debounced input

Implemented in SerialWombat18CapTouch, and SerialWombatDebouncedInput.

Member Data Documentation

◆ transitions

uint16_t SerialWombatAbstractButton::transitions = 0

Number of transitions returned by last call to readTransitionsState()