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

Member Function Documentation

◆ CcioCount()

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();
volatile const uint8_t & CcioCount()
Accessor for the number of CCIO-8 boards connected to the ClearCore.
Definition CcioBoardManager.h:246
CcioBoardManager & CcioMgr
CCIO-8 manager.
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, and ClearCoreIOExpansionBoard.cpp.

◆ CcioDiscover()

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
uint8_t CcioDiscover(SerialDriver *comInstance)
Polls for and discovers all CCIO-8 boards connected to the ClearCore.
SerialDriver ConnectorCOM1
COM-1 connector instance.
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.

◆ CcioRediscoverEnable()

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
void CcioRediscoverEnable(bool enable)
Enable or Disable the automatic rediscover function.
Note
This feature is enabled by default.
Parameters
[in]enableWhether to enable or disable rediscover.

◆ InputsFallen()

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.
}
uint64_t InputsFallen(uint64_t mask=UINT64_MAX)
Clear on read accessor for falling input edges.
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, and ClearCoreIOExpansionBoard.cpp.

◆ InputsRisen()

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.
}
uint64_t InputsRisen(uint64_t mask=UINT64_MAX)
Clear on read accessor for rising input edges.
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, and ClearCoreIOExpansionBoard.cpp.

◆ InputState()

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();
volatile const uint64_t & InputState()
Accessor for all the CCIO-8 pins' filtered input states.
Definition CcioBoardManager.h:349
Returns
A bitmask indicating which CCIO-8 inputs are asserted.
Examples
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, and ClearCoreIOExpansionBoard.cpp.

◆ IoOverloadAccum()

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();
uint64_t IoOverloadAccum()
Accessor for all the CCIO-8 pins' accumulated overload states.
Returns
A bitmask indicating which CCIO-8 pins have been overloaded since the last time IoOverloadAccum() was called.

◆ IoOverloadRT()

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
}
volatile const uint64_t & IoOverloadRT()
Accessor for all the CCIO-8 pins' overloaded states.
Definition CcioBoardManager.h:277
Returns
A bitmask indicating which CCIO-8 pins have asserted outputs but the subsequent read of the input is FALSE.

◆ IoOverloadSinceStartupAccum()

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();
volatile const uint64_t & IoOverloadSinceStartupAccum()
Accessor for all the CCIO-8 pins' accumulated overload states.
Definition CcioBoardManager.h:305
Returns
A bitmask indicating which CCIO-8 pins have been overloaded since the ClearCore has been restarted.

◆ LinkBroken()

volatile const bool & ClearCore::CcioBoardManager::LinkBroken ( )
inline

Accessor for the CCIO-8 link status.

// The link is down, handle it somehow
}
volatile const bool & LinkBroken()
Accessor for the CCIO-8 link status.
Definition CcioBoardManager.h:261
Returns
True if the CCIO-8 link is broken.
Examples
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, and ClearCoreIOExpansionBoard.cpp.

◆ OutputPulsesActive()

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
}
volatile const uint64_t & OutputPulsesActive()
Check the output pulse state.
Definition CcioBoardManager.h:194
Returns
A bitmask representing which pins are sending output pulses.

◆ OutputPulsesStart()

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.
@ CLEARCORE_PIN_CCIOA0
CCIO-8 board 1, connector 0.
Definition SysConnectors.h:89
void OutputPulsesStart(ClearCorePins pinNum, uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
Start an output pulse.
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.

◆ OutputPulsesStop()

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.
void OutputPulsesStop(ClearCorePins pinNum, bool stopImmediately=true)
Stop an output pulse.
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.

◆ OutputState()

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();
volatile const uint64_t & OutputState()
Accessor for all the CCIO-8 pins' output states.
Definition CcioBoardManager.h:363
Returns
A bitmask indicating which CCIO-8 outputs are asserted.

◆ PinByIndex()

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.
}
CcioPin * PinByIndex(ClearCorePins connectorIndex)
Accessor for the individual CCIO-8 pin connectors.
int16_t State() override
In input mode, get the connector's last filtered sampled value. In output mode, get the connector's o...
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, CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp, ClearCoreIOExpansionBoard.cpp, ReadCCIODigitalInput.cpp, and WriteCCIODigitalOutput.cpp.

◆ PinState() [1/2]

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.
}
bool PinState(ClearCorePins pinNum)
Read the digital state of the specified CCIO-8 pin.
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.

◆ PinState() [2/2]

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.

◆ RefreshRate()

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: