ClearCore Library
List of all members | Classes | Public Member Functions
ClearCore::StatusManager Class Reference

Detailed Description

ClearCore Status Register Manager class.

This class manages access to ClearCore status information.

ClearCore Status Register Manager class. More...

#include <StatusManager.h>

Classes

union  StatusRegister
 

Public Member Functions

StatusRegister StatusRT (StatusRegister mask=UINT32_MAX)
 The real time status register. More...
 
StatusRegister StatusRisen (StatusRegister mask=UINT32_MAX)
 Clear on read accessor for status bits that have risen (transitioned from deasserted to asserted) sometime since the previous invocation of this function. More...
 
StatusRegister StatusFallen (StatusRegister mask=UINT32_MAX)
 Clear on read accessor for status bits that have fallen (transitioned from asserted to deasserted) sometime since the previous invocation of this function. More...
 
StatusRegister StatusAccum (StatusRegister mask=UINT32_MAX)
 Accumulating Clear on read accessor for any status bits that were asserted sometime since the previous invocation of this function. More...
 
StatusRegister SinceStartupAccum (StatusRegister mask=UINT32_MAX)
 Access to all accumulated status bits that have asserted since board startup (or since the last board reset). More...
 
void BlinkCodeClear (uint8_t group, uint8_t code)
 
void HBridgeReset ()
 Starts a reset pulse to the DigitalInOutHBridge connectors. More...
 
bool AdcIsInTimeout ()
 Read accessor for whether the ADC has timed out while attempting a conversion. More...
 
SysConnectorState IoOverloadRT (SysConnectorState mask=UINT32_MAX)
 Accessor for the real time overload status of the I/O connectors. More...
 
SysConnectorState IoOverloadAccum (SysConnectorState mask=UINT32_MAX)
 Clear on read accessor for connector overload status since the last invocation of this function. More...
 
SysConnectorState IoOverloadSinceStartupAccum (SysConnectorState mask=UINT32_MAX)
 Accessor for connector overload status since startup (or board reset). More...
 
void UserBlinkCode (uint8_t mask)
 

Member Function Documentation

bool ClearCore::StatusManager::AdcIsInTimeout ( )

Read accessor for whether the ADC has timed out while attempting a conversion.

// ADC has timed out.
}
Returns
True if the ADC is currently timed out, false otherwise.
void ClearCore::StatusManager::BlinkCodeClear ( uint8_t  group,
uint8_t  code 
)
inline

Deactivate a blink code.

Clear out a currently active blink code. This is useful for when an error can be fixed on the fly, while the board is still operating, to avoid being continually alerted to the error even after it was resolved.

Parameters
[in]groupThe group number the blink code belongs to.
[in]codeThe blink code number to clear.
// Check for an historical overload on connector IO-0.
if (StatusMgr.IoOverloadAccum().bit.CLEARCORE_PIN_IO0) {
// Clear out the reporting of the overload (blink code 1-1)
}

See ClearCore Status Blink Codes for group and code numbers.

void ClearCore::StatusManager::HBridgeReset ( )

Starts a reset pulse to the DigitalInOutHBridge connectors.

Resetting the HBridge will temporarily disable the DigitalInOutHBridge and MotorDriver connectors.

// Reset the HBridge connectors.
Note
Any active step and direction moves on the MotorDriver connectors will be terminated.
Examples:
DigitalIOExamples/WriteHBridgeOutput/WriteHBridgeOutput.cpp.
SysConnectorState ClearCore::StatusManager::IoOverloadAccum ( SysConnectorState  mask = UINT32_MAX)

Clear on read accessor for connector overload status since the last invocation of this function.

// There has been a connector overload since the last call to
// IoOverloadAccum().
}
Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore connector overload status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for connector overloads. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report any connectors in an overload state since the last invocation of this function.
Returns
SysConnectorState register whose asserted bits indicate which connectors have been overloaded since the last poll.
SysConnectorState ClearCore::StatusManager::IoOverloadRT ( SysConnectorState  mask = UINT32_MAX)

Accessor for the real time overload status of the I/O connectors.

if (StatusMgr.IoOverloadRT().bit.CLEARCORE_PIN_IO3) {
// IO-3 is currently overloaded.
}
Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore connector overload status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for connector overloads. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report any connectors currently in an overloaded state.
Returns
SysConnectorState register whose asserted bits indicate which connectors are currently overloaded.
SysConnectorState ClearCore::StatusManager::IoOverloadSinceStartupAccum ( SysConnectorState  mask = UINT32_MAX)

Accessor for connector overload status since startup (or board reset).

if (StatusMgr.IoOverloadSinceStartupAccum().bit.CLEARCORE_PIN_IO3) {
// Connector IO-3 has overloaded since startup.
}
if (StatusMgr.IoOverloadSinceStartupAccum().bit.CLEARCORE_PIN_IO2) {
// Connector IO-2 was overloaded since startup.
}
Parameters
[in]mask(optional) A SysConnectorState whose asserted bits indicate which of the ClearCore connector overload status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for connector overloads. If no mask is provided, it's equivalent to passing a SysConnectorState with all bits asserted, in which case this function would report any connectors that have been in an overload state since board startup.
Returns
SysConnectorState register whose asserted bits indicate which connectors have been overloaded since startup.
StatusRegister ClearCore::StatusManager::SinceStartupAccum ( StatusRegister  mask = UINT32_MAX)

