ClearCore Library
Loading...
Searching...
No Matches
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.
 
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.
 
SysConnectorState InputsRT (SysConnectorState mask=UINT32_MAX)
 Current state of the on-board ClearCore inputs.
 
void InterruptsEnabled (bool enable)
 Enable or disable digital interrupts board-wide.
 
bool InterruptsEnabled ()
 Current enable state of digital interrupts.
 

Member Function Documentation

◆ InputsFallen()

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.
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.
}
SysConnectorState InputsFallen(SysConnectorState mask=UINT32_MAX)
Clear on read accessor for inputs that have fallen (transitioned from asserted to deasserted) sometim...
InputManager & InputMgr
Input manager.
Definition SysConnectors.h:174
uint32_t reg
Definition SysConnectors.h:187
struct ClearCore::SysConnectorState::@6 bit
Returns
StatusRegister whose asserted bits indicate which ClearCore inputs have fallen since the last poll.

◆ InputsRisen()

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.
}
SysConnectorState InputsRisen(SysConnectorState mask=UINT32_MAX)
Clear on read accessor for inputs that have risen (transitioned from deasserted to asserted) sometime...
Returns
StatusRegister whose asserted bits indicate which ClearCore inputs have risen since the last poll.

◆ InputsRT()

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 InputsRT(SysConnectorState mask=UINT32_MAX)
Current state of the on-board ClearCore inputs.
Returns
SysConnectorState whose asserted bits indicate ClearCore inputs that are currently asserted.

◆ InterruptsEnabled() [1/2]

bool ClearCore::InputManager::InterruptsEnabled ( )
inline

Current enable state of digital interrupts.

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

◆ InterruptsEnabled() [2/2]

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
bool InterruptHandlerSet(voidFuncPtr callback=nullptr, InputManager::InterruptTrigger trigger=InputManager::InterruptTrigger::RISING, bool enable=true)
Register the interrupt service routine to be triggered when the given input state condition is met on...
DigitalIn ConnectorDI7
DI-7 connector instance.
DigitalIn ConnectorDI8
DI-8 connector instance.
Note
Only connectors DI-6 through A-12 can trigger interrupts.
DigitalIn has a connector-specific version of this function as a class member.

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