Serial Wombat Arduino Library

Loading...
Searching...
No Matches
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:
[legend]

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

## Public Attributes
uint16_t | transitions = 0
| Number of transitions returned by last call to readTransitionsState()

## 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.

Definition at line 40 of file SerialWombatAbstractButton.h.

## Constructor & Destructor Documentation

## ◆ SerialWombatAbstractButton()

SerialWombatAbstractButton::SerialWombatAbstractButton | ( |  | ) |
| inline

Definition at line 44 of file SerialWombatAbstractButton.h.

## 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 SerialWombat18CapTouch, SerialWombatDebouncedInput, and SerialWombatMatrixButton.

## ◆ 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 SerialWombat18CapTouch, SerialWombatDebouncedInput, and SerialWombatMatrixButton.

## ◆ 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 SerialWombat18CapTouch, SerialWombatDebouncedInput, and SerialWombatMatrixButton.

## ◆ 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, SerialWombatDebouncedInput, and SerialWombatMatrixButton.

## Member Data Documentation

## ◆ transitions

uint16_t SerialWombatAbstractButton::transitions = 0

Number of transitions returned by last call to readTransitionsState()

Definition at line 72 of file SerialWombatAbstractButton.h.