Access to all accumulated status bits that have asserted since board startup (or since the last board reset).

Note
This is not a clear on read operation, so reading this register does not automatically clear out the bits that have been raised, unlike StatusRisen() and StatusFallen().
// See if any CCIO-8 link errors have occurred since startup.
bool ccioConnectionProb =
if (ccioConnectionProb) {
// The CCIO-8 link is broken; do something about it here.
}
Parameters
[in]mask(optional) A StatusRegister whose asserted bits indicate which of the ClearCore status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for asserted status bits. If no mask is provided, it's equivalent to passing a StatusRegister with all bits asserted, in which case this function would report any accumulated asserted status bits.
Returns
StatusRegister whose asserted bits indicate which ClearCore status bits have risen since startup.
StatusRegister ClearCore::StatusManager::StatusAccum ( StatusRegister  mask = UINT32_MAX)

Accumulating Clear on read accessor for any status bits that were asserted sometime since the previous invocation of this function.

Note
This is similar to StatusRisen() except that it tracks asserted status bits rather than status bits that have transitioned from deasserted to asserted. Therefore in the case that the supply voltage has been low since startup, i.e. its status bit has been set since startup, calling this function repeatedly will show that bit asserted each time, while calling StatusRisen() repeatedly will only show the bit asserted on the first call, since it transitioned from deasserted to asserted only once at startup.
// See if any CCIO-8 link errors have occurred since the last call
bool ccioConnectionProb = StatusMgr.StatusAccum().bit.CcioLinkBroken;
if (ccioConnectionProb) {
// The CCIO-8 link is broken; do something about it here.
}
Parameters
[in]mask(optional) A StatusRegister whose asserted bits indicate which of the ClearCore status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for asserted status bits. If no mask is provided, it's equivalent to passing a StatusRegister with all bits asserted, in which case this function would report any accumulated asserted status bits.
Returns
StatusRegister whose asserted bits indicate which ClearCore status bits have been asserted since the last poll.
StatusRegister ClearCore::StatusManager::StatusFallen ( StatusRegister  mask = UINT32_MAX)

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

// Check if any power supply problems have gone away since the last call
StatusManager::StatusRegister mask;
mask.bit.VSupplyOverVoltage = 1;
mask.bit.VSupplyUnderVoltage = 1;
StatusManager::StatusRegister fallen = StatusMgr.StatusFallen(mask);
if (fallen.reg) {
// Power supply problems have gone away since last call
}
Parameters
[in]mask(optional) A StatusRegister whose asserted bits indicate which of the ClearCore status bits 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 StatusRegister with all bits asserted, in which case this function would report falling edges on any of the status bits.
Returns
StatusRegister whose asserted bits indicate which ClearCore status bits have fallen since the last poll.
StatusRegister ClearCore::StatusManager::StatusRisen ( StatusRegister  mask = UINT32_MAX)

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

// Check if any power supply problems have occurred since the last call
StatusManager::StatusRegister mask;
mask.bit.VSupplyOverVoltage = 1;
mask.bit.VSupplyUnderVoltage = 1;
StatusManager::StatusRegister risen = StatusMgr.StatusRisen(mask);
if (risen.reg) {
// Power supply problems have occurred since last call.
}
Parameters
[in]mask(optional) A StatusRegister whose asserted bits indicate which of the ClearCore status bits 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 StatusRegister with all bits asserted, in which case this function would report rising edges on any of the status bits.
Returns
StatusRegister whose asserted bits indicate which ClearCore status bits have risen since the last poll.
StatusRegister ClearCore::StatusManager::StatusRT ( StatusRegister  mask = UINT32_MAX)

The real time status register.

The bits that are asserted in the status register that's returned indicate events that are occurring now.

Note
This register shows a real-time view of the ClearCore's status. Some of the status bits contained within are of a transient nature and will not persist for multiple samples. This means that your polling of this register may miss certain status events. To catch these events poll the StatusRisen and StatusFallen registers.
// Save the current ADC timeout status as a bool.
bool adcTimedOut = StatusMgr.StatusRT().bit.AdcTimeout;
if (adcTimedOut) {
// The ADC has timed out.
}
Parameters
[in]mask(optional) A StatusRegister whose asserted bits indicate which of the ClearCore status bits to check for an asserted state. If one of the bit members of this mask are deasserted, that bit will be ignored when checking for asserted status bits. If no mask is provided, it's equivalent to passing a StatusRegister with all bits asserted, in which case this function would report any status bits that are currently asserted.
Returns
StatusRegister whose asserted bits indicate currently active ClearCore status events.
Examples:
ClearCoreBoardStatus/ClearCoreStatusRegister/ClearCoreStatusRegister.cpp, and DigitalIOExamples/WriteHBridgeOutput/WriteHBridgeOutput.cpp.
void ClearCore::StatusManager::UserBlinkCode ( uint8_t  mask)
inline

Activate an application driven blink code.

This function allows the application code to display a blink code in the #BLINK_GROUP_APPLICATION code group.

// If an error code is present, display the corresponding blink code.
uint8_t errorCode = 3;
if (errorCode) {
StatusMgr.UserBlinkCode(1 << (errorCode-1));
}
Parameters
[in]maskA mask representing an aggregate of blink codes to display.

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