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

Detailed Description

Connector class for an individual CCIO-8 pin.

Manages individual CCIO-8 pins.

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

For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.

Connector class for an individual CCIO-8 pin. More...

#include <CcioPin.h>

+ Inheritance diagram for ClearCore::CcioPin:
+ Collaboration diagram for ClearCore::CcioPin:

Public Member Functions

virtual ConnectorModes Mode () override
 Get the connector's operational mode. More...
 
virtual bool Mode (ConnectorModes newMode) override
 Set the connector's operational mode. More...
 
Connector::ConnectorTypes Type () override
 Get connector type. More...
 
bool IsWritable () override
 Get R/W status of the connector. More...
 
int16_t State () override
 In input mode, get the connector's last filtered sampled value. In output mode, get the connector's output state. More...
 
bool State (int16_t newState) override
 Set the output state of the connector. More...
 
void FilterLength (uint16_t samples)
 Set the connector's digital filter length in samples. The default is 3 samples. More...
 
void Filter_ms (uint16_t len)
 Set the connector's digital filter length in ms. More...
 
bool IsInHwFault () override
 Check whether the connector is in a hardware fault state. More...
 
bool InputRisen ()
 Clear on read accessor for this connector's rising input state. More...
 
bool InputFallen ()
 Clear on read accessor for this connector's falling input state. More...
 
void OutputPulsesStart (uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
 Start an output pulse. More...
 
void OutputPulsesStop (bool stopImmediately=true)
 Stop an output pulse. More...
 
- Public Member Functions inherited from ClearCore::Connector
void Reinitialize ()
 Reinitialize this connector to the power-up state. More...
 
int32_t ConnectorIndex ()
 Accessor for the bit index of this connector in the input register. More...
 
uint32_t InputRegMask ()
 Get a bit mask representing this connector. More...
 

Additional Inherited Members

- Public Types inherited from ClearCore::Connector
enum  ConnectorModes {
  INVALID_NONE, INPUT_ANALOG, INPUT_DIGITAL, OUTPUT_ANALOG,
  OUTPUT_DIGITAL, OUTPUT_H_BRIDGE, OUTPUT_PWM, OUTPUT_TONE,
  OUTPUT_WAVE, CPM_MODE_A_DIRECT_B_DIRECT, CPM_MODE_STEP_AND_DIR, CPM_MODE_A_DIRECT_B_PWM,
  CPM_MODE_A_PWM_B_PWM, TTL, RS232, SPI,
  CCIO, USB_CDC
}
 All possible operational modes for a connector. More...
 
enum  ConnectorTypes {
  DIGITAL_IN_TYPE, DIGITAL_IN_OUT_TYPE, SHIFT_REG_TYPE, ANALOG_IN_DIGITAL_IN_TYPE,
  ANALOG_OUT_DIGITAL_IN_OUT_TYPE, H_BRIDGE_TYPE, CPM_TYPE, SERIAL_TYPE,
  SERIAL_USB_TYPE, CCIO_DIGITAL_IN_OUT_TYPE
}
 The different types of ClearCore connectors. More...
 

Member Function Documentation

void ClearCore::CcioPin::Filter_ms ( uint16_t  len)

Set the connector's digital filter length in ms.

Restarts any filtering in progress.

// Sets the filter to 10ms
Parameters
[in]lenThe length of the filter in ms.
Note
The maximum filter time is 13000 milliseconds.
void ClearCore::CcioPin::FilterLength ( uint16_t  samples)
inline

Set the connector's digital filter length in samples. The default is 3 samples.

This will set the length of the filter equal to (samples * CCIO-8 refresh rate) for this connector.

Restarts any filtering in progress.

// Sets the filter to 10 samples (2ms)
Parameters
[in]samplesThe number of samples to filter.
Note
One sample time is 200 microseconds.
bool ClearCore::CcioPin::InputFallen ( )

Clear on read accessor for this connector's falling input state.

// The first CCIO-8 board's connector 0 input has transitioned from
// TRUE to FALSE since the last read.
}
Returns
true if the input has fallen since the last call
bool ClearCore::CcioPin::InputRisen ( )

Clear on read accessor for this connector's rising input state.

// The first CCIO-8 board's connector 0 input has transitioned from
// FALSE to TRUE since the last read.
}
Returns
true if the input has risen since the last call
bool ClearCore::CcioPin::IsInHwFault ( )
overridevirtual

Check whether the connector is in a hardware fault state.

// The first CCIO-8 board's connector 0 is in a fault state.
}
Returns
Connector is in fault

Implements ClearCore::Connector.

bool ClearCore::CcioPin::IsWritable ( )
inlineoverridevirtual

Get R/W status of the connector.

// The first CCIO-8 board's connector 0 is currently set as an
// output.
}
Returns
True if in OUTPUT_DIGITAL mode, false otherwise

Implements ClearCore::Connector.

virtual ConnectorModes ClearCore::CcioPin::Mode ( )
inlineoverridevirtual

Get the connector's operational mode.

// Connector 0 on the first CCIO-8 board is currently configured
// as a digital input.
}
Returns
The connector's current operational mode.

Reimplemented from ClearCore::Connector.

Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, CCIO8Examples/ReadCCIODigitalInput/ReadCCIODigitalInput.cpp, and CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp.
virtual bool ClearCore::CcioPin::Mode ( ConnectorModes  newMode)
overridevirtual

Set the connector's operational mode.

Configure the connector to operate in a new I/O mode.

// Configure the first CCIO-8 board's connector 0 as a digital output.
Parameters
[in]newModeThe new mode to be set. The valid modes for this connector type are:
Returns
Returns false if the mode is invalid or setup fails.

Implements ClearCore::Connector.

void ClearCore::CcioPin::OutputPulsesStart ( 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 the output 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.
20, true);
Parameters
[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::CcioPin::OutputPulsesStop ( bool  stopImmediately = true)

Stop an output pulse.

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

// Stop the active output pulse on the first CCIO-8's connector 0
Parameters
[in]stopImmediately(optional) If true, the output pulses will be stopped immediately; if false, any active pulse will be completed first. Default: true.
int16_t ClearCore::CcioPin::State ( )
overridevirtual

In input mode, get the connector's last filtered sampled value. In output mode, get the connector's output state.

// The first CCIO-8 board's connector 0 input is high.
}
Returns
The latest filtered value on this connector when in input mode; the output state when in output mode.

Implements ClearCore::Connector.

Examples:
CCIO8Examples/ClearCoreIOExpansionBoard/ClearCoreIOExpansionBoard.cpp, CCIO8Examples/ReadCCIODigitalInput/ReadCCIODigitalInput.cpp, and CCIO8Examples/WriteCCIODigitalOutput/WriteCCIODigitalOutput.cpp.
bool ClearCore::CcioPin::State ( int16_t  newState)
overridevirtual

Set the output state of the connector.

This allows you to change the output value of the connector item.

// Set the first CCIO-8 board's connector 0 output to high.
Parameters
[in]newStateThe value to be output.

Implements ClearCore::Connector.

Connector::ConnectorTypes ClearCore::CcioPin::Type ( )
inlineoverridevirtual

Get connector type.

if (ConnectorAlias->Type() == CCIO_DIGITAL_IN_OUT_TYPE) {
// This generic connector variable is a CCIO-8 pin.
}
Returns
The type of the current connector.

Implements ClearCore::Connector.


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