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

Detailed Description

ClearCore I/O Expansion Board Manager Class.

This is the manager class for all the CCIO-8 pin connectors. The CCIO-8 link state is established and queried through this class, as well as the filter setting for all of the CCIO-8 connectors. Each CCIO-8 connector can be accessed through this class, in addition to the individual access available through the CcioPin class.

For more detailed information on the CCIO-8 system, check out the ClearCore I/O Expansion Board informational page.

ClearCore I/O Expansion Board Manager Class. More...

#include <CcioBoardManager.h>

Public Member Functions

bool PinState (ClearCorePins pinNum)
 Read the digital state of the specified CCIO-8 pin. More...
 
void PinState (ClearCorePins pinNum, bool newState)
 Write the digital state to the specified CCIO-8 pin. More...
 
void OutputPulsesStart (ClearCorePins pinNum, uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
 Start an output pulse. More...
 
void OutputPulsesStop (ClearCorePins pinNum, bool stopImmediately=true)
 Stop an output pulse. More...
 
volatile const uint64_t & OutputPulsesActive ()
 Check the output pulse state. More...
 
uint8_t CcioDiscover (SerialDriver *comInstance)
 Polls for and discovers all CCIO-8 boards connected to the ClearCore. More...
 
volatile const uint8_t & CcioCount ()
 Accessor for the number of CCIO-8 boards connected to the ClearCore. More...
 
volatile const bool & LinkBroken ()
 Accessor for the CCIO-8 link status. More...
 
volatile const uint64_t & IoOverloadRT ()
 Accessor for all the CCIO-8 pins' overloaded states. More...
 
uint64_t IoOverloadAccum ()
 Accessor for all the CCIO-8 pins' accumulated overload states. More...
 
volatile const uint64_t & IoOverloadSinceStartupAccum ()
 Accessor for all the CCIO-8 pins' accumulated overload states. More...
 
uint64_t InputsRisen (uint64_t mask=UINT64_MAX)
 Clear on read accessor for rising input edges. More...
 
uint64_t InputsFallen (uint64_t mask=UINT64_MAX)
 Clear on read accessor for falling input edges. More...
 
volatile const uint64_t & InputState ()
 Accessor for all the CCIO-8 pins' filtered input states. More...
 
volatile const uint64_t & OutputState ()
 Accessor for all the CCIO-8 pins' output states. More...
 
void CcioRediscoverEnable (bool enable)
 Enable or Disable the automatic rediscover function. More...
 
CcioPinPinByIndex (ClearCorePins connectorIndex)
 Accessor for the individual CCIO-8 pin connectors. More...
 
uint8_t RefreshRate ()
 Accessor for the CCIO-8 link refresh rate. More...
 

Member Function Documentation

volatile const uint8_t& ClearCore::CcioBoardManager::CcioCount ( )
inline

Accessor for the number of CCIO-8 boards connected to the ClearCore.

// Save how many CCIO-8 boards are in the link
uint8_t boardCount = CcioMgr.CcioCount();
Note
If the CCIO link is broken CcioCount will return the number of CCIO-8 boards in the previously working link. CcioCount will only update when a new, healthy CCIO link network is detected.
Returns
Number of CCIO-8 devices connected.
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp.
uint8_t ClearCore::CcioBoardManager::CcioDiscover ( SerialDriver comInstance)

Polls for and discovers all CCIO-8 boards connected to the ClearCore.

// Discover and create a CCIO-8 link on COM-1
Note
Typically this function will not need to be called. Opening a SerialDriver port in CCIO mode will automatically discover all CCIO connections on that port. This function is only necessary when the Auto- Rediscover feature is disabled and a broken CCIO link needs to be rebuilt.
Parameters
[in]comInstanceA pointer to the SerialDriver that controls the serial port that the CCIO-8 is plugged into
Returns
Number of CCIO-8 devices connected.
void ClearCore::CcioBoardManager::CcioRediscoverEnable ( bool  enable)

Enable or Disable the automatic rediscover function.

If the CCIO-8 link is broken the CcioBoardManager can attempt to rebuild the link.

// Turn off the CCIO-8 rediscover feature
Note
This feature is enabled by default.
Parameters
[in]enableWhether to enable or disable rediscover.
uint64_t ClearCore::CcioBoardManager::InputsFallen ( uint64_t  mask = UINT64_MAX)

Clear on read accessor for falling input edges.

// An input on a CCIO-8 has fallen, react to it.
}
Parameters
[in]mask(optional) The CCIO-8 bits to check for falling edges.
Returns
CCIO-8 bits that have fallen since last poll.
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp.
uint64_t ClearCore::CcioBoardManager::InputsRisen ( uint64_t  mask = UINT64_MAX)

Clear on read accessor for rising input edges.

// An input on a CCIO-8 has risen, react to it.
}
Parameters
[in]mask(optional) The CCIO-8 bits to check for rising edges.
Returns
CCIO-8 bits that have risen since last poll.
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp.
volatile const uint64_t& ClearCore::CcioBoardManager::InputState ( )
inline

Accessor for all the CCIO-8 pins' filtered input states.

// Save a reference to the state of all CCIO-8 input points.
uint64_t iState = CcioMgr.InputState();
Returns
A bitmask indicating which CCIO-8 inputs are asserted.
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp.
uint64_t ClearCore::CcioBoardManager::IoOverloadAccum ( )

Accessor for all the CCIO-8 pins' accumulated overload states.

// Save the I/O points that have overloaded since the previous read
uint64_t accumOverloads = CcioMgr.IoOverloadAccum();
Returns
A bitmask indicating which CCIO-8 pins have been overloaded since the last time IoOverloadAccum() was called.
volatile const uint64_t& ClearCore::CcioBoardManager::IoOverloadRT ( )
inline

Accessor for all the CCIO-8 pins' overloaded states.

// There is an overload I/O point, handle it
}
Returns
A bitmask indicating which CCIO-8 pins have asserted outputs but the subsequent read of the input is FALSE.
volatile const uint64_t& ClearCore::CcioBoardManager::IoOverloadSinceStartupAccum ( )
inline

Accessor for all the CCIO-8 pins' accumulated overload states.

// Save the I/O points that have overloaded since program startup
uint64_t accumOverloads = CcioMgr.IoOverloadSinceStartupAccum();
Returns
A bitmask indicating which CCIO-8 pins have been overloaded since the ClearCore has been restarted.
volatile const bool& ClearCore::CcioBoardManager::LinkBroken ( )
inline

Accessor for the CCIO-8 link status.

// The link is down, handle it somehow
}
Returns
True if the CCIO-8 link is broken.
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp.
volatile const uint64_t& ClearCore::CcioBoardManager::OutputPulsesActive ( )
inline

Check the output pulse state.

This allows you to see which CCIO-8 pins have active output pulses being sent.

// If there's an output pulse active on any output, do something
}
Returns
A bitmask representing which pins are sending output pulses.
void ClearCore::CcioBoardManager::OutputPulsesStart ( ClearCorePins  pinNum,
uint32_t  onTime,
uint32_t  offTime,
uint16_t  pulseCount = 0,
bool  blockUntilDone = false 
)

Start an output pulse.

This allows you to start a pulse on a CCIO-8 connector that is on for onTime milliseconds and off for offTime milliseconds and will stop after pulseCount cycles. A pulseCount of 0 will cause the pulse to run endlessly.

If a pulse is already running, calling this will allow you to override the previous pulse (after the next change in state).

// Begin a 100ms on/200ms off pulse on the first CCIO-8 board's
// connector 0 output that will complete 20 cycles and prevent further
// code execution until the cycles are complete.
Parameters
[in]pinNumThe CCIO-8 pin number.
[in]onTimeThe amount of time the input will be held on [ms].
[in]offTimeThe amount of time the input will be held off [ms].
[in]pulseCount(optional) The amount of cycles the pulse will run for. Default: 0 (pulse runs endlessly).
[in]blockUntilDone(optional) If true, the function doesn't return until the pulses have been sent. Default: false.
void ClearCore::CcioBoardManager::OutputPulsesStop ( ClearCorePins  pinNum,
bool  stopImmediately = true 
)

Stop an output pulse.

This allows you to stop the currently running pulse on a CCIO-8 output. The output will always be set to FALSE after canceling a pulse.

// Stop the active output pulse on the first CCIO-8 board's connector 0.
Parameters
[in]pinNumThe CCIO-8 pin number
[in]stopImmediately(optional) If true, the output pulses will be stopped immediately; if false, any active pulse will be completed first. Default: true.
volatile const uint64_t& ClearCore::CcioBoardManager::OutputState ( )
inline

Accessor for all the CCIO-8 pins' output states.

// Save a reference to the state of all CCIO-8 output points.
uint64_t oState = CcioMgr.OutputState();
Returns
A bitmask indicating which CCIO-8 outputs are asserted.
CcioPin* ClearCore::CcioBoardManager::PinByIndex ( ClearCorePins  connectorIndex)

Accessor for the individual CCIO-8 pin connectors.

// The first CCIO-8 board's connector 0 input is high.
}
Parameters
[in]connectorIndexThe index of the CCIO-8 pin being requested
Returns
A pointer to the corresponding CcioPin Connector object
Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, CCIO8Examples/ReadCCIODigitalInput/ReadCCIODigitalInput.cpp, and CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp.
bool ClearCore::CcioBoardManager::PinState ( ClearCorePins  pinNum)

Read the digital state of the specified CCIO-8 pin.

// The state of connector 0 on the first CCIO-8 board is high.
}
Parameters
[in]pinNumThe CCIO-8 pin number
Returns
Returns true if the pin state is TRUE, and false if the pin state is FALSE, or if the specified CCIO-8 pin does not exist, or if the CcioBoardManager is not yet initialized.
void ClearCore::CcioBoardManager::PinState ( ClearCorePins  pinNum,
bool  newState 
)

Write the digital state to the specified CCIO-8 pin.

// Set the first CCIO-8 board's connector 0 output FALSE.
Parameters
[in]pinNumThe CCIO-8 pin number
[in]newStateThe digital value to be written to the connector.
uint8_t ClearCore::CcioBoardManager::RefreshRate ( )
inline

Accessor for the CCIO-8 link refresh rate.

Calculates and returns the refresh rate based on the number of CCIO-8 boards currently connected.


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