ClearCore Library
List of all members | Public Types | Public Member Functions
ClearCore::InputManager Class Reference

Detailed Description

ClearCore input state access.

Provides consolidated access to the input state of all of the ClearCore connectors.

ClearCore input state access. More...

#include <InputManager.h>

Public Types

enum  InterruptTrigger {
  NONE = -1, LOW = 0, HIGH = 1, CHANGE = 2,
  FALLING = 3, RISING = 4
}
 The possible input state conditions to trigger an interrupt on.
 

Public Member Functions

SysConnectorState InputsRisen (SysConnectorState mask=UINT32_MAX)
 Clear on read accessor for inputs that have risen (transitioned from deasserted to asserted) sometime since the previous invocation of this function. More...
 
SysConnectorState InputsFallen (SysConnectorState mask=UINT32_MAX)
 Clear on read accessor for inputs that have fallen (transitioned from asserted to deasserted) sometime since the previous invocation of this function. More...
 
SysConnectorState InputsRT (SysConnectorState mask=UINT32_MAX)
 Current state of the on-board ClearCore inputs. More...
 
void InterruptsEnabled (bool enable)
 Enable or disable digital interrupts board-wide. More...
 
bool InterruptsEnabled ()
 Current enable state of digital interrupts. More...
 

Member Function Documentation

SysConnectorState ClearCore::InputManager::InputsFallen ( SysConnectorState  mask = UINT32_MAX)

Clear on read accessor for inputs that have fallen (transitioned from asserted to deasserted) sometime since the previous invocation of this function.

Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore inputs to check for falling edges. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for falling edges. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report falling edges on any of the ClearCore inputs.
// Generate a mask to filter only the falling edges we care to see.
SysConnectorState mask;
mask.bit.CLEARCORE_PIN_IO0 = 1;
mask.bit.CLEARCORE_PIN_IO1 = 1;
uint32_t inputFallenReg = InputMgr.InputsFallen(mask).reg;
if (inputFallenReg) {
// The state of either IO-0 or IO-1 has fallen since the
// last time InputsFallen() was called.
}
Returns
StatusRegister whose asserted bits indicate which ClearCore inputs have fallen since the last poll.
SysConnectorState ClearCore::InputManager::InputsRisen ( SysConnectorState  mask = UINT32_MAX)

Clear on read accessor for inputs that have risen (transitioned from deasserted to asserted) sometime since the previous invocation of this function.

Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore inputs to check for rising edges. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for rising edges. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report rising edges on any of the ClearCore inputs.
// Utilize the full InputMgr Register to view rising edges.
uint32_t inputRisenReg = InputMgr.InputsRisen().reg;
if (inputRisenReg) {
// The state of one or more inputs has risen since the
// last time InputsRisen() was called.
}
Returns
StatusRegister whose asserted bits indicate which ClearCore inputs have risen since the last poll.
SysConnectorState ClearCore::InputManager::InputsRT ( SysConnectorState  mask = UINT32_MAX)

Current state of the on-board ClearCore inputs.

Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore inputs to check for falling edges. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for falling edges. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report falling edges on any of the ClearCore inputs.
// Save the current state of all inputs for future use
SysConnectorState currState = InputMgr.InputsRT();
Returns
SysConnectorState whose asserted bits indicate ClearCore inputs that are currently asserted.
void ClearCore::InputManager::InterruptsEnabled ( bool  enable)

Enable or disable digital interrupts board-wide.

// Set up an interrupt callback for 2 connectors
ConnectorDI7.InterruptHandlerSet(&myCallback, InputManager::RISING);
ConnectorDI8.InterruptHandlerSet(&myCallback, InputManager::RISING);
// Enable both interrupts at once
Note
Only connectors DI-6 through A-12 can trigger interrupts.
DigitalIn has a connector-specific version of this function as a class member.
bool ClearCore::InputManager::InterruptsEnabled ( )
inline

Current enable state of digital interrupts.

// Input interrupts are globally enabled, do something (like disable
// them).
}
Returns
true if interrupts are enabled board-wide, false if not.
Note
Only connectors DI-6 through A-12 can trigger interrupts.

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