Serial Wombat Arduino Library
Public Member Functions | List of all members
SerialWombatMatrixButton Class Reference

Class that runs on top of SerialWombatMatrixKeypad to treat a key as an individual button. More...

#include <SerialWombatMatrixKeypad.h>

Inheritance diagram for SerialWombatMatrixButton:
SerialWombatAbstractButton

Public Member Functions

 SerialWombatMatrixButton (SerialWombatMatrixKeypad &kp, uint8_t keyIndex)
 Instantiate a SerialWombatMatrixButton. More...
 
bool digitalRead ()
 Returns the state of the input. More...
 
uint16_t readDurationInFalseState_mS ()
 return the number of mS that the button has been in false state More...
 
uint16_t readDurationInTrueState_mS ()
 return the number of mS that the button has been in true state More...
 
bool readTransitionsState ()
 Queries the number of transistions that have occured on the button. More...
 
- Public Member Functions inherited from SerialWombatAbstractButton
 SerialWombatAbstractButton ()
 
virtual bool readTransitionsState (bool resetTransitionCounts=true)=0
 Queries the number of transistions that have occured on the debounced input. More...
 

Additional Inherited Members

- Public Attributes inherited from SerialWombatAbstractButton
uint16_t transitions = 0
 Number of transitions returned by last call to readTransitionsState() More...
 

Detailed Description

Class that runs on top of SerialWombatMatrixKeypad to treat a key as an individual button.

This class allows a single key from a SerialWombatMatrixKeypad to be treated as an individual SerialWombatAbstractButton that can be read as such or passed to SerialWombatButtonCounter .

Constructor & Destructor Documentation

◆ SerialWombatMatrixButton()

SerialWombatMatrixButton::SerialWombatMatrixButton ( SerialWombatMatrixKeypad kp,
uint8_t  keyIndex 
)
inline

Instantiate a SerialWombatMatrixButton.

Parameters
kpAn initialized SerialWombatMatrixKeypad
keyIndexa number 0-15 indicating which key (index, not ascii value) is treated as a button

Member Function Documentation

◆ digitalRead()

bool SerialWombatMatrixButton::digitalRead ( )
inlinevirtual

Returns the state of the input.

This function reads from the public data of the pin which indicates the state of the input

Returns
TRUE for pressed or FALSE.

Implements SerialWombatAbstractButton.

◆ readDurationInFalseState_mS()

uint16_t SerialWombatMatrixButton::readDurationInFalseState_mS ( )
inlinevirtual

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

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

Implements SerialWombatAbstractButton.

◆ readDurationInTrueState_mS()

uint16_t SerialWombatMatrixButton::readDurationInTrueState_mS ( )
inlinevirtual

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

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

Implements SerialWombatAbstractButton.

◆ readTransitionsState()

bool SerialWombatMatrixButton::readTransitionsState ( )
inline

Queries the number of transistions that have occured on the button.

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

Returns
TRUE or FALSE, current status of debounced input